Question: It is customary among members of our congregation that when they arrive at the synagogue on Shabbat morning before beginning to pray, they make their rounds and shake their friends’ hands while wishing them a “Shabbat Shalom.” Is there anything wrong with this custom?
Answer: The Gemara (Berachot 14a) states: “Rav said: Anyone who greets one’s friend by saying ‘Shalom’ before praying is tantamount to having made him into a forbidden alter.” This is because by greeting one’s friend before praying, one is prioritizing one’s friend’s honor over that of Hashem. The Gemara discusses various details regarding this law, among them that this is primarily forbidden when one specifically goes to one’s home to greet him, as opposed to just a chance encounter.
Halachically speaking, Maran Ha’Shulchan Aruch (Chapter 89, Section 2) rules that it is forbidden for one to specifically go to one’s friend’s home before praying Shacharit to greet him using the word “Shalom,” especially since “Shalom” is also Hashem’s name and it is inappropriate to use this word to greet anyone before praying to Hashem.
If one needs to go to someone else’s home in the morning before praying for some reason (such as, to check on a business venture), one may greet this friend by saying “Good Morning” (but not “Shalom”). However, if one goes there specifically to greet the friend, even saying “Good Morning” is forbidden. If the encounter was completely by chance, such as, by meeting on the street, one may say “Good Morning” to one’s friend and, according to the letter of the law, there is even room to permit saying “Shalom.”
Regarding the above question about one who arrives at the synagogue and goes around to people specifically to greet them by saying “Shalom” or “Shabbat Shalom,” the Peri Megadim rules that this kind of encounter is considered deliberate, not chance, and therefore, doing so and wishing people “Shabbat Shalom” in the process is forbidden. The Mishnah Berura, Kaf Ha’Chaim, and the great Rishon Le’Zion, Hagaon Rabbeinu David Yosef Shlit”a in his Halacha Berura, all concur.
Summary: One may not deliberately visit another before praying in order to greet them by saying “Shalom” or “Shabbat Shalom.” Similarly, one may not specifically go to people in the synagogue in order to wish them “Shalom” before praying. After praying, however, the prevalent custom is that all congregants wish one another “Shabbat Shalom.”