All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
One of the conducts that the Muslim is supposed to do when he enters a graveyard is to greet the dead Muslims that are there. The Prophet came to a graveyard and said: “Assalaamu ‘Alaykum (peace be upon) O inhabitants of the city among the believers and Muslims, and Allah willing, we shall join you. We ask Allah for well-being for us and for you.”
For more benefit on greeting the dead when passing by a graveyard, please refer to Fataawa 398383 and 306583.
Allah knows best.