My intent is to set up a drive that any user can read to, write from, and execute on. Moreover, the users must be able to use the drive at the same time.

I have my fstab entry set up like this:

/dev/sdc1     /media/data2     auto    rw,users,noauto, exec     0    0

The drive is 1TB and formatted as FAT32. Right now, any user can mount the drive. A user that has mounted the drive may read, write, and execute, but if another user logs on and attempts to write or execute using this drive while the first user has mounted it, they are disallowed!

The second user may unmount the drive and then mount and use it as desired, but this would have consequences for the first user.

How do I set it up so that multiple users may use the drive at the same time?

  • is there a special reason that the users have to be able to mount and unmount? if not you should try using nouser instead of users. – Baarn May 30 '12 at 21:07

Either you follow the advice in my comment and automount the drive at startup and disallow mounting and unmounting by users by changing users to nouser

The other possibility would be to assign all files on the drive certain gids. (group-ids)

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.

source man mount

So as an example, to assign everything on the drive the root uid and gid use something like uid=0,gid=0,umask=000 this should make everything on the drive be owned by root, but still be usable through the open public umask.

If you want more control, you should add the users that are allowed to use the content of the drive to a certain group and look up its id, then you do like above but replace the gid by its value (say 123 here) uid=0,gid=123,umask=007. this should make the files (and directories) owned by user root and the group that belongs to 123, makes it readable, executable and writable to them, but they are locked to the public.

Never the less you should actually read the manpages about mount, groups and umask, because I cannot guarantee for the above to work. But I still hope I could push you into the right direction.

  • Didn't know about umask and others, and it bothered me a lot. Default was 777 and all files were green in bash (executable for all). Thanks a lot. – Mohammad Kholghi Sep 1 '19 at 8:02

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.