The Shulchan Aruch · Orach Chayim
אורח חיים ג׳Orach Chayim 3
Siman 3 of 697 in Orach Chayim — 17 se'ifim
הלכות הנהגת האדם בבוקרLaws Upon Awakening in the Morning· siman 3
Se’if 1א׳
כְּשֶׁיִּכָּנֵס לְבֵית הַכִּסֵא יֹאמְרוּ הִתְכַּבְּדוּ מְכֻבָּדִים וְכו'. וְעַכְשָׁו לֹא נָהֲגוּ לְאָמְרוֹ.
How to Conduct Oneself in the Bathroom. Containing 17 Se'ifim: When one enters the bathroom, he should say "התכבדו מכובדים..." ("Be honored, honorable ones") (Berachot 60b). But nowadays, we are not accustomed to recite it.
Se’if 2ב׳
יְהֵא צָנוּעַ בְּבֵית הַכִּסֵא וְלֹא יְגַלֶּה עַצְמוֹ עַד שֶׁיֵּשֵׁב: הַגָּה: וְלֹא יֵלְכוּ שְׁנֵי אֲנָשִׁים בְּיַחַד, גַּם לֹא יְדַבֵּר שָׁם, וְיִסְגֹּר הַדֶּלֶת בַּעֲדוֹ מִשּׁוּם צְנִיעוּת. (אוֹר זָרוּעַ).
One should be modest in the bathroom stall, and not reveal oneself until sitting. And two men shall not go together. Also, one shouldn't talk there, and should lock the door for himself for the sake of modesty (Ohr Zarua).
Se’if 3ג׳
אִם רוֹצֶה לְמַשְׁמֵשׁ בְּפִי הַטַּבַּעַת בִּצְרוֹר אוֹ בְּקֵיסָם לִפְתֹּחַ נְקָבָיו, יְמַשְׁמֵשׁ קֹדֶם שֶׁיֵּשֵׁב וְלֹא יְמַשְׁמֵשׁ אַחַר שֶׁיֵּשֵׁב, מִפְּנֵי שֶׁקָּשֶׁה לִכְשָׁפִים.
If one wishes to work about the anus with a pebble or a chip of wood in order to open up his rectum [i.e. he has trouble relieving himself], he should work about it before he sits but should not work about it after he sits, because [this exposes him to the] danger of witchcraft.
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0