]> git.ipfire.org Git - thirdparty/util-linux.git/commit - sys-utils/umount.8
mount: no exit on EPERM, continue without suid
authorKarel Zak <kzak@redhat.com>
Tue, 19 Nov 2019 13:58:20 +0000 (14:58 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 19 Nov 2019 13:58:20 +0000 (14:58 +0100)
commit6497f2d99e9cabee3531e644ba4dcffd14532200
treea09a1ba874c5ad99cc4471a90b19803f75efb09c
parent916a3f8d298a05678016d81548029270b27ee5f3
mount: no exit on EPERM, continue without suid

The current libmount assumes that mount(8) and umount(8) are suid
binaries. For this reason it implements internal rules which
restrict what is allowed for non-root users. Unfortunately, it's
out of reality for some use-cases where root permissions are no
required. Nice example are fuse filesystems.

So, the current situation is to call exit() always when mount, umount or
libmount are unsure with non-root user rights. This patch removes the
exit() call and replaces it with suid permissions drop, after that it
continues as usually. It means after suid-drop all depend on kernel
and no another security rule is used by libmount (simply because any
rule is no more necessary).

Example:

old version:
   $ mount -t fuse.sshfs kzak@192.168.111.1:/home/kzak /home/kzak/mnt
   mount: only root can use "--types" option

new version:
   $ mount -t fuse.sshfs kzak@192.168.111.1:/home/kzak /home/kzak/mnt
   kzak@192.168.111.1's password:

   $ findmnt /home/kzak/mnt
   TARGET         SOURCE                        FSTYPE     OPTIONS
   /home/kzak/mnt kzak@192.168.111.1:/home/kzak fuse.sshfs rw,nosuid,nodev,relatime,user_id=1000,group_id=1000

   $ umount /home/kzak/mnt
   $ echo $?
   0

Note that fuse user umount is supported since v2.34 due to user_id= in
kernel mount table.

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/docs/libmount-sections.txt
libmount/src/context.c
libmount/src/libmount.h.in
libmount/src/libmount.sym
sys-utils/mount.8
sys-utils/mount.c
sys-utils/umount.8
sys-utils/umount.c