The Prophet (peace be upon him) has advised us to exchange Salam (Islamic greeting of peace).
However, I read a Hadith that tells us not to greet the Jews of the Muslim Ummah (nation based on one creed). When the Messenger of Allah (peace be upon him) was asked who they were, he replied, "They are those who hear the Adhan (call to Prayer) but do not go to offer Salah (Prayer)." If I pass by a group of people while going to the Masjid (mosque) and I know they are not going to offer Salah, what should I do?
The above-mentioned Hadith has no origin. If you pass by a group of people while you are on your way to the Masjid, you should advise them and warn them of the consequences of neglecting Salah, so that they are urged to offer Salah in congregation. If they still do not offer Salah, you should report them to the officials, so that you are discharged of any responsibility. You should continue greeting them until you are certain that they insist on neglecting the congregational Salah. In this case, you should desert them and stop greeting them.May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.