How to change permissions on vfat partition? [duplicate]

Is it possible to change the permissions on a vfat partition in Ubuntu?

Nothing has worked.. tried entry in /etc/fstab, tried to chown, the only way I can grant access to this location is by giving the application ownership and that is bad.


Solution 1:

You have to set the permissions when you mount the partition, and you can do that with umask.

Mount a FAT32 partition in a pendrive with read/write/execute permissions for everybody:

Assumption: the pendrive is seen as /dev/sdx, replace x with the actual drive letter, for example b: /dev/sdx1 ---> /dev/sdb1

Comment: text after the # character is a comment, not used as a command)

sudo mkdir -p /mnt/sd1  # only if you want a new mountpoint
sudo umount /dev/sdx1   # only if already mounted (but with bad permissions)

sudo mount -o rw,users,umask=000 /dev/sdx1 /mnt/sd1  # mount

echo 'Hello World' > /mnt/sd1/hello.txt  # test writing
cat /mnt/sd1/hello.txt                   # test reading

Edit: I think you used the correct spelling in the command line, but if you used unmask, please try umask, because linux is fuzzy about correct spelling.

The command line that I suggest works for me in Lubuntu 16.04.1 LTS (and should work in all current Ubuntu flavours including standard Ubuntu). So I don't know why it does not work for you.

Maybe you can reboot your computer and try again. Copy and paste the command lines from my answer to get them correct. Only modify the drive letter x to point to the pendrive (for example b or c). Maybe it works this second time.

If not, maybe the file system is not FAT32, but some other version of FAT, for example exfat. Please check with

sudo parted -ls  # ... space minus ell ess

If exfat it might help to install some extra program packages, see for example

unixnme.blogspot.se/2016/04/how-to-mount-exfat-partition-in-ubuntu.html

sudo apt-get install exfat-fuse exfat-utils

Solution 2:

Vfat does not support permissions. The most you can do is specify options when mounting it