Use "mount -o" with a non-root user

Given the line you’ve added to /etc/fstab, the following should work:

USER=UN mount /srv/mount_destination

(replacing UN with the appropriate value). This will use the file system, target and options specified in /etc/fstab, the username stored in the USER environment variable, and prompt for a password. If you want the ro option, you should add that to /etc/fstab too (noauto,user,ro).

The -o limitation (only root can specify it) is in place to protect the system: the administrator can set up whatever options are necessary, either directly using -o or using /etc/fstab; users can only cause user-controllable file systems to be mounted or unmounted, without specifying options, because file system options allow a number of hostile scenarios. As a result, some file systems support other ways of setting certain options, such as the USER environment variable used above with CIFS.

mount.cifs (which is used by mount -t cifs) supports a number of other settings which may be relevant. The multiuser option in particular can be very useful.

Tags:

Mount

Fstab