Halacha

הלכה א
אָסוּר לְהִתְיַחֵד עִם עֶרְוָה מִן הָעֲרָיוֹת בֵּין זְקֵנָה בֵּין יַלְדָּה שֶׁדָּבָר זֶה גּוֹרֵם לְגַלּוֹת עֶרְוָה. חוּץ מֵהָאֵם עִם בְּנָהּ וְהָאָב עִם בִּתּוֹ וְהַבַּעַל עִם אִשְׁתּוֹ נִדָּה. וְחָתָן שֶׁפֵּרְסָה אִשְׁתּוֹ נִדָּה קֹדֶם שֶׁיִּבְעל אָסוּר לְהִתְיַחֵד עִמָּהּ אֶלָּא הִיא יְשֵׁנָה בֵּין הַנָּשִׁים וְהוּא יָשֵׁן בֵּין הָאֲנָשִׁים. וְאִם בָּא עָלֶיהָ בִּיאָה רִאשׁוֹנָה וְאַחַר כָּךְ נִטְמֵאת מֻתָּר לְהִתְיַחֵד עִמָּהּ:
כסף משנה
1.
It is forbidden to enter into privacy with any of the woman forbidden as ariot,1This prohibition also includes woman with whom relations are forbidden merely by a negative commandment (Beit Shmuel 22:1). even if she is elderly or a young girl,2And thus there is no apparent motivation toward sexual relations. for this leads to forbidden relations. [The only] exceptions are a woman and her son, a father and his daughter, and a husband with his wife who is in the niddah state.3See the Chelkat Mechokek 22:1 and the Beit Shmuel, loc. cit. which cite opinions that maintain that a man is permitted to enter into privacy with his sister in a temporary situation.
When a bridegroom's wife menstruates before he engages in relations with her, it is forbidden for him to enter into privacy with her.4Since the couple have never engaged in relations, we fear that they will not be able to control their desire. Hence we require them to take this added safeguard. Instead, she should sleep among [other] women and he should sleep among [other] men.5See Rama (Yoreh De'ah 192:4) who discusses this issue in depth, mentioning several stringencies and leniencies. He states the prevailing custom is for a young boy to accompany the groom and a young girl to accompany the bride. Every person should check with a competent Rabbinic authority with regard to the custom followed in their community. If they engaged in relations once and afterwards, she became impure, he is permitted to enter into privacy with her.

הלכה ב
לֹא נֶחְשְׁדוּ יִשְׂרָאֵל עַל מִשְׁכַּב זָכוּר וְעַל הַבְּהֵמָה. לְפִיכָךְ אֵין אָסוּר לְהִתְיַחֵד עִמָּהֶן. וְאִם נִתְרַחֵק אֲפִלּוּ מִיִּחוּד זָכוּר וּבְהֵמָה הֲרֵי זֶה מְשֻׁבָּח. וּגְדוֹלֵי הַחֲכָמִים הָיוּ מַרְחִיקִין הַבְּהֵמָה כְּדֵי שֶׁלֹּא יִתְיַחֲדוּ עִמָּהּ. וְאִסּוּר יִחוּד הָעֲרָיוֹת מִפִּי הַקַּבָּלָה:
כסף משנה
2.
Jewish men were not suspected of engaging in relations with men or with animals. Hence, there is no prohibition against entering into privacy with them.6The Shulchan Aruch (Even HaEzer 24:1) writes that homosexuality had become prevalent in his community and hence, it was deemed appropriate not to enter into privacy with other men. The Bayit Chadash states that in places where this transgression is not widespread, there is no need for taking such precautions. If, however, a person distances himself from entering into privacy even with a male or an animal, it is praiseworthy. Sages of great stature would distance themselves from animals so that they would not be alone with them.7See Kiddushin 81b.
The prohibition against entering into privacy with woman forbidden as ariot has been transmitted by the Oral Tradition.8Kiddushin 80b states that "there is an allusion to the prohibition against entering into privacy in the Torah." The Rambam understands that to mean that the prohibition was conveyed by the Oral Tradition and our Sages found an allusion for it in the Torah. The Tur (Even HaEzer 22), however, follows the opinion of Tosafot who maintains that the prohibition is of Scriptural origin.

