Problem: A share named "bin" can not be deleted

Problem

You have a share created named “bin” (which worked fine in the past) and you are going to remove this share as it is no longer needed.
After having removed the share it can still be accessed directly by \\server\bin\ and shows the content of /bin on the server.

Environment

Samba has a feature of “home directories” and enables “hidden” shares for every user. By default these shares are the linux home directories of the user (i.e. user “max” has /home/max).
On Linux we have a system user called “bin” and it’s home directory points to /bin. Therefore Samba creates such a share and makes it available according to the file system access rules (by default: rwxr-xr-x, so readable for all).

Solution

This is a bug and there is currently no workaround or solution when you need the home directories for your users.

In case you do no need the feature of home directories, this can be disabled by:

root@master:~# ucr search samba/share/home
samba/share/home: yes
 If this variable is set to 'yes', the home directory of a Samba user is provided as a share with the name of the user.
root@master:~# ucr set samba/share/home=no
root@master:~# /etc/init.d/samba restart
Mastodon