The Messenger of Allah ﷺ said, "Beware of entering upon women."A man from the Ansar asked, "Messenger of Allah, what about the in-law?"He replied, "The in-law is death."
حدثنا قتيبة حدثنا الليث عن يزيد بن أبي حبيب عن أبي الخير
أن رسول الله ﷺ قال إياكم والدخول على النساء فقال رجل من الأنصار يا رسول الله أفرأيت الحمو قال الحمو الموت
Agreed upon (by Bukhari and Muslim). Bukhari narrated it in the Book of Marriage, chapter, "No man should be alone with a woman except one who is a mahram, and on entering upon a woman whose husband is away," no. 5232, and Muslim, no. 2172, from Qutayba, with the same wording.There are also narrations on this subject from Umar [to come, no. 2165], Jabir [to come, no. 2097, and Muslim, no. 2171], and Amr bin As [to come, no. 2779]. The hadith "No man should be alone with a woman" comes at no. 2165, and it is a sahih hadith.