Well....depends. How long? Where?
I keep my guns in the basement gun room witt a dehumidifier running.
I've used several products in the past with very good results.
The BEST for long term storage is LPS-3, a superior metal PROTECTANT. It is not a lubricant, so I wouldn't drown the innerds of a gun with it. It's o.k. to do that, but be aware you should clean the LPS-3 out then oil the mechanism with a good lubricant, like...LPS-2. Great stuff. There are many very good lubes, but darned few metal PROTECTANTS that are as good as LPS-3.
I've had great results storing black powder arms between hunting seasons in Bore Butter. But then I clean the fouling out really well before storage, making sure all the moisture is gone and the gun completely dry before applying any protectant.
How do I clean the protectant so I can shoot the thing.
Couple ways. One, use 91% drug stoe alcohol, or break parts cleaner. Both work well. Be carefull not to soak wood with break parts cleaner. I've never had a problem with the finish comming off, but I suppose too much of it could damage some finishes.