Yuma 10a: Rabbi Yehuda holds that a succah on Succos is considered a house for the purposes of maaser (i.e. if one brings in produce to a succah, it becomes obligated in maaser). The Sages hold it does not. Rabbi Yehuda holds that a succah must participate in an eiruv and must have a mezuzah.
Rambam, Hilchos Mezuzah 6:9: A succah on Succos and a house on a boat are exempt from mezuzah because they are not made for permanent residence.
Rambam, Hilchos Berachos 11:2: There are some mitzvos that are not obligatory, but similar to optional, for example, mezuzah and building a fence around one’s roof. A person is not obligated to live in a house requiring a mezuzah in order to make a mezuzah; if he wishes, he may live his entire life in a tent or a boat. And he is not obligated to build a house in order to make a fence around his roof.
יומא י ע”א סוכת חג בחג רבי יהודה מחייב וחכמים פוטרים. ותני עלה ר’ יהודה מחייב בעירוב ובמזוזה. רמב”ם הלכות מזוזה פרק ו הלכה ט: סוכת החג בחג ובית שבספינה פטורין מן המזוזה לפי שאינן עשויין לדירת קבע. וכן הובא ביו”ד רפ”ו סעיף יא.
רמב”ם הלכות ברכות פרק יא הלכה ב: ויש מצוה שאינה חובה אלא דומין לרשות כגון מזוזה ומעקה שאין אדם חייב לשכון בבית החייב מזוזה כדי שיעשה מזוזה אלא אם רצה לשכון כל ימיו באהל או בספינה ישב, וכן אינו חייב לבנות בית כדי לעשות מעקה.
The Steipler was once asked whether one need put a mezuzah on the doorways of a yacht. The Steipler searched the poskim in Hilchos Mezuzah and could not find a source. Rav Chaim Kanievsky asked his father what he was looking for, and when he heard, Rav Chaim said that the Rambam writes explicitly that one doesn’t need to have a mezuzah on a boat. “But I just reviewed the Rambam’s Hilchos Mezuzah and it’s not there,” said the Steipler. Rav Chaim agreed that it is not there, however, the Rambam mentions in passing, as an example, in Hilchos Berachos 11:2, that if one chooses to life his whole life in a boat, he will not need a mezuzah.
Source: FJJ March 24, 2022, p. 12.
[The Steipler certainly saw the Rambam in Hilchos Mezuzah stating that a boat does not require a mezuzah. However, the Rambam adds “because they are not made for permanent residence”. Apparently the questioner here wanted to live in his yacht all year. The Steipler thought that perhaps the Rambam only meant that a boat is exempt when one lives in it temporarily, like a succah used only on Succos. It is only in Hilchos Berachos that the Rambam says explicitly that even if one lives his whole life in a boat, he will not need a mezuzah.
Why is the boat different from the succah? The answer may be that if one lives all year in a succah, he will certainly make it waterproof, and then it will become a regular house, not a succah. But the yacht will remain the same yacht even when used all year. The aspects of the yacht that make it unfit for permanent residence (the rocking of the boat etc.) will still be present.
Interestingly, the Rambam’s source for this halacha about boats – temporary or permanent – is unknown to us. The Bach says that he saw someone write that it is a Tosefta, but we don’t have it in our Tosefta. The footnote on the Tur Hashalem says that it is found in a version of the Gemara quoted in Midrash Hagadol, a 14th century Yemenite work, on Vaeschanan, but the author of that work may have taken it from the Rambam.]