Flour, sugar, rice and pasta should be stored in tightly covered containers.
Store flour in an airtight container to prevent absorption or loss of moisture. Place large bags in a big covered container. In hot, humid weather, buy flour in small amounts and keep in the refrigerator or freezer. Flour stored in a warm place, is likely to become infested with insects. Keep whole wheat flour in the refrigerator or freezer the year around. Natural oils cause this flour to turn rancid quickly at room temperature. Flour absorbs odors. Do not store near soap powders, medicines of other items with strong odors.
White and brown sugar should be stored in air tight containers. Store sugar in a cool, dark cabinet, about 70 degrees F.
The suggested shelf life for sugar is:
Rice (uncooked) can be stored in an air tight container at room temperature for up to a year. Brown or flavored rice should be used within 6 months.
Pasta stored in a cool, dry place in its uncooked form will last indefinitely. Suggested storage time for spaghetti, macaroni and etc. is 1 to 2 years. Egg noodles should be used within 6 months.
Source: Cupboard Approximate Storage Times, Kansas State University