אהבה
הלכות תפילין ומזוזה וספר תורה
פרק ו
Ahavah
Tefillin, Mezuzah, and Sefer Torah
Chapter 6

Halacha

הלכה א
עֲשָׂרָה תְּנָאִין יֵשׁ בַּבַּיִת וְאַחַר כָּךְ יִתְחַיֵּב הַדָּר בּוֹ לַעֲשׂוֹת לוֹ מְזוּזָה. וְאִם חָסֵר תְּנַאי אֶחָד מֵהֶן פָּטוּר מִן הַמְּזוּזָה. וְאֵלּוּ הֵן. שֶׁיִּהְיֶה בּוֹ אַרְבַּע אַמּוֹת עַל אַרְבַּע אַמּוֹת אוֹ יָתֵר. וְשֶׁתִּהְיֶינָה לוֹ שְׁתֵּי מְזוּזוֹת. וְיִהְיֶה לוֹ מַשְׁקוֹף. וְתִהְיֶה לוֹ תִּקְרָה. וְיִהְיוּ לוֹ דְּלָתוֹת. וְיִהְיֶה הַשַּׁעַר גָּבוֹהַּ עֲשָׂרָה טְפָחִים אוֹ יוֹתֵר. וְיִהְיֶה הַבַּיִת חֹל. וְיִהְיֶה עָשׂוּי לְדִירַת אָדָם. וְעָשׂוּי לְדִירַת כָּבוֹד. וְעָשׂוּי לְדִירַת קֶבַע:
כסף משנה
1.
There are ten requirements that must be met by a house for the person who dwells within to be obligated to affix a mezuzah.1The Rambam's choice of phraseology emphasizes the concept mentioned in the previous halachah: that the mezuzah is the obligation of the dweller and not the dwelling. If one of the requirements is lacking, there is no obligation for a mezuzah.2It appears that all these requirements are mid'oraita, postulated by Torah law. They are:

a) for the area [of the dwelling] to be four cubits by four cubits or3See Halachah 2. more;

b) for it4the entrance to have two5Note the Turei Zahav 287:1 and the Kitzur Shulchan Aruch 11:11, which state that if an entrance has a doorpost on the right side and a wall which continues on the left side, a mezuzah should be affixed without a blessing. If the doorpost is on the left side, and the wall continues on the right, there is no need for a mezuzah. doorposts;6According to most authorities, the doorpost need not be an addition to the walls of the house. Even if the entrance to the house does not have a frame attached to it, but rather the wall of the house itself serves as the doorpost attached to it, a mezuzah is required. Note the statements of the Turei Zahav 287:1. (See also Halachah 3.)

c) for it7the entrance to have a lintel;

d)8a beam above the doorposts. According to many authorities, the ceiling of the house is not considered to be a lintel. (See also Halachah 4.) for it9the dwelling to have a roof;

e)10See Halachah 5. for it11the entrance to have doors;

f)12The Ra'avad, Rabbenu Asher, and others differ with the Rambam's opinion. In a responsum attributed to the Rambam, his view is explained as follows: The Torah states that a mezuzah should be placed "on your gates." This expression implies an entrance with doors.
The Shulchan Aruch (Yoreh De'ah 286:15) obligates us to place a mezuzah even on entrances which do not have doors. Nevertheless, in deference to the Rambam's opinion, the Siftei Cohen 286:25 states that a person should not recite a blessing when affixing such a mezuzah. (See also Halachah 5.)
for the entrance to be at least ten handbreadths13If the entrance is not at least this high, it is not fit to be used by adults. (See also Halachah 4.) high;

g) for the dwelling not to be consecrated;

h)14See Halachah 6. for it to be intended for human habitation;

i)15This principle is not accepted by all authorities. See Halachah 7. for it to be intended to be used for a dignified16See Halachah 9.
j) for it to be a permanent dwelling. - See Halachah 9.
dwelling;

j) for it to be a permanent dwelling.

