An untrained dog may protect his owner, but protection is more of an instinct than a learned behavior. If the owner is nice to the dog and provides him with the things he needs, most dogs will feel a need to protect their owner. Even young dogs, or dogs that do not know any commands may bark at a stranger if they come too close.
Some dogs may even put themselves at risk to protect their owners. This is not something you can train a dog to do.