Sahih Muslim , Book 39, Hadith 18 (In-Book)

Anas b. Malik reported that when Allah's Messenger happened to pass by young boys he would great them.

حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، أَخْبَرَنَا هُشَيْمٌ، عَنْ سَيَّارٍ، عَنْ ثَابِتٍ الْبُنَانِيِّ، عَنْ أَنَسِ، بْنِ مَالِكٍ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم مَرَّ عَلَى غِلْمَانٍ فَسَلَّمَ عَلَيْهِمْ ‏.‏

sunnah.com