1

This question already has an answer here:

In Windows when I connect using test_reader account I can access with no problems. However when I use peter account it gives me Access Denied.

I did some testing and if I change share folder ownership to peter I can access using peter account and then there's no acccess for test_reader. So only a folder owner can access the share.

smb.conf:

[share]
        comment = Venice
        path = /media/test_folder/share
        read only = yes
        create mask = 0650
        directory mask = 0760
        browsable = yes
        valid users = @mac
        write list = peter

mac memebrs:

mac:x:502:test_reader,peter

Folder permissions:

drwxrw-r-x 2 test_reader mac   2048 Jun  9 18:23 share

I have set smbpasswd for each accounts.

Why I cannot access the share using peter account that belongs to the same group as test_reader?

marked as duplicate by Jesse_b, G-Man, Romeo Ninov, αғsнιη, Thomas Jun 10 '18 at 8:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I believe they may need execute permissions to open the directory. Which owner has but group does not. – Jesse_b Jun 9 '18 at 20:35
  • @Jesse_b you're right, I was missing the x permission – Okrx Jun 9 '18 at 21:56
2

You've got valid users = @mac, so any member of this group can access the share as far as SAMBA is concerned. But you've got write list = peter so only peter can have a chance of writing to the share.

However, you also need to overlay UNIX file permissions. You have got drwxrw-r-x 2 test_reader mac, which allows test_reader sufficient access. It does not give any useful access to group mac because you're missing the necessary x bit in the group directory permission.

In general, if you're using SAMBA to manage access rights I would suggest that you set the filesystem permissions to be rwxrwxrwx (777). There are exceptions to this, of course, such as when you have users logging in to the server. But for a dedicated fileserver it's a good starting point.

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