كتاب السلام
39  
The Book of Greetings
(2)
Chapter: One Of The Duties Of Sitting In The Street Is To Return Salam
(2)
باب مِنْ حَقِّ الْجُلُوسِ عَلَى الطَّرِيقِ رَدُّ السَّلاَمِ ‏‏
Sahih Muslim 2161

Abu Talha reported:

While we were sitting in front of the houses and talking amongst ourselves, Allah's Messenger (ﷺ) happened to come there. He stood by us and said: What about you and your meetings on the paths? Avoid these meetings on the paths. We said: We were sitting here without (any intention of doing harm to the passers-by) ; we are sitting to discuss matters and to hold conversation amongst ourselves. Thereupon he said: If there is no help (for you but to sit on these paths), then give the paths their rights and these are lowering of the gaze, exchanging of greetings and good conversation.
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا عَفَّانُ، حَدَّثَنَا عَبْدُ الْوَاحِدِ بْنُ زِيَادٍ، حَدَّثَنَا عُثْمَانُ بْنُ حَكِيمٍ، عَنْ إِسْحَاقَ بْنِ عَبْدِ اللَّهِ بْنِ أَبِي طَلْحَةَ، عَنْ أَبِيهِ، قَالَ قَالَ أَبُو طَلْحَةَ كُنَّا قُعُودًا بِالأَفْنِيَةِ نَتَحَدَّثُ فَجَاءَ رَسُولُ اللَّهِ صلى الله عليه وسلم فَقَامَ عَلَيْنَا فَقَالَ ‏"‏ مَا لَكُمْ وَلِمَجَالِسِ الصُّعُدَاتِ اجْتَنِبُوا مَجَالِسَ الصُّعُدَاتِ ‏"‏ ‏.‏ فَقُلْنَا إِنَّمَا قَعَدْنَا لِغَيْرِ مَا بَاسٍ قَعَدْنَا نَتَذَاكَرُ وَنَتَحَدَّثُ ‏.‏ قَالَ ‏"‏ إِمَّا لاَ فَأَدُّوا حَقَّهَا غَضُّ الْبَصَرِ وَرَدُّ السَّلاَمِ وَحُسْنُ الْكَلاَمِ ‏"‏ ‏.‏
Reference : Sahih Muslim 2161
In-book reference : Book 39, Hadith 2
USC-MSA web (English) reference : Book 26, Hadith 5375
  (deprecated numbering scheme)