Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrates from the Prophet (peace and blessings be upon him) that he (peace and blessings be upon him) said: "The rider should greet the one walking, the one walking should greet the one sitting, and the few should greet the many."
(b) Sayyiduna Jabir (may Allah be pleased with him) says: When two people walking meet, whichever of them begins with the greeting is the better.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجزية / 18720