mount-tool: override mode of --tmpfs mounts to (rwxrwxrwx & ~umask)
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 21 Aug 2023 17:32:21 +0000 (19:32 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 22 Aug 2023 10:31:45 +0000 (12:31 +0200)
commit9269296df05a724c6b121bcbb0b420c8b4088f2f
treef20303e54689454a9fe791bfa9c16f5b95aefc51
parent8980a53f24b5b5d43be947f4f959924d6b91fbd1
mount-tool: override mode of --tmpfs mounts to (rwxrwxrwx & ~umask)

The kernel default for tmpfs mounts is rwxrwxrwt, i.e. world-writable with the
sticky bit set. This makes sense for /tmp and /var/tmp, but less so for other
directories. Users will not use systemd-mount to mount /tmp and /var/tmp, so
the existing behaviour is surprising. The defaults are overriden to the
same defaults we use for "internal tmpfs mounts", i.e. no sticky bit, nosuid,
nodev, and limits of size=10%, nr_inodes=400k.

--tmpfs is new, so we can modify the behaviour without breaking compatibility.
man/systemd-mount.xml
src/mount/mount-tool.c