הלכה ב
בַּיִת שֶׁאֵין לוֹ אַרְבַּע אַמּוֹת עַל אַרְבַּע אַמּוֹת פָּטוּר מִן הַמְּזוּזָה. וְאִם יֵשׁ בּוֹ כְּדֵי לְרַבֵּעַ אַרְבַּע אַמּוֹת עַל אַרְבַּע אַמּוֹת בְּשָׁוֶה אַף עַל פִּי שֶׁהוּא עָגל אוֹ בַּעַל חָמֵשׁ זָוִיּוֹת וְאֵין צָרִיךְ לוֹמַר שֶׁאִם הָיָה אָרְכּוֹ יָתֵר עַל רָחְבּוֹ הוֹאִיל וְיֵשׁ בּוֹ לְרַבֵּעַ אַרְבַּע אַמּוֹת עַל אַרְבַּע אַמּוֹת חַיָּב בִּמְזוּזָה:
כסף משנה
2.
A dwelling which is less than four cubits1A cubit is approximately 48 centimeters according to Shiurei Torah, and 58 centimeters according to the Chazon Ish. by four cubits does not require a mezuzah.2Any smaller area would not be considered fit for a dwelling (Rabbenu Asher). If its area is equal to sixteen square cubits, although it is circular, pentagonal, and needless to say, if it is rectangular,3The Or Sameach explains the advantage of a rectangular shape based on Hilchot Tzara'at 14:6, which states that only a square or rectangular-shaped building is considered to be a house with regard to the impurity of tzara'at. since its area is equal to the above-mentioned figure, it requires a mezuzah.4Rabbenu Asher does not accept the Rambam's view. Although the Shulchan Aruch (Yoreh De'ah 286:13) accepts the Rambam's view, in deference to Rabbenu Asher's opinion, the Siftei Cohen 286:23 states that one should not recite a blessing when affixing such a mezuzah.
The Merchevat HaMishneh does not agree with the Shulchan Aruch's interpretation of the Rambam's words, and explains that the Rambam is referring to a circular building whose circumference is large enough to contain a square four cubits by four cubits. Compare with Hilchot Sukkah 4:7.
As explained in Halachah 8, a mezuzah must be affixed to an entrance which leads to another entrance which requires a mezuzah even if the former entrance would not require a mezuzah in its own right. Accordingly, we must say that this halachah is speaking about an independent structure and not a room in a house.

