The filesystem as stored on disk doesn't store all file permissions, but the filesystem driver has to provide them to the operating system since they are an integral part of the Unix filesystem concept and the system call interfaces have no way of presenting that the permissions are missing.
Also consider what would happen if a file didn't have any permission bits at all? Would it be the same as 0777
, i.e. access to all; or the same as 0000
, i.e. no access to anyone? But both of those are file permissions, so why not show them? Or do something more useful and have a way to set some sensible permissions.
So, the driver fakes some permissions, mostly same ones for all files. The permissions along with the files' owner and group are configurable at mount time. These are described under "Mount options for fat" in the mount(8) man page:
Mount options for fat
(Note: fat is not a separate filesystem, but a common part of the msdos, umsdos and vfat filesystems.)
uid=value
and gid=value
Set the owner and group of all files. (Default: the UID and GID of the current process.)
umask=value
Set the umask (the bitmask of the permissions that are not present). The default is the umask of the current process. The value
is given in octal.
dmask=value
Set the umask applied to directories only. The default is the umask of the current process. The value is given in octal.
fmask=value
Set the umask applied to regular files only. The default is the umask of the current process. The value is given in octal.
Note that the one useful permission the FAT filesystems store is the read-only -bit, and if you run chmod ugo-w file
, the read permissions on it will disappear.
That's also probably the reason that the above options take their values as permissions to masks away, so fmask=0133
would result in all files having all the x
permissions removed and w
removed from the group and others. The files would then have the permissions 0644
/rw-r--r--
or 0444
/r--r--r--
, depending on if the read-only bit is cleared or set.
Also, the defaults are inherited from the process calling mount()
, so if you call mount
from the command line, the shell's umask
will apply.