Fstab permissions

I created a partition called sdb1 in fat32 and created 3 folders within a main folder however I wanted the 3 folders to have different permissions. I tried to make an ana folder with all permissions, the marco with permissions for the user and group to execute and the opencloud with permissions for everything but the group. However the end result was that all the folders had all permissions. I dont understand what i am doing wrong. Disk partition

Fstab file config

Final result

Answers 1

  • First, you are using the FAT32 filesystem, which does not support Unix-style file ownerships and permissions. But because Unix-like operating systems assume that all files must have an owner, group and permissions, the vfat filesystem driver fakes it - by assigning all files and all directories in the filesystem the same permissions.

    You can adjust the fake permissions created by the filesystem driver: by using the dmask mount option you can set the permissions for all directories on the filesystem, and with fmask for all regular files respectively. These options are specific to the vfat filesystem driver, and won't work with just any filesystem. The drivers for other filesystems that don't natively support Unix-style ownerships/permissions may have similar mount options, or some other ways to adapt the filesystem to Unix-like conventions.

    If you need to be able to assign different permissions to different files and/or directories within a single filesystem, FAT32 (or any FAT subtype really) is a wrong filesystem type for that.

    Second, you haven't really made three separate folders: you've actually mounted one filesystem (on partition /dev/sdb1) to three separate locations. So if you created a file to /data/ana, the same file would be immediately accessible at /data/marco and /data/opencloud too.

    Mounting the same filesystem to multiple locations in a single system simultaneously used to be impossible until relatively recent times (roughly, about the same time the container technology was being developed; it might have been a side effect of that). As such, the vfat filesystem driver apparently cannot handle multiple mounts of the same filesystem with different permission options. It looks like /data/ana might be the most recent mount, so it looks like the most recent set of mount options for the filesystem takes effect on all mounts (think "views") of that filesystem.


Related Questions