I’ve easily gotten more than months, by vaccuum packing my dehydrated stuff in canning jars and adding an oxygen absorber to the jar. Should easily be good for two to three years. True rice and beans are more nutritional value, longer storage life and so on, but pretty bland by themselves, throw in a cup of mixed dehydrated vetables in your rice, dried peppers in your red beans or dried onion in your white beans, or a can of spam fried up with some dehydrated onion and potatoes and you got a much more palatable dish.
Being able to raise rabbits or chickens would help too.