הלכה ג
כְּשֶׁאֵרַע מַעֲשֶׂה אַמְנוֹן וְתָמָר גָּזַר דָּוִד וּבֵית דִּינוֹ עַל יִחוּד פְּנוּיָה. וְאַף עַל פִּי שֶׁאֵינָהּ עֶרְוָה בִּכְלַל יִחוּד עֲרָיוֹת הִיא. וְשַׁמַּאי וְהִלֵּל גָּזְרוּ עַל יִחוּד כּוּתִית. נִמְצָא כָּל הַמִּתְיַחֵד עִם אִשָּׁה שֶׁאָסוּר לְהִתְיַחֵד עִמָּהּ בֵּין יִשְׂרְאֵלִית בֵּין כּוּתִית מַכִּין אֶת שְׁנֵיהֶן מַכַּת מַרְדּוּת הָאִישׁ וְהָאִשָּׁה. וּמַכְרִיזִין עֲלֵיהֶן. חוּץ מֵאֵשֶׁת אִישׁ שֶׁאַף עַל פִּי שֶׁאָסוּר לְהִתְיַחֵד עִמָּהּ אִם נִתְיַחֵד אֵין לוֹקִין. שֶׁלֹּא לְהוֹצִיא לַעַז עָלֶיהָ שֶׁזִּנְּתָה וְנִמְצְאוּ מוֹצִיאִין לַעַז עַל הַבָּנִים שֶׁהֵן מַמְזֵרִים:
כסף משנה
3.
When the incident concerning Amnon and Tamar occurred,9As II Samuel, ch. 13, relates: Amonon, David's oldest son, lusted for Tamar, his half-sister. He feigned illness and asked that Tamar serve him a meal. While she was serving him, he raped her. David and his court decreed a prohibition against entering into privacy with an unmarried woman. Although an unmarried woman is not an ervah, such an act is considered as entering into privacy with an ervah. Shammai and Hillel decreed a prohibition against entering into privacy with gentiles.10In that era, there already were more substantial social conduct between Jews and gentiles and our Sages felt that there was a need for further safeguards.
Thus when anyone enters into privacy with a woman, whether Jew or gentile, with whom such an act is forbidden, both the man and the woman are given stripes for rebellious conduct and an announcement is made concerning them.11Publicizing their misconduct so that the shame will further inhibit a future recurrence. An exception is made with regard to a married woman. Although it is forbidden to enter into privacy with her, if one does enter into privacy with her, corporal punishment is not administered12The simple meaning of the Rambam's words is that lashes are not administered at all, neither to the man or the woman. The Bayit Chadash (Even HaEzer 22), however, states that punishment should be administered to the man, for it is not necessary to mention the woman with whom he transgressed. lest a rumor be initiated that she committed adultery. Thus a rumor might spread that her children are mamzerim.

הלכה ד
כָּל אִשָּׁה שֶׁאָסוּר לְהִתְיַחֵד עִמָּהּ אִם הָיְתָה אִשְׁתּוֹ עִמּוֹ הֲרֵי זוֹ מֻתֶּרֶת לְהִתְיַחֵד מִפְּנֵי שֶׁאִשְׁתּוֹ מְשַׁמַּרְתּוֹ. אֲבָל לֹא תִּתְיַחֵד יִשְׂרְאֵלִית עִם הַכּוּתִי וְאַף עַל פִּי שֶׁאִשְׁתּוֹ עִמּוֹ שֶׁאֵין אִשְׁתּוֹ שֶׁל כּוּתִי מְשַׁמַּרְתּוֹ וְאֵין לָהֶן בּוּשָׁה:
כסף משנה
4.
Whenever a man is forbidden to enter into privacy with a woman, this act is permitted if he is accompanied by his wife, for his wife will guard him [against transgression]. A Jewish woman should not enter into privacy with a gentile man even if his wife is with him. For a gentile's wife will not guard him [against transgression] and they have no shame.13And there is the possibility that he will engage in relations with her in the presence of his wife.

