Narrated Abu Dharr:
that the Messenger of Allah (ﷺ) said: Whoever lifts the curtain so that his sight enters the house before he was given permission, and he seeks the nakedness of its inhabitants, then he has done something punishable which was not lawful for him to do. If it were that when he gazed into it, he was facing a man who lanced his eyes, there would be nothing wrong with him doing so. But if a man passes by a door that has no cover over it, and it is not closed and he looks, then there is no sin on him, the sin is only on the inhabitants of the house.