Disable samba automatic shares

All I’m trying to do is restrict one samba user to read-only on all shares, but to do that I’ve come to understand that I need to disable automatic shares and define all shares manually. The next problem in the chain then becomes: how do I disable automatic samba shares?

I’ve tried:

After rebooting all shares still show up on networked devices.

smb.conf:

[global]

# If you require a fully custom smb.conf create smb-local.conf instead of editing smb.conf so your
# configuration will not be overwritten by samba upgrades. You can use smb.conf as a template by
# copying it to smb-local.conf then removing the config file line below in the new file. If you only
# need to add some additional shares see smb-shares.conf below for a simpler way to do this.

    config file = /etc/samba/smb-local.conf

[...]

smb-local.conf:

[global]

# If you require a fully custom smb.conf create smb-local.conf instead of editing smb.conf so your
# configuration will not be overwritten by samba upgrades. You can use smb.conf as a template by
# copying it to smb-local.conf then removing the config file line below in the new file. If you only
# need to add some additional shares see smb-shares.conf below for a simpler way to do this.

    
# time machine-specifikt 
# från http://wa.rwick.com/2018/04/08/minimal-ubuntu-time-machine-backup-service/
    vfs objects = catia fruit streams_xattr
    mdns name = mdns
    # Time Machine
    fruit:veto_appledouble = no
    fruit:encoding = native
    fruit:metadata = stream
    # Security
    server min protocol = SMB2




    workgroup = WORKGROUP
    security=user
    follow symlinks = yes
    wide links = no
    unix extensions = no
    lock directory = /var/cache/samba
    load printers = no
    printing = bsd
    printcap name = /dev/null
    disable spoolss = yes
    log level = 1
    map to guest = bad user
#   usershare template share = automount template

# Automount template disabled to work around a samba bug causing crashes accessing external drives.

    read raw = Yes
    write raw = Yes
    strict locking = no
    min receivefile size = 16384
    use sendfile = true
    aio read size = 2048
    aio write size = 2048
    socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

[osmc]
    browsable = yes
    read only = no
    valid users = osmc
    path = /home/osmc
    comment = OSMC Home Directory

[automount template]
# Från: https://discourse.osmc.tv/t/samba-automount-template-not-working/6038/6
# What you can do though is if it suits your needs better, is disable the automount shares by changing browseable = yes in the [automount template] section to no, then add a custom smb-shares.conf file that manually adds your desired shares with any permissions you like.



# Add custom shares in smb-shares.conf instead of editing smb.conf so they will not be
# overwritten by samba updates. You can only add new shares to smb-shares.conf, not change
# the default shares or global options. If you need full control see smb-local.conf above.

include = /etc/samba/smb-shares.conf

You might be better off installing samba manually and configuring it this way.

Thank you for the advice.

If I understood you correctly:

  • There’s no known config that will do the trick
  • Uninstalling and installing it again manually will not result in restoring the automatic shares functionality

UDisks glue configuration is handling the mounting, if memory serves.