הלכה ה
וְכֵן אֵין מוֹסְרִין תִּינוֹק יִשְׂרָאֵל לְכוּתִי לְלַמְּדוֹ סֵפֶר וּלְלַמְּדוֹ אָמָּנוּת. מִפְּנֵי שֶׁכֻּלָּן חֲשׁוּדִין עַל מִשְׁכַּב זָכוּר. וְאֵין מַעֲמִידִין בְּהֵמָה בְּפֻנְדָּקִיּוֹת שֶׁל כּוּתִים וַאֲפִלּוּ זְכָרִים אֵצֶל זְכָרִים וּנְקֵבוֹת אֵצֶל נְקֵבוֹת:
כסף משנה
5.
Similarly, a Jewish child should not be entrusted to a gentile with the intent that he teach him to read or teach him a craft, for all gentiles are suspect to engage in homosexual relations. Similarly, we do not house an animal in an inn belonging to gentiles, not even a male in an inn with males and a female in an inn with females.14For we fear that the gentiles will engage in sexual misconduct. See Halachah 7.

הלכה ו
וְאֵין מוֹסְרִין בְּהֵמָה חַיָּה וְעוֹף לְרוֹעֶה כּוּתִי אֲפִלּוּ זְכָרִים לְכוּתִים וּנְקֵבוֹת לְכוּתִית מִפְּנֵי שֶׁכֻּלָּן חֲשׁוּדִין עַל הַרְבָּעַת בְּהֵמָה וּכְבָר בֵּאַרְנוּ שֶׁהֵן אֲסוּרִין בְּזָכוּר וּבִבְהֵמָה וְנֶאֱמַר (ויקרא יט יד) "וְלִפְנֵי עִוֵּר לֹא תִתֵּן מִכְשׁל":
כסף משנה
6.
We do not entrust an animal, beast, or fowl to a gentile shepherd, not even a male animal to a male shepherd and a female animal to a female shepherd, because they are all suspect to sodomize animals. We have already explained15Chapter 14, Halachah 10. that [gentiles] are forbidden to engage in homosexuality or sodomy. And [Leviticus 19:14] states: "Do not place a stumbling block before the blind."16As interpreted by Avodah Zarah 6b, et al, this verse is a command not to place a person in a situation where he is likely to sin. By placing an animal belonging to him in the gentile's possession, the Jew is making it possible for him to sin.

הלכה ז
וּמִפְּנֵי מָה אֵין מוֹסְרִין בְּהֵמָה נְקֵבָה לְכוּתִית מִפְּנֵי שֶׁכֻּלָּן בְּחֶזְקַת נוֹאֲפִים וּכְשֶׁיָּבוֹא הַנּוֹאֵף לִשְׁכַּב עִם הַכּוּתִית זוֹ אֶפְשָׁר שֶׁלֹּא יִמְצָאֶנָּה וְיִשְׁכַּב עִם הַבְּהֵמָה אוֹ אֲפִלּוּ יִמְצָאֶנָּה יִשְׁכַּב עִם הַבְּהֵמָה:
כסף משנה
7.
Why do we not entrust a female animal to a female gentile? For [all gentiles] are assumed to be promiscuous and when a gentile man will come to sleep with this gentile woman, it is possible that he will not find her and instead, sodomize the animal. Or even if he does find her, he may sodomize the animal.

