How to Store Nuts
Rancidity, moisture and the right jar.
What ruins nuts is not mould but RANCIDITY. The oil inside oxidises as it meets air; the flavour first turns flat, then takes on a sharpness close to paint.
There are three enemies: AIR, HEAT and LIGHT. All three meet in an open bowl on a kitchen counter. Resealing the pack you opened, and putting only one evening's worth into the serving bowl, is the cheapest fix there is.
The choice of jar matters. Glass neither takes on smells nor passes them along; plastic containers hold the smell of old oil over time. Filling the jar to the top helps too: the less air left inside, the slower the oxidation.
The fridge and the freezer really do extend things. Raw nuts keep six months in the fridge and a year in the freezer. One rule only: after taking them out, let them come to room temperature BEFORE opening the container, otherwise moisture condenses on the surface and starts exactly what you were avoiding.
Finally, roasted and raw do not share a shelf life. Roasting brings the oil to the surface; a roasted product lasts a month while a raw one lasts for many. So if you are buying a lot, buy raw and roast small amounts as you go.