Tuesday 20 April 2010

MOUNT USB STICK WITH READ AND WRITE PERMISSIONS FOR A USER

Important: As most up-to-date Linux Distributions support Hotplug for USB removable media you might want to try to plug your USB stick to the system and see if it gets detected and mounted automatically.


If you just mount the usb stick without special options it is only read/writable for root.

To read/write enable the stick for a different user use the following:

mount /dev/sda1 /mnt/usbstick/ -o uid=500


User ID 500 is on many systems the default ID for your first user. You might want to switch it to another user (take a look at the ID in /etc/passwd) or set permissions for a group. For a group use "gid" instead of "uid".

It also might be handy to add a line like the following to your /etc/fstab file (where you can specify some default mount information):

/dev/sda1 /mnt/usbstick vfat noauto,users,exec,rw,umask=000 0 0


This allows the members of the group "users" to mount the device /dev/sda1 (which represents the usb stick on my system) with read and write access. Another advantage of this line in your /etc/fstab is that for some graphical environments (e.g. KDE) read the file at startup and present you a corresponding icon to mount and unmount the device automatically on your desktop.

No comments:

Post a Comment