+1 on the thing about brown rice. Great-tasting for normal times, but the oil goes rancid quickly unless stored in the freezer.
I put my bags of white rice in the freezer for a couple of weeks, to kill anything that might have gotten into them. After defrosting, I store them in snaplid 5-gal buckets with dessicant. The longest I've kept any is two years. No problems.
Bulk beans should be stored in an inert atmosphere for best results. I buy them in 10 & 25 pound bags. Put a fist-sized chunk of dry ice in the bottom of a snap-lid 5-gal bucket. Dump the beans loose on top of the dry ice (fill the bucket) and put the lid on loose for a couple of minutes to let some of the ice sublimate and drive the air out. Then seal the lid. One source I use says they will keep for "several years" that way.
To keep smaller bags of beans for regular use, I freeze them the same way I do the rice and store them in the bags they come in, in snaplid buckets. They've kept for a year so far. We use them pretty fast. I've also sealed them in vacuum-seal bags (the heat-seal kind) and that has kept them for a year so far, as well. Still experimenting.