1

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!

Jiri B
  • 497
  • 2
  • 11
  • 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. – Prateek Verma Nov 15 '21 at 22:41
  • You should post that as an answer and accept it. Otherwise the question will stay in there system as unsolved forever. – Gerald Schneider Jan 06 '22 at 05:56
  • Thanks @GeraldSchneider. Done! – Prateek Verma Jan 10 '22 at 18:21

1 Answers1

0

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.