Sahl bin Saad reported,

He informed him that a man peered through a hole in the door of the Messenger of Allah ﷺ, while the Messenger of Allah ﷺ had a comb with which he was scratching his head. When the Messenger of Allah ﷺ saw him, he said, "If I had known you were watching me, I would have stabbed your eyes with it."The Messenger of Allah ﷺ said, "Permission to enter was prescribed only because of the gaze."

Bukhari 6901

Sahih

حدثنا قتيبة بن سعيد حدثنا ليث عن ابن شهاب أن

سهل بن سعد الساعدي

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

البخاري 6901صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Blood money
Chapter
Whoever peeks into the house of a people and they gouge out his eye, there is no blood money for him
Numbering
Darussalam 6901
Bukhari 6901