Rust in storage usually comes from two things: moisture left on the pan, and humid air around it. The fix is to dry the pan thoroughly, store it somewhere with low humidity and some airflow, and use a very thin oil coat if the pan will sit for a long time. Stop the rust early, and it is easy to manage.
Dry the pan thoroughly
Any water left on the surface, in the handle joint, or on the underside can start rust. Towel the pan dry, then set it on a burner over low to medium heat until the surface stops steaming and no moisture remains. Allow it to cool before you store it, since a warm pan in a closed space can sweat once it cools.
Use a thin oil coat
For storage, a light coat of oil protects the metal from humid air. Wipe on a few drops of neutral oil, rub it in with a paper towel, and then wipe off the excess until the surface looks dry. Too much oil leaves a sticky film. A thin layer is enough.
Pick a dry spot
Avoid storage close to the sink, a dishwasher, or a stove that puts out steam. A basement or garage with damp walls is also a poor place. A cupboard or shelf in a normal room is better. If the room is humid, a dehumidifier does more than any storage trick.
Let the air move
Pans sealed in plastic, boxes, or tight cabinets hold moisture. Leave space around each pan so air can reach it. A wall rack or an open shelf works well. Paper or a breathable cloth is fine if you want to protect the surface from dust.
Check the pans now and then
Look at stored pans every few weeks, especially in humid months. Catch small spots of rust early, before they spread. If you see rust, you can scrub the spot and dry and oil the pan again. For bigger rust, read about how to remove rust from cast iron before you put the pan back.
What to do after the rust appears
Light surface rust is common on pans that sat for a while. Remove it with fine steel wool or a gentle scrub, wash, dry on the burner, and apply a thin oil coat. Once the surface is clean, the pan is ready to store again.