Smells in a shower drain, as well as in most other drains, can be caused by odor-causing bacteria that feed on debris in the pipe. Some of these anaerobic bacteria live in fetid water in the P-trap and produce hydrogen sulfide gas, which smells like sewage. Odors can also be caused by the debris itself -- for example, hair in a shower drain can collect soap, which in turn collects urine. Mold can also grow on the soap and give the drain a musty odor.
In the absence of a plumbing vent problem that is emptying the P-trap and allowing sewer gases to escape, you can get rid of the smell by cleaning and deodorizing the drain.
Cleaning a Shower Drain
Remove the Strainer
Most shower strainers are attached with a single Phillips screw. After removing the screw with a screwdriver, you may have to pry the strainer up -- do this with a flat-head screwdriver. If you don't see a screw, all you have to do is pry off the strainer.
Clean the Drain and Strainer
The first thing you'll notice after removing the strainer is a layer of hair and scum on the underside. Pull off the hair and clean the scum, using a sponge and warm, soapy water. If you look in the drain you'll see the same scum coating the drainpipe. Pull out as much hair as you can, using your fingers, an old toothbrush or a plastic drain cleaning tool with zippered teeth. Use a foam paint roller -- without the roller attachment -- to clean the pipe. Soak the roller in soapy water, insert it in the drain and rotate it. Rinse and clean again until the roller picks up no more scum.
Disinfect and Deodorize the Drain
You can disinfect the drain by pouring a 50-50 solution of household bleach and water into it, but the bleach will simply flow down the sides of drainpipe and may not kill all the odor-causing organisms. As an alternative, pour 1 cup of baking soda in the drain, followed by a a cup of vinegar. Cover the drain and let the mixture fizz inside the pipe for a few minutes, then flush with hot water.
Preventing Drain Odors
When it comes to shower odors, the main culprit is soap. You can't stop using soap in the shower, but you can prevent it from building up and becoming a problem by pouring boiling water into the drain once a week. If you forget, and you suspect that soap is building up, dissolve it with an enzyme-based drain cleaner.
Vent-Related Sewer Odors
If you detect a strong sewer smell from the shower, especially after flushing a toilet or using the washing machine, your plumbing vents may be blocked. When this happens, suction in the pipes from flowing water can empty the P-trap. Clearing debris from the roof vent usually solves this problem. If the blockage occurs in winter, the roof vent may be iced over. Go into the attic and point a hairdryer at the vent at the point where it exits the roof to melt the ice.