My dog is scared of everyone except me. He used to stay on a farm where some people always teased him. Now he is scared of everyone except me because he knows me.
What can I do for him?
You work on it slowly. Trust is a difficult thing. Take him out, slowly get him socialised to a few people, and more and more. Deal with how he manifests the fear - talking to a dog calmly and quietly works wonders.
You'll also have to use what motivates him to open up. Once he realises that people have food/will play with him/will pet him, he'll start getting used to it. Start with your family (and let them know there will be concequences if they tease or otherwise mess with the dog), and then slowly increase his circle of people. Take it slow, be patient, and use lots of positive reinforcement, and you'll be on your way.
That said, some dogs are just not people dogs. Even if your dog isn't the center of attention, and ignores people, its better than fear ;).
I dealt with similar problem after I adopted my pup. The good news is that it gets better. Here's what worked for me:
Start with gradual desensitization: Unfamiliarity is often the source of fear. Start by by gradually exposing your dog to other people by providing positive associations with it. Give your dog high-value treats while slowly introducing other people from afar and slowly increase exposure. Digestion triggers the parasympathetic nervous system which is associated with a relaxed state. Note: If your dog shows signs of anxiety, slow down! You are going too fast.
Exercise helps: Another way to reduce fear and anxiety in dogs is to get physical. It will release "feel good" hormones and reduce extra energy that may be contributing to your dog’s anxiety. Commit to just 20 to 30 minutes a day, and your dog will thank you.
Medication may be a good temporary option: This should only be considered after you have exhausted your options. It's controversial, but it made a big difference for my dog. Your vet can recommend prescription drugs which can help calm the dog down. Temporarily pairing medication with desensitization training helped me get my dog over her least favorite encounters.
Fast forward to today, my dog doesn't need medication or treats and is not anxious around others. It's a lot of work and requires patience, but it's worth it. Good luck!