Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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
share|improve this question

You may use 'include' directive inside share definition section.

For example: 'smb.conf':

security = user

browseable = no
include = /etc/samba/per-user-config/%u.conf


browseable = yes

Please refer Samba official docs for more info and variables:

share|improve this answer
I can't believe that it seems to be the only viable solution for this problem. – yacoob Mar 12 '13 at 1:27
Or perhaps set browseable = yes on the share, and then include guest.conf with browseable = no ? – Matt Sep 13 '13 at 1:33
The include option does not work with the variables %u (user), %P (current share's root directory), or %S (current share's name) because they are not set at the time the include parameter is processed. – Varon Sep 1 '14 at 1:02

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:

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
share|improve this answer

Why don't you use browseable = no and a logon script (if you're on a domain) that does map the hidden share to a disk (net use)?
Never tried but should work

share|improve this answer

This can be done by setting the browsable = no option in the samba share.

share|improve this answer
This hides it from the browse list, even when logged in as authorized user. – karlbright May 22 '10 at 7:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.