2

I trying to figure out what the following Mountoption for (v)FAT exactly does (in Linux):

allow_utime=### -- This option controls the permission check of mtime/atime.

              20 - If current process is in group of file's group ID,
                   you can change timestamp.
               2 - Other users can change timestamp.

             The default is set from `dmask' option. (If the directory is
             writable, utime(2) is also allowed. I.e. ~dmask & 022)

             Normally utime(2) checks current process is owner of
             the file, or it has CAP_FOWNER capability.  But FAT
             filesystem doesn't have uid/gid on disk, so normal
             check is too unflexible. With this option you can
             relax it.

[source]

Question: What does this (above) mean?

Trying to look it up I endend with the C code which doesn't help me a lot, so neither this nor man 2 utime (as mentioned) help me much at the moment. I'd love to use the source

From utime: The utime() system call changes the access and modification times of the inode specified by filename to the actime and modtime fields of times respectively.

I read this as: Enable to change timestamps. Super Extra Kudos for you who can give an actual example of how to use this Mountoption (allow_utim)

2

On a filesystem that supports normal Unix file attributes, each file has a user who is designated as owner. Only the owner of a file may change its timestamps with utime. Other users aren't allowed to change timestamps, even if they have write permission.

FAT filesystems don't record anything like an owner. The FAT filesystem driver pretends that a particular user is the owner of every file: either the user doing the mounting or the user given by the uid parameter. Using the normal rules, only that user is allowed to change timestamps. Files also have an owning group, determined by the gid parameter.

FAT filesystem don't record Unix file permissions, so the driver makes them up. It assigns permissions based on the umask, fmask and dmask parameters, so all directories and all regular files have the same permissions.

When users other than the owner have write access to the filesystem, it would make sense that they'd be allowed not only to modify regular files and directories, but also file metadata. The main metadata of interest on a FAT filesystem is the timestamps on files. Normally, only the owning user can modify timestamps. By passing the allow_utime mount option, you can allow other users to change timestamps as well. For example, to allow the group foo to modify anything in the filesystem, and allow others to read but not write, you would pass the parameters

gid=foo,umask=002,allow_utime=20

(this is actually the default value for allow_utime based on the umask).

  • So this is for "translating" permissions between UNIX and … erm … DOS? Say: I set the permissions for the file system in Linux for later use in DOS (or anyhow: Microsoft®) that are somehow als valid in Linux. Is this about the right direction? – erch Sep 28 '14 at 21:56
  • 1
    @erch There's no translation of permissions. DOS doesn't have permissions, FAT doesn't have permissions. Windows has permissions, and NTFS has permissions, but I don't talk about NTFS in this answer. – Gilles Sep 28 '14 at 21:59
  • you clearly don't talk about NTFS, right :) So this options are what for? (I really wonder if it's just me or…) – erch Sep 28 '14 at 22:04
  • @erch I don't understand your comment. – Gilles Sep 28 '14 at 22:05
  • I think to get it that far: "FAT has no permissions. Checked. This options sets permissions for FAT. Wait, what?!" This option allows users others than the one mounting the FAT Volume to change timestamps (on that FAT Volume) - is that right? – erch Sep 28 '14 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.