To prevent such smells in a kitchen sink drain, try not to allow food to go down the drain at all, making sure that the sink plug fits properly and is emptied into the trash after each use. If food does go down the drain, be sure to flush well with water to propel any particles past the sink trap (U junction under the sink).
If you have a garbage disposal attached to your sink, be sure to run water with the disposal even after it appears the material is ground up, and continue to run the water for a minute after you turn off the disposal unit, to flush any remaining small particles.
Bathroom sink and tub drains smell because they have hair and soap residue suck in them. These build up over time, eventually leading to slow draining and complete clogs. To avoid this be sure there is a catch over the drain to block hairs from going down the drain and empty when there is any matter in it. Do not flush fallen hairs down the sink, but rather get in the habit of putting them in the trash, wiping them up with a tissue if needed.
If your drain already smells, try the easiest fixes first:
1. Run hot water through the drain to try to flush away any particles.
2. Pour some of vinegar (a very mild acid) down the drain to loosen soap scum and grease, as well as freshen. If this is a kitchen sink with a garbage disposal, try grinding up a lemon or orange (provides citric acid, and a more appealing smell.)
3. If drain is slow, try removing any clumps stuck in drain-- a straightened coat hanger works well for hair clogs.
4. Try more vinegar, this time with a small amount of baking soda. Warning: Use only enough baking soda to fizz slightly in the vinegar. Pouring too much can cause a large-scale reaction which can damage pipes. Remember those science fair volcanoes?
5. Use a chemical drain cleaner such as Drano or Liquid Plum. Follow package directions. Leaving the product in the pipes for long periods can corrode pipes, so try a shorter period of time first, and always be sure to thoroughly flush the pipes with hot water afterward. Do not mix these chemicals. Do not use bleach