James John – Software Engineer

How to Hide Sub-Files and Directories on Samba Network Share

Every of my posts are attached to experience and events, so this is not an exemption 🙂 . I had to share some folders to a friend and at same time I don’t want him to see some of the files so he won’t steal them 😀 I bet you’ve been in same position, which is why you are reading this article 🙂

Well, thanks to Samba! There’s a feature to hide certain files and directories from smb shares. So, I assume you have Samba set up and running, else you won’t be reading this article, aye? 😀

Hiding Files and Directories

Now lets get to the main thing, there is a config option called veto files which takes arguments of file and directory names separated with backward slash (/). I will give an example below, where I want to hide these files: dir1, dir2, dir3:

# Remember this will be under a shared directory config, let me say I'm sharing my videos and want to hide the directories in it
comment = My Videos
read only = Yes
browseable = yes
veto files = /dir1/dir2/dir3/

On the network, the above directory will not show up any file or directory having those names.

This config option also accept wildcards of * and ?. Like I want to hide any directory starting with dir I would type:

veto files = /dir*/

So, this is it. I hope this helps. 🙂

James John

Software Engineer