3

Like described here, Samba-servers on Linux provide the users /home-directory as a shared-folder automatically. How can I prevent this behavior?

In the following, the directory containing the home folders are shared using the users share name. Each user's home directory is created as a subdirectory on the \\server\users\ share, such as, \\server\users\user_name. This is the same format used in a Microsoft Windows environment and requires no additional work to set up.


I only want to share an explicit declared shared-folder, but not the whole /home/username-directory of my username. How can I adjust this?

5

Per @Nasir Riley's answer - That will keep the share from showing to anyone browsing the server for shares.

However, the share is still available if you know that it exists.

It would be much better to simply remove the [homes] share from the smb.conf file completely, or if you think you may want it in the future comment it out, and restart the samba service.

| improve this answer | |
1

In the /etc/samba/smb.conf file you'll see a section in share definitions called [homes]. It will look like this:

[homes]
comment = Home Directories
browseable = yes
writable = yes
valid users = %S
valid users = MYDOMAIN\%S

Make sure that browseable and writable are set to no and restart the smb service.

| improve this answer | |
  • 1
    Can still connect to it if you know it is there. Better to simply delete the [homes] share definition (or comment it out) – ivanivan Jan 19 '18 at 15:46
  • @ivanivan: You are completely right! I figured out the same issue a few seconds ago. I solved this problem by editing the config within [homes] like follows: create mask = 0000, directory mask = 0000, invalid users = %S. Now even the listed users don't have access to the users /home anymore. I hope it is a good solution like that? – Dave Jan 19 '18 at 16:32
  • @ivanivan: Your solution is better than mine! By deleting the whole [homes]-section in /etc/samba/smb.conf the /home-share is not even visible anymore. In my ugly solution it would still be visible. Thanks a lot! You can post this as an answer! – Dave Jan 19 '18 at 16:49
  • If you set browseable and writable to no then /home won't appear in that case either but deleting it does the same if that's better for you. – Nasir Riley Jan 19 '18 at 16:58
  • @user:270732: I tried to set browseable and also writeable to no, but the /home-directory still appeared in the list of mapable networks and was still browseable nevertheless. To specify this, it only appeared when I was already logged in into the target directory, but I wanted it to disappear completely. Now everything is fine! Nevertheless, thanks a lot for your help and your kind efforts! – Dave Jan 20 '18 at 7:11

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.