Well I hate to state the obvious, but the best way is to not leave it untouched for that long a time to begin with.
0000 steel wool and some oil will help remove surface rust from the outside, hope there isn't any in the bore, that can be tedious work to bring it back to being a good shooter.
I guess when I lived out west I kept a .22 mag behind the seat, in a cloth sock, but I was always checking that thing. Just to be sure the wife or kids didn't toss something onit and/or making sure it was still there! I'd go shoot tin cans with it every couple weeks to make sure the sights were still on. For me guns are a tool, and like any tool I want it clean and in good shape when I need it.
Now if it's an ole shotgun, like we keep a "barn gun" in these parts for stray critters an such, I wouldn't worry, I just put a drop or two of oil in the parts that need it every couple months, maybe drop the hammer every now and then to make sure the firing pin still works,,,,,,,Good luck.