Three typical dog personalities :
A dog that is happy to greet anyone is usually pretty easy to spot. As they see people they start to get loose and wiggly. There may even be some jumps mixed in. These are the behaviors that you want to look for if you really want to greet a dog. This dog would enjoy the interaction with you.
A nervous dog could be standing there quietly and may look “calm and good.” A nervous dog may also do the opposite and bark, lunge or growl when a strange person appears. Sometimes the nervousness to the naked eye could be hard to spot. That is why you want to look for the signs of the “happy dog” mentioned above. This dog would not enjoy interacting with you. If an interaction is forced then a bite could occur.
A dog that is frustrated would be doing a lot of barking and lunging when they see a strange person. The frustration is probably coming from a place of happiness. From an overall training standpoint you wouldn’t want to greet this dog because it could reinforce all of the lunging and barking. (If it is indeed coming from a social standpoint.) The dog would then learn that if it does those behaviors, it gains access to the thing it wants. It’s then going to lead to more and more of those behaviors.
Now that the three typical personalities have been listed you probably have a pretty good idea of which dogs would enjoy meeting you and which wouldn't. The ones that wouldn’t enjoy meeting you aren’t bad dogs, they’re just dogs. It’s extremely common for dogs to be weary of strangers.
Here’s what to do when greeting a happy dog
Since you now know what to look for when attempting to greet a strange dog we can now move onto how to do it.
The first thing you want to do is double check with the owner that his dog would enjoy meeting you. Once that is determined you’ll want to have them approach you. When the dog finally gets to you he is probably going to be excited which could lead to a bit of jumping and maybe even some licking. Scratch him under the chin or right above the tail. (I like to pet dogs where they can’t scratch themselves. This seems to be a big hit.) Keep an eye on his body language to see if anything changes. If his body language changes after you do something, avoid doing that thing again. (e.g. touching his leg makes him pull it away, getting close to his face makes him turn away.)
Notice that at no point did I mention sticking your hand out to be sniffed? That’s because it isn’t needed. Going through the three personality types, you’re only going to be greeting the ones that are obviously happy. Those happy dogs aren’t really concerned with how you smell.