Hiding samba share from browse list for unauthorised users
Solution 1:
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
Solution 2:
You may use 'include' directive inside share definition section.
For example: 'smb.conf':
security = user
[private]
...
browseable = no
...
include = /etc/samba/per-user-config/%u.conf
'allowed-user.conf':
browseable = yes
Please refer Samba official docs for more info and variables: http://www.samba.org/samba/docs/using_samba/ch06.html
Solution 3:
Denis is almost right.
Unfortunately, as per Samba's official documentation (here), the user variable '%u' does not work with 'include'.
However, in most cases the home directory of the user has the same value as the username and you can use that instead like so:
[share]
...
browseable = no
...
include = /etc/samba/%U.conf
where %U (notice the capital U) will be the home directory of the current user. Now let's say the user is ethan with home folder ethan. In that case you will create a file in /etc/samba/ethan.conf
with contents:
browseable = yes