1

I appreciate that this has been asked time and time again, but I would like some clarification on fstab permissions. Unfortunately, I am unable to add comments to existing threads, as I don't have enough reputation (I must be missing the point of this restriction!).

Anyway, I have formatted a partition on a new disk as FAT, and have found that I cannot write to it. I understand that I need to change my fstab entry to include 'options', which in turn require UID and GID. All the instructions I have read direct me to use 'a' users GID, and they all appear to instruct the 'primary group' for a user (as shown in /etc/passwd or 'id -g').

I must admit, I don't undertand the concept of a primary group, other than a user must be assigned to at least one group. My undertanding of using GID and UID within fstab, is that it assigns the user and group ownership of the mount.

I would like all members of 'another' group, such as 'adm' to have write access to the mount (being shared by samba). Instead of using the primary group for a discrete user/UID, can I use a different (any other) groups GID? This seems a logical thing to do, so perhaps I have completely misunderstood these options entirely.

Many thanks

Chrizk
  • 13
  • It looks like the first post ignore GID, the second ignores UID and GID, and the third is the mount options, rather than fstab. I guess there are many ways to approach this, but I am coming to the conclusion that the posts that specify using the primary group of the user simply do not consider using other groups, although it may be perfectly 'legal'. However, I do wonder if the mount ownership/permissions are totally relevant, as the option 'umask' indicates that the permissions are set for 'all users' no matter which GID is used. Perhaps this is the underlying question to be answered. – Chrizk Apr 18 '18 at 09:19
  • The same mount options apply via the mount command and via /etc/fstab. I think that if you set the permissions to work for 'all users', things will work as you wish. At least you can try (I think easiest by testing with sudo mount ... command lines, and later enter the options into /etc/fstab). – sudodus Apr 18 '18 at 10:46
  • 1
    "Same mount options" is interesting, and your suggestion of testing using mount is useful (thank you). I have applied 'user, umask=000' and everything works. I may revisit the security implications and implement fmask and dmask in the future (and maybe a credentials file) – Chrizk Apr 19 '18 at 09:16
  • 1
    References for people viewing this thread; https://help.ubuntu.com/community/Fstab , https://wiki.ubuntu.com/MountWindowsSharesPermanently . The help page states that NTFS/FAT permissions are set using masks, and the wiki page states the Linux user specified by the UID is the owner of the mounted share, allowing them to rename files (and I assume other file operations). – Chrizk Apr 19 '18 at 09:25
  • Thanks for sharing your progress :-) I think it will be useful for several other users. – sudodus Apr 19 '18 at 10:42

1 Answers1

0

No, you cannot have more than one group assigned to a directory/file in Unix. The same applies to a mount point.

  • Hi, thanks for the quick reply, but I believe you are referring to adding multiple groups to a user. My question is specifically about the GID within an fstab line/statement. All threads I have seen instruct to idenitify the primary group of a user. – Chrizk Apr 18 '18 at 08:59
  • Ah, I see why I confused things "can I just add 'another' groups GID (with any existing UID)", I meant use a different GID to the primary group of the user. I will try to amend the original question for future reference. Sorry for the inconvenience. (the comments are leading me away from the importance of the GID, as I now have an undersanding that the masks give permissions to attached users. I guess the ownership is only relevant to the maintenance of the mount point) – Chrizk Apr 19 '18 at 08:57