The Prophet ﷺ said, "Beware of sitting on the roadsides."The companions replied, "We have no alternative. These are our gathering places where we converse."He said, "If you must sit there, then give the road its due."They asked, "What is the due of the road?"He answered, "Lowering the gaze, refraining from causing harm, returning the greeting of peace, enjoining what is right, and forbidding what is wrong."
عن النبي ﷺ قال: إياكم والجلوس على الطرقات. فقالوا: ما لنا بد، إنما هي مجالسنا نتحدث فيها. قال: فإذا أبيتم إلا المجالس، فأعطوا الطريق حقها. قالوا: وما حق الطريق؟ قال: غض البصر، وكف الأذى، ورد السلام، وأمر بالمعروف ونهي عن المنكر.
Bukhari narrated it in the Book of Injustices (2465), and Muslim in the Book of Clothing (2121), both through Abu Umar Hafs bin Maysara, from Zayd bin Aslam, from Ata bin Yasar, from Abu Saeed Khudri, who related it. The wording given here is Bukhari's, and Muslim's wording is similar.