Contents
Why does mount require root?
If a user has direct write access to a block device, and can mount that block device, then they can write a suid executable to the block device, mount, it, and execute that file, and thus, gain root access to the system. This is why mounting is normally restricted to root.
Does Mount need Sudo?
Mounting requires sudo, but sudo inflicts root ownership on the target, which makes it inaccessible to a non-root user, short of using sudo over and over again.
Can a superuser Mount and unmount a filesystem?
Normally, only the superuser can mount filesystems. However, when fstab contains the user option on a line, anybody can mount the corresponding system. Or if you want any user to mount/unmount the drives use users instead: Only the user that mounted a filesystem can unmount it again.
Why does the mount command require root privileges?
To be clear, the mount () system call always requires root. suid utilities can become root and allow non root users to mount, and if the mount command is installed suid, then it will do this based on the user flag in fstab.
How to create files as root in mounted volume-stack?
The problem is that the file is created as owned by root. How can I arrange it so that the file is created owned by the same user as I run docker with? Then check if a docker run -v /home/matt/build:/build build-rpm mounts the shared folder in /build as auser. If you chown the volume (on the host side) before bind-mounting it, it will work.
Can a superuser mount an external drive as root?
Anyhow, deleting /media/username let it be recreated automatically upon the next plug-in with the right permissions. Normally, only the superuser can mount filesystems. However, when fstab contains the user option on a line, anybody can mount the corresponding system. Or if you want any user to mount/unmount the drives use users instead: