Score:1

Is UID required when providing a GID in an fstab entry for an ntfs drive?

us flag

I have an Ubuntu Server 20.04 installed on a Raspberry Pi 4. I am trying to mount a hard drive that should be accessible by two different samba users (user1, uid=1001 and user2, uid=1002). I created a group that contains these two users (gid=1007) and added the following entry in fstab

LABEL=WINHDD /mnt/winhdd ntfs-3g defaults,nls=utf8,dmask=077,fmask=177,gid=1007 0 0

My smb.conf has the share listed as

[winhdd]
    path = /mnt/winhdd
    read only = no
    browseable = no

However, I am unable to access the samba drive (get the error: Windows cannot access \piserver\winhdd, when I click on the mapped network drive icon) from a Windows PC. Providing uid works (with the same masks as shown above), but then the other user cannot access the drive. How do I successfully grant two samba users access to the share?

PS: I saw several questions and guides where the fstab entry contains both uid and gid, often identical, except in this question, but when I use both uid and gid, I am unable to connect with either user, as if I didn't provide a uid at all.

Thanks!

Prateek Verma avatar
us flag
I found the problem. In hindsight, however, the title is not what the real problem was. Yes, it is okay to provide gid only. In that case uid (owner of the mount) will default to root. My problem was that the dmask and fmask were set wrong, disallowing group users from accessing the mount. Setting dmask=007,fmask=117 (equivalent to permissions 770 and 660, respectively) solved the problem for me.
in flag
You should post that as an answer and accept it. Otherwise the question will stay in there system as unsolved forever.
Prateek Verma avatar
us flag
Thanks @GeraldSchneider. Done!
Score:0
us flag

I found the problem. In hindsight, however, the title is not what the real problem was. Yes, it is okay to provide gid only. In that case uid (owner of the mount) will default to root. My problem was that the dmask and fmask were set wrong, disallowing group users from accessing the mount. Setting dmask=007,fmask=117 (equivalent to permissions 770 and 660, respectively) solved the problem for me.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.