Centos 6/RHEL Samba hide files and folders

Managing a network often implies the need to hide files and folders from users for a wide variety of reasons.

This assumes that Samba is already installed and it is configured
to run as a standalone server.

The typical method of hiding files is to use a dot (.) as the first character in the filename

However. in circumstances where a user has specified the option to see such files, then
our intentions can be circumvented. It is for this reason that we will also be using the
veto files option

First log in as root and open your current Samba configuration file
by typing

vi /etc/samba/smb.conf

Within the [global] section of the Samba configuration file, add the following line
in order to hide all dot (.) files

hide dot files = yes

Now include the veto files option. To do this, add
the following lines but remember to customize the values shown to suit your needs

veto files = /.*/foldername/filename.txt/filename.???/
delete veto files = yes

Save the file before restarting the Samba server

$ sudo service smb start && service nmb start

Labels: , ,