This excerpt is taken from the book of Sheikh al-Islam Imam Ibn Taymiyyah, may Allah have mercy on him, Al-Jawab al-Bahir fi Zuwar al-Maqabir, translated by Sheikh Ataullah Saqib.
Salam for the General Muslims
When it was established that Allah has commanded every believer to greet others with Salaam, then whoever forbids this and holds the belief that salutations and blessings should be sent only upon the Messenger of Allah and no one else, as is the doctrine of Abu Muhammad al-Juwayni and others, this was not a known view among the early scholars. Rather, most of the later scholars have also refuted it. Because, besides the Messenger of Allah, ordinary believers are commanded to greet one another with Salaam.
Is it obligatory or strongly recommended for ordinary believers to greet each other with Salaam? There are two opinions on this, and both are correct according to the school of Imam Ahmad. However, it is unanimously agreed that responding to Salaam is obligatory. It is sufficient if everyone responds or if just one person responds. When a Muslim finishes the prayer, he should say السلام عليكم السلام عليكم.
The Noble Prophet Muhammad (peace be upon him) used to teach the following supplication to the Companions (may Allah be pleased with them) when visiting graves:
السَّلَامُ عَلَيْكُمْ أَهْلَ الدِّيَارِ مِنَ الْمُؤْمِنِينَ وَالْمُسْلِمِينَ
"O believing and Muslim people of the abode! May Allah's mercy be upon you."
Reference: (Sahih Muslim, Book of Funerals: Chapter on what is said upon entering graves, Hadith: 974)
Sending Salam and Salawat from a Distance is Exclusive to the Messenger of Allah
The scholars who say that Salam is a special right of the Messenger of Allah do not prevent saying Salam to a person who is present and available. However, they also say that Salam cannot be said to someone who is absent; sending Salam from a distance is exclusive only to the Messenger of Allah. This position of theirs is weak. This is because the ruling and obligation of this is exclusive to the Messenger of Allah, such as in Tashahhud. In Tashahhud, Salam is not said to any specific or particular person except you (the Prophet). The same applies to saying Salam when entering and leaving the mosque. This supports the fact that Salam is like Salawat, and both are obligatory in prayer and outside of prayer. However, except for the Messenger of Allah, it is unanimously obligatory to say Salam as a greeting to ordinary people upon meeting.
Five Rights of a Muslim over Another Muslim
Is greeting (Salam) obligatory or recommended? Two opinions are narrated from Imam Ahmad on this. In the light of evidence and texts, it will be considered obligatory. Our sect is also supported by this narration from Sahih Muslim in which the Mercy to the Worlds said:
خمس تجب للمسلم على المسلم
"A Muslim has five rights over another Muslim:
يسلم عليه إذا لقيه
When you meet him, greet him with Salam.
ويعوده إذا مرض
When he falls ill, visit him.
ويشيعه إذا مات
When he dies, attend his funeral.
ويجيبه إذا دعاه
When he invites you, accept the invitation.
ويشمته إذا عطس
When he sneezes, respond to him."
Reference: (Sahih Bukhari, Book of Funerals: Chapter on Following Funerals, Hadith: 1240; Sahih Muslim, Book of Salam, Chapter on the Right of a Muslim over a Muslim to Return Salam, Hadith: 2162)
Most jurists have declared accepting an invitation obligatory, and the funeral prayer is unanimously considered a communal obligation (Fard Kifayah). Saying Salam at the time of meeting and visiting the sick is more important than accepting an invitation. Because the harms of not saying Salam at the time of meeting and not visiting the sick are more serious than the harms of not accepting an invitation. Saying Salam is easier than accepting an invitation and visiting the sick. There is no opportunity here for further explanation of these issues.
Greeting during meeting in life and visitation at the grave is the right of a Muslim
The conclusion of our discussion is that saying salam during meeting in life and when visiting the grave after death is the right of every Muslim over another.
In the light of the above hadith, the Companions (may Allah be pleased with them) knew that there is no special privilege for you in greeting at the honored grave. Rather, it is necessary for the right of every Muslim, whether alive or dead. Because every believer responds to salam.
Here, the response to salam is not the primary intention, but the command is that whenever one believer meets another, he should say salam, and when he goes to the grave of a believer, he should say salam. It is not appropriate to undertake a distant journey merely out of obligation.