Samba – Hiding samba share from browse list for unauthorised users

samba

I have been trying to setup my samba shares correctly.

The setup i was looking for was having a couple of shares available publicly, guest accounts are ok and can browse these shares all ok. I have this setup correctly.

The problem comes when setting up a share that only certain users can view, although i have setup a share that will only allow certain users to access. I havent been able to hide this share from guests.

I had a look into the browseable = yes option but this hides it from everyone, including the users that have logged in.

Any idea on how to tackle this?

The setup i have for this private share is follows:

[private]
comment = private share for certain users
path = /media/drive/private
create mask = 0777
directory mask = 0777
writable = yes
public = no
users = admin

I currently have

security = share

But have tried using browseable = no with

security = user

Best Answer

To hide the full share, you can use the following option:

[global]
access based share enum = yes

To hide files/folders inside a share to users who do not have read permission on those files/folders, you can use:

[share]
...
hide unreadable = yes