عنْ أَبي قتادةَ رَضِيَ اللّهُ عَنْهُ قَالَ: قَالَ رَسُولُ اللّهِ صَلَّى اللّهُ عَلَيْهِ وَسَلَّمَ: «إذَا دَخَلَ أحَدُكُمُ الْمَسْجِدَ فَلاَ يَجْلِسْ حَتَّى يُصَلِّيَ رَكْعَتَيْنِ» مُتَّفَقٌ عَلَيْهِ.
Abu Qatadah (may Allah be pleased with him) reported that the Messenger of Allah (peace and blessings be upon him) said: "When one of you enters the mosque, let him not sit down until he has prayed two rak'ahs." Agreed upon (al-Bukhari and Muslim).
الدروس · lessons
النهي النبويّ الصريح عن جلوس الداخل إلى المسجد إلّا بعد صلاة. أنّ تحية المسجد ليست سنّة مستقلة بل أي صلاة يصليها الإنسان عند دخول المسجد فريضة أو سنة تعتبر تحية له.
The explicit prophetic prohibition against one who enters the mosque sitting down before praying. The greeting of the mosque (tahiyyat al-masjid) is not an independent sunnah; rather, any prayer a person performs upon entering the mosque — whether obligatory or voluntary — counts as its greeting.