A hermit crab’s gills are enclosed in the branchial chamber, which functions as a lung. The branchial chamber is on the sides of the thorax, above the crab’s legs. A hermit crab breathes through its gills and branchial chamber, which must be kept moist in order to function. If the branchial chamber and gills dry out, the crab will die. Compared to aquatic crabs, land hermit crab’s gills are reduced in size, and if the adults are kept underwater too long, they will drown. 
There are tufts of setae at various sites on the ventral surface that enable moisture from the substrate to be passed to the branchial chamber. 
Maintaining the correct relative humidity inside the crabitat is crucial to survival. Without sufficiently humid air your hermit crabs will slowly suffocate and die. Once the gills are damaged from too dry air they can not repair themselves. When setting up your crabitat it is not necessary to leave an opening for ventilation or air exchange. Opening the lid daily to feed and perform other daily chores will provide sufficient air exchange.
Unless you live in a native climate and do not use any form of heat or air conditioning your crabitat will require a lid to maintain the correct humidity levels. Your house is likely 40-50% relative humidity.
A hermit crab requires 70-80% relative humidity. This range is for the purple pincer hermit crab (Coenobita clypeatus) native to Florida and the Caribbean. Other species of land hermit crabs enjoy a slightly higher relative humidity of 85%. You will need a solid lid for the crabitat (tank or aquarium) and a good quality hygrometer and thermometer to accurately measure the air inside of the crabitat.
All hygrometers should be calibrated prior to use.
Different ways to create humidity in your hermit crab habitat.
Humidity levels maintained above 85% are not harmful to the hermit crab directly but can lead to an unsafe environment in the crabitat. Floods, excessive surface mold and mildew, slime mold and bacterial blooms are just a few of the unsafe conditions that can develop from maintaining excess humidity levels. In this circumstance, you may need to slightly vent to keep your humidity in the ideal range.
Treat your hermit crabs in the same manner you would treat a fish and refrain from removing them from their humid environment unless absolutely necessary. A very brief photo from time to time is acceptable. Taking your hermit crab from the tank on a regular basis (for any purpose) is strongly discouraged.
1. Biology of the Land Crabs Warren W. Burggren and Brain R. McMahon
2. Hermit crabs : everything about anatomy, ecology, purchasing, feeding, housing, behavior, and illness Sue Fox