This definitely seems to be an issue specifically with smaller dogs. There are a lot of things that could be triggering the barking. Does he only bark when you are with him? If so- how do you react to him barking?
How does he react if the person he's barking at approaches him? Does he only bark if he's at your house/ somewhere he's familiar with- or will he bark at strangers in any location?
A good thing to keep in mind is that you want to reassure your dog that they are safe- and the strangers will not hurt them. But you also don't want to reward them for the aggressive behavior. Don't offer your dog any kind of actual 'reward' for barking (no snacks, don't give them a toy, don't coddle them). Rather, talk to them gently and reassuringly. Have the person they are barking at slowly approach the dor and allow the dog to smell their hand before they attempt to pet them. Once your dog has quit barking and is okay with the person being present THEN reward them with a treat- showing them that by accepting the stranger (rather than barking at them) they will be rewarded.
How does he react if the person he's barking at approaches him? Does he only bark if he's at your house/ somewhere he's familiar with- or will he bark at strangers in any location?
A good thing to keep in mind is that you want to reassure your dog that they are safe- and the strangers will not hurt them. But you also don't want to reward them for the aggressive behavior. Don't offer your dog any kind of actual 'reward' for barking (no snacks, don't give them a toy, don't coddle them). Rather, talk to them gently and reassuringly. Have the person they are barking at slowly approach the dor and allow the dog to smell their hand before they attempt to pet them. Once your dog has quit barking and is okay with the person being present THEN reward them with a treat- showing them that by accepting the stranger (rather than barking at them) they will be rewarded.