Mounting disks without root permissions
Posted by Nick on February 26th, 2010A very common problem in a default Ubuntu installation – especially if you have windows disks in your pc – is that the system mounts disks with root permissions, which makes things a little harder. By harder I mean you can’t easily modify or delete files, etc.
The solution is easy, we need to tell Ubuntu to mount the disk using the permissions of our user account. Here is how we can do it:
Determine uid of my user
First of all we need to know the uid (user ID) of our user. Open a terminal and give this command:
id -u $USER
This will output a number(usually this will be 1000). Keep this number and let’s go to the next step:
Set fstab to mount the disk as the current user
First of all open the /etc/fstab configuration file as root:
gksu gedit /etc/fstab
You will see something like that:
UUID=3C1850B51850703E /media/disk vfat defaults 0 0
Change the defaults to this:
UUID=3C1850B51850703E /media/disk vfat user,uid=1000,utf8 0 0
Where 1000 is your actual userID. We are done, now every time you login the disk will be accessible from your account. In case your disk is NTFS this wont work, but there is another solution which is actually the simpler one:
Configuring through graphical interface
Install ntfs-config by clicking here, or by executing the above command:
sudo apt-get install ntfs-config
Then execute the program by executing:
gksu ntfs-config
Click on both the options, and you are done
Determine uid of my user
First of all we need to know the uid (user ID) of our user. Open a terminal and give this command:
id -u $USER
This will output a number(usually this will be 1000). Keep this number and let’s go to the next step:
Set fstab to mount the disk as the current user
First of all open the /etc/fstab configuration file as root:
gksu gedit /etc/fstab
You will see something like that:
UUID=3C1850B51850703E /media/disk vfat defaults 0 0
Change the defaults to this:
UUID=3C1850B51850703E /media/disk vfat user,uid=1000,utf8 0 0
Where 1000 is your actual userID. We are done, now every time you login the disk will be accessible from your account. In case your disk is NTFS this wont work, but there is another solution which is actually the simpler one:
Configuring through graphical interface
Install ntfs-config by clicking here, or by executing the above command:
sudo apt-get install ntfs-config
Then execute the program by executing:
gksu ntfs-config
Click on both the options, and you are done
Unprivileged user can not mount NTFS block devices using the external FUSE
library. Either mount the volume as root, or rebuild NTFS-3G with integrated
FUSE support and make it setuid root. Please see more information at
http://ntfs-3g.org/support.html#unprivileged