4 ms·
Does systemd really hardcode "/home" rather than use the user's actual home directory?
by kps 4y ago
Does systemd really hardcode "/home" rather than use the user's actual home directory?
- teddyh 4y agoSystemd needs the common parent directory of the home directory of all users on the system, in order to protect all user home directories from services. There is no “the” user.
- kps 4y agoI did misplace the apostrophe. There is no guaranteed common parent directory of all users other than `/`.
- teddyh 4y agoSystemd wants to provide an option of limiting services from writing, and optionally also from reading, in the home directories of all users. However, there is no reasonable algorithm to discover a single common parent directory which would not also risk encompassing other directories which should not be restricted, so the hardcoded /home is used by the ProtectHome option. If you have home directories somewhere else, but want the same protection by systemd, you will have to use the InaccessiblePaths or ReadOnlyPaths option for all individual system services which you want to restrict in this manner.
- simiones 4y agoI think GP misspoke a bit, but the GGP was suggesting to let $HOME point to /home/user, but to put your actual data in /me. That way apps can "make a mess" in /home/user/.dot-files-galore, while your documents and so on are alone in /me/important-file.txt. GP then was cautioning that this leaves your most important files at the whims of Unix's simplistic user permissions model, unless you also point systemd and/or AppArmor towards /me.