$ mount -a
mount: only root can do that
This command tries to mount all entries in /etc/fstab
, and since not all of them have the user
/users
option, that will not be possible for a user that has no admin privileges.
$ mount /dev/sr0 /media/dvd
mount: only root can do that
This specifies both the device to be mounted and the mountpoint, effectively not requiring /etc/fstab
at all (as the filesystem-specific default mount options will be assumed if you don't specify them on the command line, and filesystem type autodetection will be performed if you don't specify the filesystem type). This is powerful enough to trivially open all kinds of security holes, and so non-root users are not authorized to use this form of the mount
command at all.
When using mount
as a non-root user to mount an admin-prepared /etc/fstab
entry that has the user
/users
mount option, you must specify either only the device or only the mountpoint. This will make the mount
command look up the missing parts of the full command line in /etc/fstab
, and so the command will see that a non-root user has been authorized to perform that specific mount.
So either of these mount
commands and only these would allow the non-root user to mount the CD/DVD, given the /etc/fstab
line specified in the OP:
mount /dev/sr0
or
mount /media/dvd
When used by a non-root user, the mount
command will also check that the user will be able to access both the device and the mountpoint, and will reject the command if this is not true. Often the login session set-up (usually in the form of PAM modules) grants the user access to removable devices when the user is logging in locally. This can be done either by granting a locally-logged-in user some extra group memberships (that fit in with the device permissions configured by udev rules), or on modern Linux distributions, by having the devices tagged in udev with a TAG+="uaccess"
, which will trigger the session setup to add an ACL to those devices on a local login, and to remove it on logout.
If a non-root user needs to be authorized to mount removable devices over a SSH session or other remote login, many distributions provide pre-configured user groups for the purpose (e.g. the cdrom
or plugdev
groups).
GUI environments usually have their own mechanisms for allowing users to mount removable media, with their own restrictions. At the time of this writing, udisksd
is a commonly-used system-level component for this. It communicates over the system D-Bus with the udisksctl
command-line tool or any number of GUI file managers and removable media access tools.