Being alone and closing the door: [1]
Two people are not to enter into the bathroom together [as doing so is not modest[2]].[3] Rather one should enter the bathroom alone and close [and lock[4]] the door to the bathroom [in order so no one enter it[5]].[6] This applies even at night.[7] [This applies even between husband and wife.[8]]
[1] Kama 3:2; Basra 3:2
[2] Kama 3:2
[3] Admur Kama 3:2; Basra 3:2; Rama 3:2; Or Zarua 1:137
[4] Implication of Admur Basra ibid; Implication of Mishneh Tamid 1:1, Brachos 62b, Tamid 27b; Chesed Lealafim 3:5 “One should close the door behind him due to modesty and he should make a lock behind it in order so a person does not suddenly enter and open the door, which would be embarrassing.”; Yifei Talmud on Tamid ibid; Daas Nota p. 88; Piskeiy Teshuvos 3:4
Opinion of Admur: It is implied from the wording of the Alter Rebbe in his Mahadura Basra, in which he states that the reason for closing the door is so no one else enter, that this closing of the door includes also locking the door as otherwise this would not prevent someone from suddenly entering. This is further implied from the continued ruling there of the Alter Rebbe in his Basra, that even “if one cannot close the door behind him and another person wants to enter they should grunt at each other.” Now, if the intent of the word close is to simply close it without locking it, then if one cannot close the door why would there be a need for them to grunt at each other so they be aware of their presence, wouldn’t the person who is arriving see with his own eyes that someone is using the bathroom. On the other hand, if close means to also lock the door, then the scenario makes perfect sense, as if the person attempts to open the closed door that cannot be locked, then one should grunt at him in order so he doesn’t open it. This is in contrast to the simple wording in the Rama and Mahadurah Kama of the Alter Rebbe in which he writes that the reason for closing the door is simply due to modesty, and therefore can be interpreted that its purpose is not to prevent people from entering but simply so he does not use the bathroom in view of others. Perhaps this then is a difference between the wording of the Alter Rebbe in his first and second version, as according to the first version there is no need to lock the door while according to the second version one must lock the door. Vetzaruch Iyun.
[5] Basra 3:2; Kama 3:2 writes “due to modesty”.
[6] Admur Kama 3:2“and one shall close the door behind him due to modesty”; Basra 3:2 “and one shall close the door behind him in order so no other person enter there… And therefore if you cannot close the door and another person wants to enter he should grunt at him”; Rama 3:2 “and one shall close the door behind him due to modesty”; Darkei Moshe 3:1; Or Zarua 1:137;
[7] Basra 3:4; Kama 3:18; Ben Ish Chaiy Vayeitzei 4
[8] P”M 3 A”A 1; Brachos 62a