[Samba] Hide empty Samba shares?

Jeremy Allison jra at samba.org
Tue Sep 4 18:02:12 MDT 2012

On Sat, Sep 01, 2012 at 03:52:38PM -0400, Sam Bulka wrote:
> When a partition mounted to a shared by Samba folder is dismounted,
> Samba keeps sharing that empty folder. It creates a security hazard,
> since files can still be saved to that empty folder, and overwritten
> next time (lost) when the original partition is auto mounted again
> to the same folder. Its also confusing for most users to browse
> empty shares - no normal person would understand why they are still
> there.
> Is it possible to configure Samba to hide corresponding shares, once
> the attached drive is dismounted or switched off? If not, is there
> any reason or logic, why such basic functionality is not offered?

You'll need to script this yourself by issuing removing the share
entry from smb.conf and using smbcontrol to close client connections
to that share and reload the config file.

Samba doesn't have logic to hook into your specific UNIX's method
of notifying dismounts (if it even has one).

Also, it's not a security hazard, as the admin - don't do that :-).


More information about the samba mailing list