Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 am exporting a directory via Samba to my home theater PC. Unfortunately XBMC is also displaying some working directories that I happen to be sharing inside that directory.

I would like to find a way to have Samba ignore certain directories so that they are not shared with the other PCs.

This is purely for vanity reasons so the solution doesn't need to be totally perfect (So a workaround would be fine, it doesn't have to be production quality)

share|improve this question
up vote 8 down vote accepted

I'm thinking veto files is the option you're looking for.

Edit /etc/samba/smb.conf with root rights. Under the particular share /var/test, the following setting will exclude any descendant sub-directory or file matching foo or *bar* (beware, / means OR):

  path = /var/test
  veto files = /foo/*bar*/

Then, you need to restart Samba with stop and start (not reload):

sudo /etc/init.d/samba stop
sudo /etc/init.d/samba start

Note: Shares created through Nautilus GUI are defined in individual files in /var/lib/samba/usershare but veto files can't be applied there. If it's your case:

  • Either add veto files to the [global] section of /var/lib/samba/usershare. This will affect to all your global shares.
  • Or delete the existing share definition file under /var/lib/samba/usershare and re-create it manually under /etc/samba/smb.conf. You can't copy paste; instead, follow the guide.
share|improve this answer
The / character in the veto files pattern is not a directory separator. In the example above, provided you add a / at the end to make it syntactically correct, any files or directories named either var, test or private will be hidden. – Lars Haugseth Jun 28 '13 at 19:11

hide files = file1/file2/$*/System Volume Information also hides the folder from share

share|improve this answer

Your Answer


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

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