My Linux system has two users, and I configured samba on it, so some shared directories are accessible by both uses, and some are accessible by one of them.
The problem is when I access the computer from Windows clients and authenticate using the second user (with less permission), the folders which are not accessible are shown (although they are not browsable), how can I hide these folders from this user?
Here is a part of /etc/samba/smb.conf file:
[anonymous]
path = /repo/samba/anonymous
writeable = yes
browseable = yes
valid users = user1, user2
[archive]
path = /repo/samba/archive
writeable = no
browseable = yes
valid users = user1, user2
[user1]
path = /repo/samba/user1
writeable = yes
browseable = yes
valid users = user1
[user1-ro]
path = /repo/samba/user1-ro
writeable = no
browseable = yes
valid users = user1
When user2 tries to access the server, they see user1 and user1-ro folders too, and I want to hide these two for them.
I shall mention that the linux system runs Ubuntu-MATE 16.04.
Add:
to the share definitions in your config.
This is called "access-based enumeration" in SMB vernacular.
I'm not sure why but @techraf answer didn't work (although according to docs it should), but I found another solution and it worked. I've added
to
/etc/samba/smb.conf
file.