1

using Samba between a linux server and a windows 10 pc client. From windows I go to \\mylinuxserver and go into my home folder and see

.cache/
.gconf/
.gvfs/
.mozilla/
and so on
Desktop/
Downloads/
my_folders_i_care_about/

I don't want to see all the dot folders and files like .cache. I don't want to see .anything in windows explorer when navigating into a samba share. How can I stop dot files and dot folders from being visible?

My smb.conf is currently this for sharing out home directories and any other folder; this is under SLES11 with samba 3.6 but I will be using RHEL 7.6 eventually.

[homes]
    comment = Home Directories
    valid users = %S, %D%w%S
    browseable = No
    read only = No
    inherit acls = Yes
    create mask = 660
    directory mask = 770
[data]
    path = /data
    create mask = 660
    directory mask = 770
    inherit acls = Yes
    read only = No
7

There are a couple of ways to do this. If you just want to hide these files (they will still be accessible, if the user(s) know what their names are), add this parameter:

hide files = /.*/

To make them completely invisible to the Samba user, do this:

veto files = /.*/

FYI - these settings must be put in the section that defines each share; they are not global parameters.

7
  • for me in samba 3.6 only veto files = /.*/ seemed to prevent them from being visible. Tthe hide files had no affect.
    – ron
    Dec 18 '19 at 18:51
  • I've only tested it on the 4.x branch; maybe the hide files option is new. Dec 18 '19 at 21:01
  • only veto files = /.*/ seems to work in rhel 7.9 currently with samba-4.10.16-9.el7_9.x86_64. The hide files had no affect.
    – ron
    Apr 7 at 18:14
  • Interesting...on my LM 20 system (Samba v4.11.6), the hide files = option looks legit; here's the example from the man page: hide files = /.*/DesktopFolderDB/TrashFor%m/resource.frk/. Apr 7 at 19:06
  • you are saying samba v4.11.6 My RHEL 7.9 system right now is samba-4.10. Is there a version hard line with samba where this begins working? In any case the veto files is working for me.
    – ron
    Apr 7 at 19:40
0

As of version 4.11.6 you can use hide dot files parameter.

It would look something like this:

[data]
    path = /data
    read only = No
    hide dot files = yes
2
  • this does not work currently on rhel 7.9 with samba-4.10.16-9.el7_9.x86_64. will keep an eye out for samba update, thanks.
    – ron
    Apr 7 at 18:11
  • Strange it perfectly works for me on Ubuntu 20.04
    – Harry
    Apr 7 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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