How do I let ordinary users mount floppies, CDROMs and other removable media?
Ordinary users can be permitted to mount devices. Here is how:
-
As root set the sysctl variable vfs.usermount to 1.
# sysctl -w vfs.usermount=1
-
As root assign the appropriate permissions to the block device associated with the removable media.
For example, to allow users to mount the first floppy drive, use:
# chmod 666 /dev/fd0
To allow users in the group operator to mount the CDROM drive, use:
# chgrp operator /dev/cd0c # chmod 640 /dev/cd0c
-
Finally, add the line vfs.usermount=1 to the file /etc/sysctl.conf so that it is reset at system boot time.
All users can now mount the floppy /dev/fd0 onto a directory that they own:
% mkdir ~/my-mount-point % mount -t msdos /dev/fd0 ~/my-mount-point
Users in group operator can now mount the CDROM /dev/cd0c onto a directory that they own:
% mkdir ~/my-mount-point % mount -t msdos /dev/cd0c ~/my-mount-point
Unmounting the device is simple:
% umount ~/my-mount-point
Enabling vfs.usermount, however, has negative security implications. A better way to access MSDOS formatted media is to use the mtools package in the ports collection.