Setting up a Samba server at work using local users I found that when logging via windows the following files were displayed in the shared folder
.bash_history
.bash_logout
.bashrc
.profile
.bash_logout
.bashrc
.profile
Now there there is a possibility that these files can be deleted via the share which would impact the local ssh user. After searching I found that there is a variable that can be set in smb.conf by putting
hide dot files = yes
in the [homes] section, however as I found out if you have windows set to ‘view hidden files’ this takes priority and the files are still shown.
After much more searching I found the veto function, so adding
veto files = /.*/
to [homes] section results in the . (dot) files not being displayed. So my smb.conf [homes] looks like this [homes]
comment = Home
Directories browseable = no
writable = yes
create mask = 0700
directory mask = 0700
valid users = %S
veto files = /.*/
Don’t forget to restart Samba after making the change.