Anal glands are small sacs located on either side of a dog's anus. They produce a smelly liquid that helps with scent marking. When the anal glands become impacted or infected, they can cause discomfort and prompt a dog to scoot its rear end.