How do I change permissions on a FAT32 formatted drive?

57,241

Solution 1

vfat does not support Linux permissions. You can set permissions manually when you mount the device.

Unmount the flash drive from nautilus, but do not remove it.

sudo mkdir /media/flash
sudo mount /dev/sdb1 /media/flash -o dmask=000,fmask=111

You can possibly work around the issue if you use NTFS on the flash drive, and in that case mount it with the permissions option.

sudo mkdir /media/flash
sudo mount /dev/sdb1 /media/flash -o permissions    

With the permissions option chown and chmod should work.

See man mount

Other options might be to use ext2 on the flash drive (smaller overhead) and the fs-driver on windows

http://www.fs-driver.org/

Solution 2

FAT32 does not support Linux-like permissions.

The only possibility which comes to my mind is, to change the settings in /etc/fstab for the whole drive. On mounting, these permissions are mapped to the whole drive, but you can't distinguish between executable files, read and write permissions from file to file.

And since you need to execute a directory to enter it, you need global execute permissions. And therefore global read permissions too.

A typical entry would look like this:

/dev/pny    /media/pny  vfat    defaults,users,exec,uid=1000,gid=46 0   0

uid would be your UID (check using the command id when logged in), gid=46 is plugdev on my system, used for the hotplug daemon.

Share:
57,241

Related videos on Youtube

tucnak
Author by

tucnak

Updated on September 18, 2022

Comments

  • tucnak
    tucnak over 1 year

    I am using Microsoft Visual C++ on Windows and Qt Creator on Ubuntu. I can't change permissions on my flash drive (FAT32), even as root.

    How can I change permissions on a FAT32 flash-drive?

  • Panther
    Panther over 12 years
    If you have a mount option that works you can add an entry in fstab. help.ubuntu.com/community/Fstab
  • Kaki Master Of Time
    Kaki Master Of Time about 6 years
    is this still working ? i have a fat32 drive i am trying to build project that are on that drive and getting permission denied.
  • Panther
    Panther about 6 years
    @MedMansour - Ask a new question with the command or fstab entry you are using and the error you are getting.
  • phuclv
    phuclv over 4 years
    Unix permissions can be stored on FAT32 by using umsdos driver