Mounting FAT drive in Ubuntu with the right permissions

I just plugged an old harddisk with a FAT filesystem on it that was used on a windows machine mounting it to my ubuntu system and ran into a problem of managing the files on that drive. I seldomly do this and if you run into the same issues maybe the following is of help to you. But first as always a word of caution. If you follow the steps I describe you do this at your own risk. I will not be responsible or liable for any damage or loss.


The symptoms were that I was able to see all data but was not able to delete or even move files.

[bash]>ls -l
-rwxr-xr-x 1 root root 113846 Apr 25 2006 TrekStor.ico
drwxr-xr-x 4 root root 32768 Mai 9 2009 Video
-r-xr-xr-x 1 root root 57636 Jul 18 2010 cache_0001.xml[/bash]

Initially I had this in the fstab file. The /dev/sdb1 is the device I mounted and the /media/sdb is the place where I mounted it in the linux file system as a FAT drive. Maybe you have something similar.

[bash]/dev/sdb1                /media/sdb     vfat    rw,user    0    0[/bash]

Thinking into the symptoms I realized that I am mounting a filesystem that does not know user rights into a file system that does. One might think that the “rw” option in the fstab should be sufficient but it is not.

The solution

To come to the point. I wanted the files of the mounted FAT drive to belong to my group and I wanted full read write execute rights on the file. In addition I wanted them to be only invisible for anybody else on the machine. To achieve this, first you need to find out your groups ID by issuing this command. (It shows my return values, yours may look different)

uid=1000(georg) gid=1000(georg) Gruppen=1000(georg),….[/bash]

So now we know that (in my case) the group ID is 1000 we will enter this together with a mask into the fstab


by issuing.

[bash]sudo gedit /etc/fstab[/bash]

And then adding a line looking something like this.

[bash]/dev/sdb1 /media/sdb vfat rw,user,gid=1000,umask=0007 0 0[/bash]

Now you unmount then mount again, which will only work if you are no longer using the files on that mounted drive. So please close editors or cd out of the directory.

>sudo umount /dev/sdb1
>sudo mount /dev/sdb1

And if you now look at the files on the drive you see that the permissions are set properly for you to change whatever files you want to change.

[bash]>ls -l
-rwxrwx— 1 root georg 113846 Apr 25 2006 TrekStor.ico
drwxrwx— 4 root georg 32768 Mai 9 2009 Video
-r-xr-x— 1 root georg 57636 Jul 18 2010 cache_0001.xml[/bash]

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting this form, you accept the Mollom privacy policy.