Cannot set "users" option with mount
Hi,
when executing mount -o users /dev/sdx /mnt and then checking applied mount options with the mount command alone (w/o any other arguments) it only implies few other options like noexec, nosuid, and nodev aside from the implicit ones rw,relatime,data=ordered but no trace of the users option itself. The absense of the option is also confirmed when I try to umount the fs with a regular user, "umount: /mnt: umount failed: Operation not permitted" appears and the fs is still mounted. Where's the problem? Thank you.
RHEL 7.2 x64 in VirtualBox
Responses
if you want to mount or umount by any users I think options has to be defined in the /etc/fstab file. try to define entries in the /etc/fstab file with users options. e.g in /etc/fstab file /dev/mapper/vg_test /soft ext4 users 1 2
David, as per the man page of mount when either "user" or "users" parameter has been passed with mount command then it would be list "noexe,nosuid,nodev" when checked with /proc/mounts output.
user Allow an ordinary user to mount the filesystem. The name of the mounting user is written to mtab so
that he can unmount the filesystem again. This option implies the options noexec, nosuid, and nodev
(unless overridden by subsequent options, as in the option line user,exec,dev,suid).
nouser Forbid an ordinary (i.e., non-root) user to mount the filesystem. This is the default.
users Allow every user to mount and unmount the filesystem. This option implies the options noexec, nosuid,
and nodev (unless overridden by subsequent options, as in the option line users,exec,dev,suid).
That means when mounted with users parameter you would get to see "noexec,nosuid,nodev" not "users"; check by in /proc/mounts file. If you don't specify "users" parameter while mounting then these option would not get apply.
Yes, adding it to fstab would make the mounting and unmounting task easy. Also, the /etc/mtab gets updated on each of these transactions.
based on the man pages
<br /> The non-superuser mounts.
Normally, only the superuser can mount filesystems. However, when fstab contains the user option on a line, anybody can mount the corresponding
system.
Thus, given a line
/dev/cdrom /cd iso9660 ro,user,noauto,unhide
any user can mount the iso9660 filesystem found on his CDROM using the command
mount /dev/cdrom
or
mount /cd
For more details, see fstab(5). Only the user that mounted a filesystem can unmount it again. If any user should be able to unmount, then use
users instead of user in the fstab line. The owner option is similar to the user option, with the restriction that the user must be the owner of
the special file. This may be useful e.g. for /dev/fd if a login script makes the console user owner of this device. The group option is similar,
with the restriction that the user must be member of the group of the special file.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
