Hadithcore
Riyad as-Salihin, 856

Abu Juraiy Al-Hujaimi (May Allah be pleased with him) reported:

I saw the Messenger of Allah (ﷺ) and said: "Alaikas-Salamu ya Rasulallah! (Upon you be peace, O Messenger of Allah)!" He said, "Do not say: 'Alaikas-Salamu (Upon you be peace).' This is the Salam to the dead." <b>[Abu Dawud and At-Tirmidhi, who classified the hadith as Hasan Sahih]</b>.

وعن أبي جري الهجيمي رضي الله عنه قال‏:‏ أتيت رسول الله صلى الله عليه وسلم فقلت‏:‏ عليك السلام يا رسول الله قال‏:‏ ‏

‏لا تقل عليك السلام؛ فإن عليك السلام تحية الموتى‏

‏‏.‏ ‏(‏‏(‏رواه أبو داود، والترمذي وقال‏:‏ حديث حسن صحيح‏.‏ وقد سبق بطوله‏)‏‏)‏‏.‏

References1 variant
In-Book Reference
Book 5, Hadith 13
Sharh · explanationclick to expand
<b>Guidance from the Hadith:</b><br> 1) It urges us to teach the ignorant what they do not know about and alert the person who uses the wrong wording to the correct wording prescribed in the Shariah.<br> 2) It shows the manner of saying the greeting to the dead in their graves; it is: “‘Alayka as-salām” (Upon you be peace). This is addressed to someone who is absent yet near. However, the Sunnah also indicates that it is permissible to greet the dead with the words “Salāmun ‘alaykum ahl ad-diyār” (Peace be upon you, O inhabitants of the dwellings). So, the greeting is the same to the living and the dead.