Sunan Abi Dawud, Book 43, Hadith 426 (Abu Dawud 5200)

Abu Hurairah reported the Messenger of Allah (May peace be upon him) as saying :

The young should salute the old, the one who is passing by should salute the one who is sitting, and a small company should salute a large one.