Abu Dharr reported,

The Messenger of Allah ﷺ said, "Whoever lifts a curtain and lets his gaze enter a house before being granted permission, and thereby sees the private parts of its people, has committed a transgression that was not lawful for him to commit. If, the moment he cast his gaze inside, a man had confronted him and gouged out his eyes, I would not blame him for it. But if a man passes by a door that has no curtain and is not shut, and he looks inside, there is no sin upon him. The sin lies upon the people of the house."

Tirmidhi 2707

Daif

حدثنا قتيبة حدثنا ابن لهيعة عن عبيد الله بن أبي جعفر عن أبي عبد الرحمن الحبلي

عن أبي ذر قال

قال رسول الله ﷺ من كشف سترا فأدخل بصره في البيت قبل أن يؤذن له فرأى عورة أهله فقد أتى حدا لا يحل له أن يأتيه لو أنه حين أدخل بصره استقبله رجل ففقأ عينيه ما عيرت عليه وإن مر الرجل على باب لا ستر له غير مغلق فنظر فلا خطيئة عليه إنما الخطيئة على أهل البيت

الترمذي 2707ضعيف
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Permission and etiquette
Chapter
Seeking permission while facing the house
Numbering
Darussalam 2707
Tirmidhi 2707