From the Etiquette of Salam:- The one who comes greets the Muslims that are present. The one who is riding greets the one who is walking. The one who is walking greets the one who is sitting. The smaller group greets the bigger group. The young greet the elder. Imams Bukhari and Muslim reported that the prophet Muhammad (S.A.W.) said, "A rider should greet a pedestrian, a pedestrian should greet one who is sitting, and a small party should greet a large party, a younger should greet an elder one."