Answered by Shaykh Amjad Rasheed
What is the ruling of rubbing one’s hand against a grave?
The later Shafii scholars disagree about rubbing the graves and kissing them:
According to Ibn Hajar in al-Tuhfa, the relied-upon position is that it is offensive out of respect for the dead.
Imam as-Shams ar-Ramli [f: the other leading authority for fatwa in the Shafii school], however, follows the opinion of his father, Imam as-Shihab Ahmad ar-Ramli, who states that it is not offensive to kiss or rub graves if the intention is to obtain blessings (barakah) through the righteous and the saints. He states in an-Nihayah, “[S]cholars explicitly stated that if one fails to kiss or touch the black stone, it is recommended to kiss a stick and then point it towards the black stone. They also said, “It is well for one to kiss any part of the House [of God]” “.
The Imam and Hadith master, al-Jalal As-Suyuti, mentioned in his al-Tawsheeh ala al-Jami as-Sagheer that some learned gnostics concluded from kissing the black stone that it is permissible to kiss the graves of the righteous.”
– Amjad Rasheed
(Translated by Sidi Abu Muhammad Rahil)