His saying: {Ask permission and greet their inhabitants} means: until you seek permission; according to the interpretation of Qatadah. There is a transposition (taqdim wa ta'khir) in the verse: until you greet [and ask permission].
قَوْلُهُ: ﴿تَسْتَأْنِسُوا وَتُسَلِّمُوا عَلَى أَهْلِهَا﴾ حَتَّى تستأذنوا؛ تَفْسِيرِ قَتَادَةَ. وَفِيهَا تَقْدِيمٌ وَتَأْخِيرٌ: حَتَّى تُسَلِّمُوا [وَتَسْتَأْنِسُوا].