And Ibn Abī Shaybah also relates, through another chain, from Abū Qatādah:
“Give the mosques their due!”
He was asked, “What is their due?” He answered, “Two units of prayer (rak‘ahs) before you sit down.”
I add: al-Khaṭīb likewise recorded it, through ʿAbd Allāh ibn Abī Qatādah from his father, traced back to the Prophet, with the wording:
“When you enter the mosque, greet it with two rak‘ahs before the imam arrives.”
Its chain is weak, for it contains several unknown narrators.
A supporting report exists from Abū Hurayrah, raised to the Prophet, identical to the version of ʿAbd Allāh ibn Saʿīd. Ibn Mājah transmitted it by way of Kathīr ibn Zayd, from al-Muṭṭalib ibn ʿAbd Allāh, from him. Al-Zawāʾid comments: “Its transmitters are reliable, but the link is broken; Abū Ḥātim said, ‘Al-Muṭṭalib ibn ʿAbd Allāh’s narration from Abū Hurayrah is mursal (missing the Companion).’ ”
Taken at face value, the ḥadith indicates that performing two rak‘ahs as a salutation to the mosque is obligatory: the first wording contains a command, and a command denotes obligation, while the second forbids sitting before the prayer, and a prohibition signifies unlawfulness. The literalists (Ẓāhiriyyah) held to this view—except for Ibn Ḥazm, who clearly states in al-Muḥallā that it is sunnah—and this is the position of the majority. They answer that the command here is merely recommendatory, adducing proofs that do not substantiate their claim. The scholar al-Shawkānī has gathered those proofs and then refuted them, showing that they are insufficient to shift the command from obligation to recommendation, such as, for example, the Prophet’s ﷺ statement to the man he saw stepping over people’s necks: