Sahih Muslim Book 026, Hadith Number 5375.

Chapter : The duty that one owes on the roadside is to respond the greeting of as-Salam-u-'Alaikum.

Abu Talha reported: While We were sitting in front of the houses and talking amongst ourselves, Allah's Messenger (may peace be upon him) 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.