Full Sharh — Al-Adab Al-Mufrad 1059
حَدَّثَنَا إِسْحَاقُ، قَالَ: حَدَّثَنَا عَلِيُّ بْنُ الْحُسَيْنِ قَالَ: حَدَّثَنِي أَبِي، عَنْ يَزِيدَ النَّحْوِيِّ، عَنْ عِكْرِمَةَ، عَنِ ابْنِ عَبَّاسٍ قَالَ: {لاَ تَدْخُلُوا بُيُوتًا غَيْرَ بُيُوتِكُمْ حَتَّى تَسْتَأْنِسُوا وَتُسَلِّمُوا عَلَى أَهْلِهَا}، وَاسْتَثْنَى مِنْ ذَلِكَ، فَقَالَ: {لَيْسَ عَلَيْكُمْ جُنَاحٌ أَنْ تَدْخُلُوا بُيُوتًا غَيْرَ مَسْكُونَةٍ فِيهَا مَتَاعٌ لَكُمْ وَاللهُ يَعْلَمُ مَا تُبْدُونَ وَمَا تَكْتُمُونَ}.
English Translation
Ibn 'Abbas said, "The verse, 'Do not enter houses other than your own until you have asked permission and greeted their inhabitants' (24:27) has an exception made to it when Allah says, 'There is nothing wrong in your entering houses where no one lives where there is some service for you. Allah knows what you divulge and what you conceal.'"
Source
Al-Adab Al-Mufrad(الأدب المفرد)
Asking Permission
Hadith Number
1059