Tuesday, December 29, 2009

Mount disk in non-root account

If you want to mount a device, ordinarily, you have to have a root privilege to mount and access the device by root account. But in daily use, login in by root account is danger and unnecessary. You can use sudo to access root privilege and don't need to endure the stake of damaging your computer. But it's the same situation that you need a root privilege to read/write the device. There is other way to do it. Use merely mount.

Edit /etc/fstab:
device mountpoint mounttype option ....
modify the option:
user: If you set option to user, then you can use non-root account to mount the device. To set to users means you can umount the device by other account
group: every account which have a group matching the group of the device can mount the device. So you need to use root account to change the group ownership of the device.
chown -R :group mountpoint