The Messenger of Allah ﷺ said, "The rider greets the one walking," and he then mentioned the rest of the hadith.
حدثنا يحيى بن حبيب بن عربي أخبرنا روح حدثنا ابن جريج قال أخبرني زياد أن ثابتا مولى عبد الرحمن بن زيد أخبره أنه سمع
قال رسول الله ﷺ يسلم الراكب على الماشي ثم ذكر الحديث
No references are available.
Bukhari narrated it in Isti'dhan, chapter "The Walking Person Greets the Sitting Person," hadith no. 6233, and Muslim narrated it in Salam, chapter "The Rider Greets the Walking Person and the Few Greet the Many," hadith no. 2160, from the hadith of Rawh bin Ubada, with the same wording.