You are required by federal regulations to store all your "food" properly throughout Yosemite National Park. You must have your food stored unless it's within arm's reach of an awake person (so, don't go for a swim or take a nap while leaving food out).
"Food" includes all food and drinks, regardless of packaging, along with trash, toiletries, and other scented items. These items must be stored in either an allowed bear-resistant food container or food locker. Hanging food is illegal throughout Yosemite.
Bear-Resistant Food Containers
Certain bear-resistant portable containers designed for backpackers to store food are allowed for use in Yosemite (however, only the Garcia Backpackers' Cache 812 is available for rental in Yosemite).
Food lockers ("bear boxes") are only available at designated campsites in Little Yosemite Valley and adjacent to the five High Sierra Camps. You are encouraged to carry bear-resistant containers even when hiking in areas where bear boxes are available because they may be unavailable or full in these busy areas. Bear-resistant containers increase your freedom in selecting campsites away from developed or highly used areas. Food lockers are communal: personal locks are not allowed and will be removed.
How to Use a Bear-Resistant Container
The most important part of using a bear-resistant container is what goes inside it. Make sure all food, all trash, all toiletries, and all other scented items are inside the container. This includes but is not limited to all sealed or packaged food, sunscreen, soap, mosquito repellent, lip balm, deodorant, medications, and feminine products. As a general rule, if you put it in your mouth or on your skin, it should probably be stored in a bear-resistant container.
The container only works if it's closed and locked! Be sure to keep it closed and locked, even while you're around your campsite. Place the container on the ground 25 to 50 feet from your campsite, in a place where a bear can't easily roll it away. Take care not to place it near a cliff or any water source, as a bear may knock the container around or roll it down a hill. Do not hang or attach anything to the container (ropes attached to the container enable a bear to carry it away). You can place pots and pans on top of the container as a bear alarm if you like. (Read about what to do if you see a bear.)
The best way to carry a bear-resistant container is inside your pack. Think of it as a big stuff sack, though it will always occupy the same amount of space. Later in your trip, when you have eaten some of your food, you can place other items inside the container to conserve space.
Most people don't pack their bear canisters very efficiently. Read more about how to pack a bear canister.