הלכה ג
אַכְסַדְרָה וְהוּא הַמָּקוֹם שֶׁיֵּשׁ לוֹ שְׁלֹשָׁה כְּתָלִים וְתִקְרָה אַף עַל פִּי שֶׁיֵּשׁ לָהּ שְׁנֵי פַּצִּימִין בְּרוּחַ רְבִיעִית פְּטוּרָה מִן הַמְּזוּזָה. מִפְּנֵי שֶׁהַפַּצִּימִין לְהַעֲמִיד הַתִּקְרָה הֵם עֲשׂוּיִים וְלֹא מִשּׁוּם מְזוּזוֹת נַעֲשׂוּ. וְכֵן הַתִּקְרָה שֶׁאֵין לָהּ כְּתָלִים אֶלָּא עוֹמֶדֶת עַל עַמּוּדִים מִכָּאן וּמִכָּאן אַף עַל פִּי שֶׁהִיא כְּתַבְנִית בַּיִת פְּטוּרָה לְפִי שֶׁאֵין לָהּ מְזוּזוֹת. שֶׁאֵלּוּ הָעַמּוּדִים לְהַעֲמִיד הַתִּקְרָה הֵן עֲשׂוּיִין:
כסף משנה
3.
An excedra, a structure with three walls and a roof,1An excedra was a very common structure in Greek and Roman architecture that was also frequently employed in Jewish homes. It resembled a porch with three sides enclosed and the fourth side left open. (At times, both the third and fourth sides were left open. See Hilchot Sukkah 4:8,9.)
It was covered by a roof which contained an aperture to allow sunlight to enter. Decorative pillars were placed at each of the corners of the aperture.
does not require a mezuzah even though it has two pillars on the fourth side.2According to the Kessef Mishneh, this decision applies even if doors are affixed to the pillars. Though the pillars resemble the doorposts of an entrance, a mezuzah is not required because The pillars are intended as supports for the roof, and not as doorposts.3When quoting this law, the Shulchan Aruch (Yoreh De'ah 286:6) states that if the excedra has a wall (even if it is low) on the fourth side as well, a mezuzah is required. According to this decision, most porches that have pillars at their entrance require a mezuzah.
Similarly, a roof without walls4If, however, it has four walls, even though large openings are left in them, a mezuzah is required (Shulchan Aruch, Yoreh De'ah, loc. cit.). which stands on pillars, even though shaped like a house, does not require a mezuzah, because it has no doorposts. The pillars are intended5primarily, not to serve as doorposts, but to support the roof.6See Menachot 33b.

הלכה ד
בַּיִת שֶׁיֵּשׁ לוֹ מְזוּזָה מִכָּאן וּמִכָּאן וְכִפָּה כְּמִין קֶשֶׁת עַל שְׁתֵּי הַמְּזוּזוֹת בִּמְקוֹם הַמַּשְׁקוֹף. אִם יֵשׁ בְּגֹבַהּ הַמְּזוּזוֹת עֲשָׂרָה טְפָחִים אוֹ יָתֵר חַיָּב בִּמְזוּזָה. וְאִם אֵין בָּהֶן עֲשָׂרָה טְפָחִים פְּטוּרִין מִפְּנֵי שֶׁאֵין לוֹ מַשְׁקוֹף:
כסף משנה
4.
[The following rules apply to] a house which has a doorpost on either side and an arch above the two doorposts instead of a lintel. If the1portions of the doorposts2which stand straight and are not part of the arch are ten handbreadths high or more, it requires a mezuzah.3since it has both two doorposts of at least ten handbreadths each and a lintel. If they are not ten handbreadths high, [the entrance] does not require [a mezuzah], because it does not have a lintel.4The Rambam's phraseology has aroused questions from the commentators. Though all agree that a mezuzah is not required, most maintain that the reason is not that the entrance does not have a lintel - for the arch takes the place of the lintel - but rather because the entrance is not of the required height, ten handbreadths.
The Turei Zahav 287:3 explains that were the doorposts to be ten handbreadths high, the archway would be considered as the lintel. Since they are not ten handbreadths high, the archway is considered to be part of the doorposts, and thus, the entrance is considered to be lacking a lintel.

הלכה ה
בַּיִת שֶׁאֵין לוֹ תִּקְרָה פָּטוּר מִן הַמְּזוּזָה. הָיָה מִקְצָתוֹ מְקֹרֶה וּמִקְצָתוֹ אֵינוֹ מְקֹרֶה יֵרָאֶה לִי שֶׁאִם הָיָה הַקֵּרוּי כְּנֶגֶד הַפֶּתַח שֶׁהוּא חַיָּב בִּמְזוּזָה וּמַעֲמִידִין הַדְּלָתוֹת וְאַחַר כָּךְ קוֹבְעִין אֶת הַמְּזוּזָה:
כסף משנה
5.
A house that does not have a roof does not require a mezuzah.1Although a gate to a courtyard or a city requires a mezuzah even though the area enclosed by its walls is open, a house is different; unless it is covered by a roof, it does not require a mezuzah. (See Yoma 11b.) If a portion of [a building] was covered by a roof and a portion was not, the [following ruling] appears to me2Throughout the Mishneh Torah, the expression "appears to me" indicates a decision for which the Rambam has no explicit source in the texts of the previous generations. [as appropriate]: If the covered portion is near the entrance,3and the covered portion is four cubits by four cubits (Kessef Mishneh; Shulchan Aruch, Yoreh De'ah 286:14). Note, however, the Or Sameach, which does not require the covered portion to be this size. it requires a mezuzah.4See also the Pit'chei Teshuvah 286:13, which states that a part of a house which is customarily built without a roof requires a mezuzah.
The doors should be attached, and afterwards, a mezuzah affixed.5Though this statement, based on the following passage from Menachot 33a, is accepted by all halachic authorities (See Shulchan Aruch, Yoreh De'ah 289:3), its interpretation has been a source of controversy based on the difference of opinion (see Halachah 1) between the Rambam and other authorities whether an entrance without doors requires a mezuzah or not. The Talmud states:
The exilarch built a house. He requested of Rav Nachman: "Affix a mezuzah for me."Rav Nachman told him: "Attach the doors first."
The commentaries maintain that, according to the Rambam, Rav Nachman was telling the exilarch that if the doors were not attached before the mezuzah was affixed, it is invalid. Since an entrance without doors does not require a mezuzah, affixing it before the doors would create a problem: as explained in Chapter 5, Halachah 8, the doors must be affixed first. Other authorities explain that Rav Nachman made this statement only because it was necessary to determine the direction the doors would open in order to establish the proper side of the doorway on which to place the mezuzah.

הלכה ו
הַר הַבַּיִת הַלְּשָׁכוֹת וְהָעֲזָרוֹת וּבָתֵּי כְּנֵסִיּוֹת וּבָתֵּי מִדְרָשׁוֹת שֶׁאֵין בָּהֶן בֵּית דִּירָה פְּטוּרִין לְפִי שֶׁהֵן קֹדֶשׁ. בֵּית הַכְּנֶסֶת שֶׁל כְּפָרִים שֶׁהָאוֹרְחִין דָּרִין בּוֹ חַיָּב בִּמְזוּזָה. וְכֵן בֵּית הַכְּנֶסֶת שֶׁל כְּרַכִּין אִם הָיָה בּוֹ בֵּית דִּירָה חַיָּב. כָּל הַשְּׁעָרִים שֶׁהָיוּ בַּמִּקְדָּשׁ לֹא הָיָה לָהֶם מְזוּזוֹת חוּץ מִשַּׁעַר נִקָּנוֹר וְשֶׁלְּפָנִים מִמֶּנּוּ. וְשֶׁל לִשְׁכַּת פַּרְהֶדְרִין מִפְּנֵי שֶׁהַלִּשְׁכָּה הַזֹּאת הָיְתָה בֵּית דִּירָה לְכֹהֵן גָּדוֹל בְּשִׁבְעַת יְמֵי הַהַפְרָשָׁה:
כסף משנה
6.
[The gates to] the Temple Mount,1There was a wall around the complex of the Temple Mount separating it from the remainder of the city of Jerusalem. It had five gates, as described in Hilchot Beit HaBechirah 5:2. its chambers, courtyards,2Within the Temple, there were many different chambers and courtyards; they are described in Hilchot Beit HaBechirah, Chapter 5. and, similarly, entrances to synagogues3which are referred to as "sanctuaries in microcosm" (Megillah 29a) and houses of study4Since students often eat and sleep in a house of study, it is customary to place mezuzot there (Tur, Yoreh De'ah 286). The Shulchan Aruch (286:10) suggests affixing a mezuzah without reciting a blessing beforehand. which do not have apartments in which people live do not require mezuzot, because they are consecrated.5Yoma 11b derives this concept from the exegesis of Deuteronomy 6:9: "And you shall write them on the doorposts of your homes." The Temple is not "your home," a private dwelling, and therefore does not require a mezuzah.
The Chatam Sofer (Yoreh De'ah, Responsum 281) asks: Since the Chamber of Parhedrin was the only portion within the Temple Courtyard used as a person's dwelling, why does the Rambam state that these entrances do not require mezuzot because they are consecrated? Since they are not used as a dwelling, why would one think they require a mezuzah?
The Chatam Sofer explains that the Temple is a dwelling - in fact, the ultimate dwelling, the resting place of the Divine Presence. Nevertheless, since it is not a dwelling for humans, it does not require a mezuzah.

A synagogue in a village in which guests reside requires a mezuzah. Similarly, a synagogue in a metropolis, if it has an apartment, requires a mezuzah.6The Nimukei Yosef (Halachot Katanot) explains that synagogues in villages would generally have apartments for guests, because the villagers' homes were usually not large enough to accommodate them. In contrast, in large cities, there were generally enough people willing to invite guests to their homes, and thus it was unnecessary for a synagogue to have a guest apartment.
All the gates in the Temple complex did not have mezuzot, with the exception of the Gate of Nicanor7The central gate to the Temple Courtyard. (See Hilchot Beit HaBechirah 5:5.)
The Gate of Nicanor required a mezuzah because it was the gate directly before the Chamber of Parhedrin. As explained in Halachah 8, the gate of a courtyard which leads to a dwelling requires a mezuzah. Based on this rationale, Rav Kapach asks why the gates before the Gate of Nicanor did not require a mezuzah, since they led to a gate which led to a dwelling.
and those8the other six gates to the Temple Courtyard further within,9The Kessef Mishneh and others note that the Rambam's text differs from his source (Yoma, loc. cit.), which reads "the Gate of Nicanor and the Chamber of Parhedrin, which was further within." He does explain, however, that the Rambam's version is acceptable: Since all these gates lead to the Chamber of Parhedrin, they therefore require a mezuzah.
Rav Kapach supports this interpretation, noting that the Chamber of the Hearth also served as a dwelling for the priests, and hence, the gate to it would require a mezuzah. According to this interpretation, this gate is also included, while according to our text of the Talmud, it is not.
and the entrance to the Chamber of Parhedrin,10This term means "officer of the king," and was used as a derisive reference to the High Priests of the Second Temple period, who were not righteous and would purchase this position from the ruling authorities for lavish bribes (Yoma 8b). because this chamber served as a dwelling for the High Priest during the seven days11Note Yoma 10b, which states that the obligation to place a mezuzah on the gate of Nicanor and the Chamber of Parhedrin applies only during these seven days and not throughout the entire year. Nevertheless, since as stated in Chapter 5, Halachah 11, one should not remove a mezuzah after leaving a dwelling, the mezuzah should remain there (Rav Kapach). when he was separated [from his home in preparation for the Yom Kippur service].12See Yoma 2a, Hilchot Avodat Yom HaKippurim 1:3.

הלכה ז
בֵּית הַתֶּבֶן בֵּית הַבָּקָר בֵּית הָעֵצִים בֵּית אוֹצָרוֹת פְּטוּרִין מִן הַמְּזוּזָה, שֶׁנֶּאֱמַר בֵּיתֶךָ, בֵּיתְךָ הַמְיֻחָד לְךָ, פְּרַט לְאֵלּוּ וְכַיּוֹצֵא בָּהֶן. לְפִיכָךְ רֶפֶת הַבָּקָר שֶׁהַנָּשִׁים יוֹשְׁבוֹת בָּהּ וּמִתִקַשִּׁטוֹת בָּהּ חַיָּבוֹת בִּמִזוּזָה שֵׁהֲרֵי יֵשׁ בָּהּ יִחוּד לְדִירַת אָדָם. בֵּית שַׁעַר אַכְסַדְרָה וּמִרְפֶּסֶת וְהַגִּנָּה וְהַדִּיר פְּטוּרִין מִן הַמְּזוּזָה מִפְּנֵי שֶׁאֵינָם עֲשׂוּיִין לְדִירָה. אִם הָיוּ בָּתִּים הַחַיָּבִין בִּמְזוּזָה פְּתוּחִין לִמְקוֹמוֹת אֵלּוּ חַיָּבִין בִּמְזוּזָה:
כסף משנה
7.
A storage house for straw, a barn for cattle, a woodshed, or [other] storage rooms1Rav David Arameah notes that there are commentaries who point to a contradiction between these statements and Hilchot Melachim 7:5, where the Rambam states that a soldier who is excused from the battlefield for building a new house (see Deuteronomy 20:5), is released for constructing one of these structures.
He explains, however, that the Rambam's phraseology clearly indicates how this difficulty can be resolved. In Hilchot Melachim, the Rambam states that these structures are "fit to dwell in." In this halachah, he states that they are not "set aside for their use."
A house requires a mezuzah only when a person dwells in it. Accordingly, since these structures are not used for that purpose, they do not require a mezuzah. To receive an exemption from military service, all that is necessary is to build a house "fit to dwell in." Since it is possible to use these structures for that purpose, the exemption is granted.
do not require a mezuzah [as can be inferred from Deuteronomy 6:9, which requires that a mezuzah be placed on] "your homes"2i.e., a house which is set aside for your use - i.e., for human habitation. This principle is not accepted by all authorities. Based on the opinion of the Tur and others, the Shulchan Aruch (Yoreh De'ah 286:1-2) requires that a mezuzah be affixed to such structures. - i.e., a house which is set aside for your use - thus excluding the above and their like.3provided they are not also used as dwellings by humans.
Therefore, [if] a barn [is also used] by women as a dressing room,4The Shulchan Aruch (Yoreh De'ah 286:2) emphasizes that if the women stand there naked, it is improper for a mezuzah to be affixed. it requires a mezuzah, since it is used as a dwelling by a human being.5For this reason, a large walk-in closet requires a mezuzah. A guardhouse, an excedra, a porch, a garden, and a corral do not require a mezuzah6even if they possess roofs, four walls, and doors. Note the decisions of the Tur (Yoreh De'ah 286) and other Ashkenazic authorities, which obligate placing a mezuzah on these structures if they conform to all the other necessary requirements. since they are not dwellings.7for humans. If dwellings which require a mezuzah open up to these structures,8Based on the following halachah, this decision would apply even if these structures also lack other requirements a building must have for a mezuzah to be placed upon it. they require a mezuzah.9not only on the door between them and the dwelling, but on an entrance which leads to them from the outside (Shulchan Aruch, Yoreh De'ah 286:8).

הלכה ח
לְפִיכָךְ אֶחָד שַׁעֲרֵי חֲצֵרוֹת וְאֶחָד שַׁעֲרֵי מְבוֹאוֹת וְאֶחָד שַׁעֲרֵי מְדִינוֹת וַעֲיָרוֹת הַכּל חַיָּבִים בִּמְזוּזָה שֶׁהֲרֵי הַבָּתִּים הַחַיָּבִין בִּמְזוּזָה פְּתוּחִין לְתוֹכָן. אֲפִלּוּ עֲשָׂרָה בָּתִּים זֶה פָּתוּחַ לְזֶה וְזֶה פָּתוּחַ לְזֶה הוֹאִיל וְהַפְּנִימִי חַיָּב בִּמְזוּזָה כֻּלָּן חַיָּבִין. וּמִפְּנֵי זֶה אָמְרוּ שַׁעַר הַפָּתוּחַ מִן הַגִּנָּה לֶחָצֵר חַיָּב בִּמְזוּזָה:
כסף משנה
8.
Accordingly, gates to courtyards, gates to alleys, and gates to cities1e.g., the gates to the old city of Jerusalem and towns,2even though the areas to which they lead are not covered by roofs and are not dwellings all require a mezuzah, since houses which require a mezuzah open up to them.3Yoma 11a relates that the obligation to affix mezuzot on such structures is derived from the inclusion of the word, "And on your gates" (Deuteronomy 6:9 . This implies that even structures which are not themselves "homes" should have mezuzot on their entrances. Even when there are ten structures4We have translated the term batim loosely. Manuscript copies of the Mishneh Torah substitute the term "entrances." leading one to each other,5For example, a gate to a courtyard opens to a gate to an alleyway, which leads to a further alleyway, which leads to a courtyard.... should the innermost one6meet the ten conditions mentioned in Halachah 1 and thus require a mezuzah, they all require [mezuzot].7because of it. Therefore, [our Sages] stated: A gate which opens up from a garden to a courtyard requires a mezuzah.8The Rambam rarely mentions references to any source other than the T'nach. In this instance when he does, the definition of the source to which he refers is a matter of question.
Most commentaries cite the Rambam's source as Menachot 33b. The passage there, however, speaks of a gate leading from a room to a garden or from a room to a courtyard. The Kiryat Melech cites a reference in Chapter 2 of the tractate of Mezuzah, which describes precisely the situation mentioned by the Rambam.

הלכה ט
בֵּית הַכִּסֵּא וּבֵית הַמֶּרְחָץ וּבֵית הַטְּבִילָה וּבֵית הַבֻּרְסְקִי וְכַיּוֹצֵא בָּהֶם פְּטוּרִין מִן הַמְּזוּזָה לְפִי שֶׁאֵינָן עֲשׂוּיִין לְדִירַת כָּבוֹד. סֻכַּת חַג בֶּחָג וּבַיִת שֶׁבַּסְּפִינָה פְּטוּרִין מִן הַמְּזוּזָה לְפִי שֶׁאֵינָן עֲשׂוּיִין לְדִירַת קֶבַע. שְׁתֵּי סֻכּוֹת שֶׁל יוֹצְרִים זוֹ לְפָנִים מִזּוֹ הַחִיצוֹנָה פְּטוּרָה מִן הַמְּזוּזָה לְפִי שֶׁאֵינָהּ קְבוּעָה. הַחֲנֻיּוֹת שֶׁבַּשְּׁוָקִים פְּטוּרִין מִפְּנֵי שֶׁאֵינָן קְבוּעִים לְדִירָה:
כסף משנה
9.
A toilet, a bathhouse, a mikveh,1even when used only for the purpose of ritual immersion a tannery,2which is characterized by a foul smell, since feces are often used in the processing of leather. and the like, do not require a mezuzah, since they do not constitute a dignified dwelling.3Yoma 11b explains that this exclusion is implied by the commandment to place a mezuzah on our "homes." Only a dignified dwelling, like a home, requires a mezuzah.
A sukkah on the holiday of Sukkot,4If, however, one dwelled in such a structure for the entire year, a mezuzah would be required. and a house on a ship5Although the commentaries accept this law in principle, they question the Rambam's source. Among the possibilities offered are the Midrash Tannaim, Parashat Va'etchanan, and the Jerusalem Talmud, Megillah 4:12.
The latter source compares tefillin to mezuzah and explains that the mitzvah of tefillin has an advantage, because it is fulfilled by those who travel in the desert or journey upon the sea. From this, one can conclude that the mitzvah of mezuzah is not fulfilled at sea.
do not require a mezuzah, for they do not constitute a permanent dwelling.6The same principle applies to other dwellings of a temporary nature. Based on this principle, the Birchai Yosef (Yoreh De'ah 286) exempts patients in a hospital or inmates in prison of the obligation to have a mezuzah on their doors.
Similarly,

[With regard to] the two booths of a potter, one inside the other:7In Talmudic times, a potter would set up two booths, an inner booth, where he would live and store his belongings, and an outer booth, where he would work and exhibit his wares (Sukkah 8b). The inner booth requires a mezuzah. However, The outer booth does not require a mezuzah,8Sukkah (loc. cit.) asks: Although the outer booth is not a dwelling and, therefore, does not, in and of itself, require a mezuzah, perhaps a mezuzah should be affixed because it leads to the inner booth? The Talmud answers because it9the outer booth is not a permanent structure.10and only an entrance of a permanent nature can be considered an "entrance to an entrance" and is required to have a mezuzah (Kessef Mishneh). Note the Ra'avad and Rashi, who interpret the passage from Sukkah differently. Stores in a market place do not require a mezuzah because they are not permanently used as a dwelling.11Note the Kitzur Shulchan Aruch 11:14, which states that this law applies only to stalls used for business fairs that are left vacant after the fair is over. If, however, merchandise is continually left in a store, a mezuzah is required.

הלכה י
בַּיִת שֶׁיֵּשׁ לוֹ פְּתָחִים הַרְבֵּה אַף עַל פִּי שֶׁאֵינוֹ רָגִיל לָצֵאת וְלָבוֹא אֶלָּא בְּאַחַת מֵהֶן חַיָּב לַעֲשׂוֹת מְזוּזָה בְּכָל פֶּתַח וּפֶתַח. פֶּתַח קָטָן שֶׁבֵּין בַּיִת לַעֲלִיָּה חַיָּב בִּמְזוּזָה. חֶדֶר שֶׁבַּבַּיִת אֲפִלּוּ חֶדֶר בְּחֶדֶר חַיָּב לַעֲשׂוֹת מְזוּזָה עַל שַׁעַר הַחֶדֶר הַפְּנִימִי וְעַל שַׁעַר הַחֶדֶר הַחִיצוֹן וְעַל שַׁעַר הַבַּיִת שֶׁכֻּלָּן עֲשׂוּיִין לְדִירָה וּקְבוּעִין:
כסף משנה
10.
A dwelling1or room which has many doorways requires a mezuzah for each and every doorway,2that meets the ten qualifications mentioned above. even though one generally enters and leaves through only one of them.3Even if a doorway is never used. As long as the potential for using it exists, a mezuzah is required. If, however, the doorway is barred closed so that it will not be used, no mezuzah is necessary.
A small entrance between a dwelling and a loft requires a mezuzah.4On the surface, this statement, is unnecessary. Clearly, such an entrance would require a mezuzah. Perhaps the Rambam is implying that a mezuzah is required even though the opening lies horizontally in the roof of the house. There is a difference of opinion on this matter, and the Kitzur Shulchan Aruch 11:20 requires a mezuzah only on an entrance that stands upright. When there is a separate room in a house, or even one room which leads to another room,5This law reflects how dramatically socio-economic standards have changed. In Talmudic times and in the Rambam's era, a dwelling which had more than one large room was an unusual phenomenon. it is necessary to affix a mezuzah on the doorway to the innermost room, the doorway to the outer room, and the doorway to the house,6There is no maximum number of mezuzot in a house. since all of them are used for the purpose of dwelling and are permanent structures.7The Kessef Mishneh states that this law is self-evident, based on the Rambam's statements in Halachah 8. The commentaries explain, however, that the above halachah describes a situation where many entrances require a mezuzah because of another room. In this instance, each of the rooms itself requires a mezuzah.

הלכה יא
פֶּתַח שֶׁבֵּין בֵּית הַמִּדְרָשׁ אוֹ בֵּין בֵּית הַכְּנֶסֶת וּבֵיתוֹ אִם רָגִיל לָצֵאת וְלָבוֹא בְּאוֹתוֹ הַפֶּתַח חַיָּב בִּמְזוּזָה. פֶּתַח שֶׁבֵּין שְׁנֵי בָּתִּים הוֹלְכִין אַחַר הַצִּיר שֶׁל דֶּלֶת, מָקוֹם שֶׁהַצִּיר נִרְאֶה עִמּוֹ שָׁם קוֹבְעִים אֶת הַמְּזוּזָה:
כסף משנה
11.
When a person frequently enters and leaves through an entrance between a synagogue and a house of study1which do not require a mezuzah, as mentioned in Halachah 6 above, and his own house, that entrance requires a mezuzah.2because the fact that it is an entrance to one's own house is considered of predominant importance.
When there is an entrance between two houses,3or more particularly, between two rooms in the same house [the position of the mezuzah] is determined by the door-hinge.4This principle is called heker tzir (Menachot 33a). The mezuzah is placed on the side on which the hinge can be seen.5i.e., the side to which the door opens. This halachah is very significant with regard to contemporary homes, which possess many rooms, and it is necessary to determine the side of the entrance on which the mezuzah should be placed. The Rambam explains that this is determined by the direction to which the door opens: The mezuzah is placed on the right side of the entrance to the room to which the door opens.
The Shulchan Aruch (Yoreh De'ah 289:3) quotes the Rambam's decision. The Turei Zahav 289:4 and the Siftei Cohen 289:6 mention two other factors:a) The order in which one enters the rooms from the entrance to the house. The room which is closer to the entrance to the house is considered as leading to the room which is further removed, and the mezuzah is placed on the right side of the entrance to the latter room;
b) The importance of the rooms. The room which is less important is considered as leading into the room which is more important, and the mezuzah is placed on the right side of the entrance to the latter room.These principles are also significant if an entrance has no doors or has sliding doors. The above concepts apply only to rooms within a house. If the door leads to the public thoroughfare, the mezuzah is always placed on the right-hand side as one enters the house.

הלכה יב
וְהֵיכָן קוֹבְעִים אֶת הַמְּזוּזָה. בְּתוֹךְ חָלָל שֶׁל פָּתַח בַּטֶּפַח הַסָּמוּךְ לַחוּץ בִּתְחִלַּת שְׁלִישׁ הָעֶלְיוֹן שֶׁל גֹּבַהּ הַשַּׁעַר. וְאִם קְבָעָהּ לְמַעְלָה מִזֶּה כְּשֵׁרָה. וְהוּא שֶׁיַּרְחִיקֶנָּה מִן הַמַּשְׁקוֹף טֶפַח. וְצָרִיךְ לְקָבְעָהּ עַל יְמִין הַנִּכְנָס לַבַּיִת וְאִם קְבָעָהּ מִשְּׂמֹאל פְּסוּלָה. וּבַיִת שֶׁל שֻׁתָּפִין חַיָּב בִּמְזוּזָה:
כסף משנה
12.
Where is the mezuzah affixed? At the inside of the entrance,1Menachot 32b explains that the Hebrew uvish'arecha, translated as "on your gates," can also be rendered "within your gates." Note the commentary on Chapter 5, Halachah 8, which explains that, when there is no other alternative, the mezuzah may be affixed inside the entrance, on the back of the doorpost. within a handbreadth of the outer edge of the doorpost,2Menachot 33b gives two reasons for this position: a) so that one will encounter God's name as soon as one enters one's home;b) so that the protective influences aroused by the mezuzah will affect a greater portion of the home. at the beginning of the top third of the entrance.3Menachot 33a derives this concept from the fact that the Torah teaches the mitzvah of mezuzah directly after the mitzvah of tefillin. Just as tefillin are placed on the upper portion of one's arm, a mezuzah should be placed on the upper portion of the entrance. (Note the Nekudot HaKessef 289, who objects to this decision.) If it was affixed higher up,4Note the Ra'avad, who states that when a doorway is very high, the mezuzah should be placed at the height of one's shoulders. (See Siftei Cohen 289:4.) it is acceptable as long as it is at least a handbreadth below the lintel.5Rabbenu Asher and the Ashkenazic authorities maintain that the mezuzah may be placed next to the lintel.
It must be placed at the right-hand side6This law applies even when a house is owned by a left-handed person (Ramah, Yoreh De'ah 289:2). as one enters the house.7Yoma 11b explains that the word veitecha, "your house," can also be interpreted, "as you enter," implying that the mezuzah should be positioned as one enters a house or room. If it is placed on the left-hand side, it is invalid.8It is not considered as if one has fulfilled the mitzvah at all.
A house belonging to partners requires a mezuzah.9Yoma, loc. cit., explains that although Deuteronomy 6:9 uses the singular form for "your house," it does not exclude houses belonging jointly to many people.
The Kessef Mishneh relates that it would have been more appropriate to mention this law at the beginning of the chapter; nevertheless, the Rambam mentions it here because it is derived from the same Talmudic passage as the preceding law.
Note the Kitzur Shulchan Aruch 11:19, which states that an entrance which one shares with a gentile does not require a mezuzah.

הלכה יג
חַיָּב אָדָם לְהִזָּהֵר בִּמְזוּזָה מִפְּנֵי שֶׁהִיא חוֹבַת הַכּל תָּמִיד. וְכָל זְמַן שֶׁיִּכָּנֵס וְיֵצֵא יִפְגַּע בְּיִחוּד הַשֵּׁם שְׁמוֹ שֶׁל הַקָּדוֹשׁ בָּרוּךְ הוּא וְיִזְכֹּר אַהֲבָתוֹ וְיֵעוֹר מִשְּׁנָתוֹ וְשִׁגְיוֹתָיו בְּהַבְלֵי הַזְּמַן. וְיֵדַע שֶׁאֵין דָּבָר הָעוֹמֵד לְעוֹלָם וּלְעוֹלְמֵי עוֹלָמִים אֶלָּא יְדִיעַת צוּר הָעוֹלָם. וּמִיָּד הוּא חוֹזֵר לְדַעְתּוֹ וְהוֹלֵךְ בְּדַרְכֵי מֵישָׁרִים. אָמְרוּ חֲכָמִים הָרִאשׁוֹנִים כָּל מִי שֶׁיֵּשׁ לוֹ תְּפִלִּין בְּרֹאשׁוֹ וּבִזְרוֹעוֹ וְצִיצִית בְּבִגְדוֹ וּמְזוּזָה בְּפִתְחוֹ מֻחְזָק הוּא שֶׁלֹּא יֶחֱטָא שֶׁהֲרֵי יֵשׁ לוֹ מַזְכִּירִין רַבִּים וְהֵן הֵם הַמַּלְאָכִים שֶׁמַּצִּילִין אוֹתוֹ מִלַּחֲטֹא שֶׁנֶּאֱמַר (תהילים לד ח) ״חֹנֶה מַלְאַךְ יְיָ׳‎ סָבִיב לִירֵאָיו וַיְחַלְּצֵם״:
כסף משנה
13.
A person must show great care in [the observance of the mitzvah of] mezuzah, because it is an obligation which is constantly incumbent upon everyone.
[Through its observance,] whenever a person enters or leaves [the house], he will encounter the unity of the name of the Holy One, blessed be He, and remember his love for Him. Thus, he will awake from his sleep and his obsession with the vanities of time, and recognize that there is nothing which lasts for eternity except the knowledge of the Creator of the world. This will motivate him to regain full awareness and follow the paths of the upright.
Whoever wears tefillin on his head and arm, wears tzitzit on his garment, and has a mezuzah on his entrance, can be assured that he will not sin, because he has many who will remind him. These are the angels, who will prevent him from sinning, as [Psalms 34:8] states: "The angel of God camps around those who fear Him and protects them."

Blessed be God who offers assistance.

אהבה הלכות תפילין ומזוזה וספר תורה פרק ו
Ahavah Tefillin, Mezuzah, and Sefer Torah Chapter 6