הלכה ח
לֹא תִּתְיַחֵד אִשָּׁה אַחַת אֲפִלּוּ עִם אֲנָשִׁים הַרְבֵּה עַד שֶׁתִּהְיֶה אִשְׁתּוֹ שֶׁל אֶחָד מֵהֶם שָׁם. וְכֵן לֹא יִתְיַחֵד אִישׁ אֶחָד אֲפִלּוּ עִם נָשִׁים הַרְבֵּה. נָשִׁים הַרְבֵּה עִם אֲנָשִׁים הַרְבֵּה אֵין חוֹשְׁשִׁין לְיִחוּד. הָיוּ הָאֲנָשִׁים מִבַּחוּץ וְהַנָּשִׁים מִבִּפְנִים אוֹ הָאֲנָשִׁים מִבִּפְנִים וְהַנָּשִׁים מִבַּחוּץ וּפֵרְשָׁה אִשָּׁה אַחַת לְבֵין הָאֲנָשִׁים אוֹ אִישׁ לְבֵין הַנָּשִׁים אֲסוּרִין מִשּׁוּם יִחוּד. אֲפִלּוּ אִישׁ שֶׁעִסְקוֹ וּמְלַאכְתּוֹ עִם הַנָּשִׁים אָסוּר לוֹ לְהִתְיַחֵד עִם הַנָּשִׁים. כֵּיצַד יַעֲשֶׂה. יִתְעַסֵּק עִמָּהֶן וְאִשְׁתּוֹ עִמּוֹ אוֹ יִפְנֶה לִמְלָאכָה אַחֶרֶת:
כסף משנה
8.
One woman should not enter into privacy even with many men17For we fear that she will enter into relations with one or more of the men in the presence of the others.
The Rama (Even HaEzer 22:5) states that a woman may enter into privacy with two upright men in a city, but not in a field, and only during the day, but not at night).
unless the wife of one of them is present.18For in that instance, she will guard him, as stated in Halachah 4. Nor will the other woman engage in relations in her presence, for it is likely that she will publicize the matter (Kessef Mishneh). Similarly, one man should not enter into privacy even with many women,19For in this instance as well, there is the possibility that they will engage in relations. The Rama (loc. cit.) gives permission for many [three (Chelkat Mechokek 22:11) women to enter into privacy with one man, provided his profession does not involve contact with women. But when there are many women together with many men, we do not show concern for the prohibition against entering into privacy.20In such a situation, it is highly unlikely that the people will engage in relations.
If the men were outside and the women were inside or if the men were inside and the women were outside, and one woman - or one man - separated themselves and joined the group of the other sex, the prohibition against entering into privacy applies.
Even a man whose business and profession [brings him into contact] with women21E.g., one who sells clothes or perfumes to women. is forbidden to enter into privacy with them. What should he do? He should involve himself with them while accompanied by his wife or turn to another profession.

הלכה ט
מֻתָּר לְהִתְיַחֵד עִם שְׁתֵּי יְבָמוֹת. אוֹ עִם שְׁתֵּי צָרוֹת. אוֹ עִם אִשָּׁה וַחֲמוֹתָהּ. אוֹ עִם אִשָּׁה וּבַת בַּעְלָהּ. אוֹ עִם אִשָּׁה וּבַת חֲמוֹתָהּ. מִפְּנֵי שֶׁשּׂוֹנְאוֹת זוֹ אֶת זוֹ וְאֵין מְחַפּוֹת זוֹ עַל זוֹ. וְכֵן מֻתָּר לְהִתְיַחֵד עִם אִשָּׁה שֶׁיֵּשׁ עִמָּהּ תִּינֹקֶת קְטַנָּה שֶׁיּוֹדַעַת טַעַם בִּיאָה וְאֵינָהּ מוֹסֶרֶת עַצְמָהּ לְבִיאָה. שֶׁאֵינָהּ מְזַנָּה בְּפָנֶיהָ שֶׁהֲרֵי זוֹ מְגַלָּה אֶת סוֹדָהּ:
כסף משנה
9.
It is permitted to enter into privacy with two yevamot, two wives of the same man, a woman and her mother-in-law, or a woman and her husband's daughter, a woman and her husband's daughter, or a woman and her mother-in-law's daughter. [The rationale is that] these women hate each other and will not conceal the other's [misdeeds].22Hence the women will be frightened to engage in sexual relations, for they know the matter will become public knowledge. Similarly, it is permitted to enter into privacy with a woman who is accompanied by a young child old enough to understand what sexual relations are, but who would not engage in relations herself. [The rationale is that the woman] would not act promiscuously in the presence of this child, for she will reveal her secret.

הלכה י
תִּינֹקֶת מִבַּת שָׁלֹשׁ וּלְמַטָּה וְתִינוֹק בֶּן תֵּשַׁע וּלְמַטָּה מֻתָּר לְהִתְיַחֵד עִמָּהֶן. שֶׁלֹּא גָּזְרוּ אֶלָּא עַל יִחוּד אִשָּׁה הָרְאוּיָה לְבִיאָה וְאִישׁ הָרָאוּי לְבִיאָה:
כסף משנה
10.
It is permitted to enter into privacy with a female child less than three years old and a male child less than nine years old. For [our Sages] only issued decrees concerning entering into privacy with a woman fit to engage in relations and a male fit to engage in relations.23And this does not apply below the ages mentioned in the halachah.

הלכה יא
אַנְדְּרוֹגִינוּס אֵינוֹ מִתְיַחֵד עִם הַנָּשִׁים. וְאִם נִתְיַחֵד אֵין מַכִּין אוֹתוֹ מִפְּנֵי שֶׁהוּא סָפֵק. אֲבָל הָאִישׁ מִתְיַחֵד עִם הָאַנְדְּרוֹגִינוּס וְעִם הַטֻּמְטוּם:
כסף משנה
11.
An androgynus24A person with both male and female sexual organs. may not enter into privacy with women.25For he has a sexual drive for relations with women (Beit Shmuel 22:16). If he does, he is not given physical punishment, because his status is doubtful. A man may enter into privacy with an androgynus or a tumtum.26A tumtum refers to a person whose genitalia are covered by a block of flesh and it cannot be determined whether he is a male or female. A male is permitted to enter into privacy with these individuals, because he does not have a sexual drive for anyone other than an actual woman (ibid.).

הלכה יב
אֵשֶׁת אִישׁ שֶׁהָיָה בַּעְלָהּ בָּעִיר אֵינָהּ חוֹשֶׁשֶׁת לְיִחוּד. מִפְּנֵי שֶׁאֵימַת בַּעְלָהּ עָלֶיהָ. וְאִם הָיָה זֶה גַּס בָּהּ כְּגוֹן שֶׁגָּדְלָה עִמּוֹ אוֹ שֶׁהָיְתָה קְרוֹבָתוֹ לֹא יִתְיַחֵד עִמָּהּ וְאַף עַל פִּי שֶׁבַּעְלָהּ בָּעִיר. וְכֵן כָּל הַמִּתְיַחֵד עִם אִשָּׁה וְהָיָה הַפֶּתַח פָּתוּחַ לִרְשׁוּת הָרַבִּים אֵין חוֹשְׁשִׁין מִשּׁוּם יִחוּד:
כסף משנה
12.
When a married woman's husband is in the [same] city, she need not be concerned about [the prohibition against] entering into privacy with another man, because she will be impressed by the fear of her husband.27She will fear that at any particular time, her husband will come. Hence she will never commit adultery. If a man is overly familiar with her, e.g., they grew up together or she is his relative, she should not enter into privacy with him even if her husband is in the same city.28Because this familiarity may cause her to overstep the bounds of modesty even when her husband is in the city.
Whenever a man enters into a room with a woman, but there is a door29The later commentaries explain that open windows are also sufficient. open to the public thoroughfare, we are not concerned about [the prohibition against] entering into privacy.30Since it is possible for the two to be seen by passersby, they will not transgress.

הלכה יג
מִי שֶׁאֵין לוֹ אִשָּׁה לֹא יְלַמֵּד תִּינוֹקוֹת. מִפְּנֵי שֶׁאִמּוֹת הַבָּנִים בָּאוֹת לְבֵית הַסֵּפֶר לִבְנֵיהֶם וְנִמְצָא מִתְגָּרֶה בְּנָשִׁים. וְכֵן אִשָּׁה לֹא תְּלַמֵּד קְטַנִּים מִפְּנֵי אֲבוֹתֵיהֶן שֶׁהֵן בָּאִין בִּגְלַל בְּנֵיהֶם וְנִמְצְאוּ מִתְיַחֲדִים עִמָּהּ. וְאֵין הַמְלַמֵּד צָרִיךְ שֶׁתִּהְיֶה אִשְׁתּוֹ שְׁרוּיָה עִמּוֹ בְּבֵית הַסֵּפֶר אֶלָּא הִיא בְּבֵיתָהּ וְהוּא מְלַמֵּד בִּמְקוֹמוֹ:
כסף משנה
13.
An unmarried man should not teach young children, because the mothers come to the school because of their sons and thus he will be tempted by women.31This applies even in a situation where there is no question of the teacher entering into privacy with the mothers (Beit Shmuel 22:21). Similarly, a woman32This refers to an unmarried woman or one whose husband is out of town. Otherwise, there is no prohibition against entering into privacy (Chelkat Mechokek 22:21). should not teach young boys, because their fathers come because of their sons and thus they will enter into privacy with her. A teacher does not have to have his wife together with him in school,33To avoid the prohibition that stems from his being tempted by women. It is sufficient that she be at home, while he teaches in his place.34According to the Maggid Mishneh, this leniency applies even if the teacher's wife is in another city. As long as he is married, there is no prohibition. The Chelkat Mechokek 22:21 and the Beit Shmuel 22:22 differ and conclude that this leniency applies only when the man's wife lives in the same city where he teaches. If she lives in another city, it is forbidden.

הלכה יד
תִּקְּנוּ חֲכָמִים שֶׁתִּהְיֶינָה הַנָּשִׁים מְסַפְּרוֹת זוֹ עִם זוֹ בְּבֵית הַכִּסֵּא כְּדֵי שֶׁלֹּא יִכָּנֵס שָׁם אִישׁ מִשּׁוּם יִחוּד:
כסף משנה
14.
Our Sages ordained that women speak to each other while in a lavatory,35The Rama (Even HaEzer 22:13) states that this refers to outhouses in the fields (which was the custom in the Talmudic era), but not to outhouses in the city (which had become the custom in his time). Needless to say, it does not apply in the present age when the lavatories are in the privacy of buildings. so that a man will not enter there and thus be alone with them.

הלכה טו
אֵין מְמַנִּין אֲפִלּוּ אָדָם נֶאֱמָן וְכָשֵׁר לִהְיוֹת שׁוֹמֵר חָצֵר שֶׁיֵּשׁ שָׁם נָשִׁים אַף עַל פִּי שֶׁהוּא עוֹמֵד בַּחוּץ שֶׁאֵין אַפּוֹטְרוֹפּוֹס לַעֲרָיוֹת. וְאָסוּר לְאָדָם לְמַנּוֹת אַפּוֹטְרוֹפּוֹס עַל בֵּיתוֹ שֶׁלֹּא יַנְהִיג אִשְׁתּוֹ לִדְבַר עֲבֵרָה:
כסף משנה
15.
We do not appoint even a faithful and observant person to be a guard of a courtyard where women live. [This applies] even if he stands outside, for there is no guardian against promiscuity.36I.e., No matter how upright the person's character, there is the possibility that frequent exposure to women will lead him to undesirable relations.
It is forbidden for a person to appoint a supervisor over his home so that he does not lead his wife to sin.37We fear that if another man was placed in charge of a person's home, he would have frequent contact with the owner's wife and there is the possibility that ultimately the two will commit adultery. As Berachot 63a states: "Had Potiphar not appointed Joseph as the supervisor of his home, that incident (Potiphar's wife attempted seduction of Joseph) would never have occurred."

הלכה טז
אָסוּר לְתַלְמִיד חָכָם לִשְׁכֹּן בְּחָצֵר שֶׁיֵּשׁ בָּהּ אַלְמָנָה אַף עַל פִּי שֶׁאֵינוֹ מִתְיַחֵד עִמָּהּ מִפְּנֵי הַחֲשָׁד. אֶלָּא אִם כֵּן הָיְתָה אִשְׁתּוֹ עִמּוֹ. וְכֵן אַלְמָנָה אֲסוּרָה לְגַדֵּל כֶּלֶב מִפְּנֵי הַחֲשָׁד. וְלֹא תִּקְנֶה אִשָּׁה עֲבָדִים זְכָרִים אֲפִלּוּ קְטַנִּים מִפְּנֵי הַחֲשָׁד:
כסף משנה
16.
It is forbidden for a Torah scholar to dwell in a courtyard where a widow lives even though he does not enter into privacy with her lest suspicions arise38I.e., people at large will suspect that they are sharing a relationship.
The Ra'avad differs with the Rambam's ruling, explaining that what was forbidden was to dwell with her in the same home. There are no restrictions against dwelling in the same courtyard. According to the Rambam, dwelling in the same home temporarily is permitted as long as one does not enter into privacy with her. The Maggid Mishneh supports the Rambam's interpretation.
unless his wife is with him. Similarly, a widow should not raise a dog because of the suspicions that might arise. Nor should a woman purchase male servants - even minors - because of the suspicions that may arise.39I.e., people will gossip that she is intimate with the dog or the servants. In Hilchot Avadim 9:6, the Rambam mentions this restriction only with regard to servants nine years old or above. See the notes to that halachah.

הלכה יז
אֵין דּוֹרְשִׁין בְּסִתְרֵי עֲרָיוֹת בִּשְׁלֹשָׁה מִפְּנֵי שֶׁהָאֶחָד טָרוּד בִּשְׁאֵלַת הָרַב וְהַשְּׁנַיִם נוֹשְׂאִין וְנוֹתְנִין זֶה עִם זֶה וְאֵין דַּעְתָּם פְּנוּיָה לִשְׁמֹעַ. שֶׁדַּעְתּוֹ שֶׁל אָדָם קְרוֹבָה אֵצֶל עֲרָיוֹת. אִם נִסְתַּפֵּק לוֹ דָּבָר שֶׁשָּׁמַע מוֹרֶה לְהָקֵל. לְפִיכָךְ אֵין דּוֹרְשִׁין אֶלָּא לִשְׁנַיִם כְּדֵי שֶׁיִּהְיֶה הָאֶחָד הַשּׁוֹמֵעַ מְפַנֶּה דַּעְתּוֹ וְיוֹדֵעַ מַה שֶּׁיִּשְׁמַע מִן הָרַב:
כסף משנה
17.
We do not relate the hidden matters40Rashi (Chagigah 11b) interprets this as referring to those matters which are not explicit in the Torah. concerning forbidden sexual conduct to three students. [The rationale is that] one will be absorbed in questioning the teacher, the other two will be debating the matter back and forth and will not be free to listen. Since a person's mind is aroused by sexual matters,41The Rambam, based on Chagigah, loc. cit., is explaining why there is a difference between the laws concerning forbidden sexual conduct and those involving other matters. if a doubt arises concerning something he heard, he may [in error] rule leniently. Therefore, we teach only to two. In this manner, the one listening will focus his attention and recall what he will hear from the teacher.

הלכה יח
אֵין לְךָ דָּבָר בְּכָל הַתּוֹרָה כֻּלָּהּ שֶׁהוּא קָשֶׁה לְרֹב הָעָם לִפְרשׁ אֶלָּא מִן הָעֲרָיוֹת וְהַבִּיאוֹת הָאֲסוּרוֹת. אָמְרוּ חֲכָמִים בְּשָׁעָה שֶׁנִּצְטַוּוּ יִשְׂרָאֵל עַל הָעֲרָיוֹת בָּכוּ וְקִבְּלוּ מִצְוָה זוֹ בְּתַרְעוֹמוֹת וּבְכִיָּה שֶׁנֶּאֱמַר (במדבר יא י) "בֹּכֶה לְמִשְׁפְּחֹתָיו" עַל עִסְקֵי מִשְׁפָּחוֹת:
כסף משנה
18.
There is nothing in the entire Torah that is more difficult for the majority of people to separate themselves from than sexual misconduct and forbidden relationships. Our Sages said:42Sifri, Parshat Bahaaloscha; Shabbat 130b. When the Jews were commanded regarding forbidden sexual relations, they wept and accepted this mitzvah with complaints and moaning, as implied by the phrase: "Crying among their families," [which is interpreted as meaning]: "Crying about family matters."

הלכה יט
וְאָמְרוּ חֲכָמִים גֵּזֶל וַעֲרָיוֹת נַפְשׁוֹ שֶׁל אָדָם מִתְאַוָּה לָהֶן וּמְחַמְּדָתָן. וְאֵין אַתָּה מוֹצֵא קָהָל בְּכָל זְמַן וּזְמַן שֶׁאֵין בָּהֶן פְּרוּצִין בַּעֲרָיוֹת וּבִיאוֹת אֲסוּרוֹת. [וְעוֹד] אָמְרוּ חֲכָמִים רֹב בְּגֵזֶל מִעוּט בַּעֲרָיוֹת וְהַכּל בַּאֲבַק לָשׁוֹן הָרַע:
כסף משנה
19.
Our Sages said:43Makkot 23b. A person's soul desires and craves theft and forbidden sexual relations. You will never find a community that does not have some people who are promiscuous regarding forbidden relationships and prohibited sexual conduct. Moreover, our Sages said:44Bava Batra 165a. Most people trespass with regard to theft; a minority with regard to forbidden sexual conduct, and all with regard to the shade of undesirable gossip.45This term refers to remarks concerning a colleague that are not actually lashon hara, unfavorable gossip, but which border on that type of speech. See Hilchot De'ot, ch. 7, for a more precise discussion of this issue.

הלכה כ
לְפִיכָךְ רָאוּי לוֹ לְאָדָם לָכֹף יִצְרוֹ בְּדָבָר זֶה וּלְהַרְגִּיל עַצְמוֹ בִּקְדֻשָּׁה יְתֵרָה וּבְמַחֲשָׁבָה טְהוֹרָה וּבְדֵעָה נְכוֹנָה כְּדֵי לְהִנָּצֵל מֵהֶן. וְיִזָּהֵר מִן הַיִּחוּד שֶׁהוּא הַגּוֹרֵם הַגָּדוֹל. גְּדוֹלֵי הַחֲכָמִים הָיוּ אוֹמְרִים לְתַלְמִידֵיהֶם הִזָּהֲרוּ בִּי מִפְּנֵי בִּתִּי הִזָּהֲרוּ בִּי מִפְּנֵי כַּלָּתִי. כְּדֵי לְלַמֵּד לְתַלְמִידֵיהֶם שֶׁלֹּא יִתְבַּיְּשׁוּ מִדָּבָר זֶה וְיִתְרַחֲקוּ מִן הַיִּחוּד:
כסף משנה
20.
Therefore it is proper for a person to subjugate his natural inclination with regard to this matter and train himself in extra holiness, pure thought, and proper character traits so that he will be guarded against them.
He should be very careful with regard to entering into privacy with a woman, for this is a great cause [of transgression]. Our great Sages would tell their students:46See Kiddushin 82b who quotes Rabbi Tarfon and Rabbi Meir as making such statements. It continues, relating that one of his students mocked Rabbi Meir for making such statements. Shortly afterwards, it was discovered that this student committed adultery with his mother-in-law. "Watch me because of my daughter," "Watch me because of my daughter-in-law," so that they would teach their students not to be embarrassed about such matters and distance themselves from entering into privacy with women.

הלכה כא
וְכֵן יִנְהֹג לְהִתְרַחֵק מִן הַשְּׂחוֹק וּמִן הַשִּׁכְרוּת וּמִדִּבְרֵי עֲגָבִים שֶׁאֵלּוּ גּוֹרְמִין גְּדוֹלִים וְהֵם מַעֲלוֹת שֶׁל עֲרָיוֹת. וְלֹא יֵשֵׁב בְּלֹא אִשָּׁה שֶׁמִּנְהָג זֶה גּוֹרֵם לְטָהֳרָה יְתֵרָה. גְּדוֹלָה מִכָּל זֹאת אָמְרוּ יַפְנֶה עַצְמוֹ וּמַחֲשַׁבְתּוֹ לְדִבְרֵי תּוֹרָה וְיַרְחִיב דַּעְתּוֹ בַּחָכְמָה שֶׁאֵין מַחְשֶׁבֶת עֲרָיוֹת מִתְגַּבֶּרֶת אֶלָּא בְּלֵב פָּנוּי מִן הַחָכְמָה. וּבַחָכְמָה הוּא אוֹמֵר (משלי ה יט) "אַיֶּלֶת אֲהָבִים וְיַעֲלַת חֵן דַּדֶּיהָ יְרַוֵּךָ בְכָל עֵת בְּאַהֲבָתָהּ תִּשְׁגֶּה תָמִיד":
כסף משנה
21.
Similarly, a person should distance himself from levity, intoxication, and flirtation,47Our translation is based on the words of Rama (Even HaEzer 25:1) and Chelkat Mechokek 25:1. for they are great precipitators and steps [leading] to forbidden relations.
A man should not live without a wife, for this practice leads to great purity.48While married, he will have the opportunity for ordinary male-female relationships and will not develop pent up feelings that seek expression in forbidden relations. And [our Sages gave] even greater [advice], saying:49Kiddushin 30b. "A person should always turn himself and his thoughts to the words of the Torah and expand his knowledge in wisdom, for the thoughts of forbidden relations grow strong solely in a heart which is empty of wisdom." And in [Solomon's words of] wisdom [Proverbs 5:19], it is written: "It50The Torah. See Eruvin 54b which explains the analogy in detail. is a beloved hind, arousing favor. Her breasts will satisfy you at all times. You shall be obsessed with her love."

קדושה הלכות איסורי ביאה פרק כב
Kedushah Issurei Biah Chapter 22