Prevent samba from automatically sharing mounting points on disks in fstab

I want to know how I can prevent the mount points I have defined in the fstba file from automatically appearing as a samba resource. I have three disks manually defined in fstab that are mounted with the uuid, for example, mnt/B28AAAFE8AAABE6B. In the smb.conf I define the resources as “path = /mnt/B28AAAFE8AAAABE6B/Movies”. When I enter the Samba share from Windows I see the folders Movies and B28AAAFE8AAABE6B, which are really the same disk. I would like to be able to see only Movies as I had for example in the Dietpi distribution. Thanks!

It’s probably because the drives are being automounted and mounted via fstab, so they mount twice.

Verify that with:

mount

Instead of mounting with a UUID, add a label to the partition(s), remove the fstab entries and reboot. See if things show up better that way.

I’m pretty crazy about the way Osmc works with automount of the disks. In any linux distribution I define the mount point in fstab and then configure any folder of that mount point as a resource in Samba with its access permissions, creating both read and write users. With this way that Osmc has to automount the disks what I get is to have duplicate the resource in Samba, one with Samba permissions that I have defined in the smb.conf, for example reading permissions, but if I access by automount resorce I do not respect those permissions and I can create and delete files. Is it possible to disable automount and be able to do all the manual process?

I’ve tried deleting fstab content, but I still get duplicate resources. Logically when accessing does not appear content because the mount point is no longer defined in fstab.

Remove from /etc/samba/smb.conf everything from the [automount template] section. But be warned this might be overwritten by an update

This is the content of my smb.conf, where what you comment is apparently deactivated. The configuration of Samba is defined in the smb-local.conf, which is the same as smb.conf but with the added shared resources.

[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

    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]
    browseable = yes
    -valid = no
    valid users = osmc
    path = %P
    hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/

# 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

Why do you think it is deactivated?
At least in the file you have copied here it is not deactivated

I’ll tell you, the lines that appear in black highlighted is because it has the symbol of bracket in front of it, that symbol what it does is to disable that line of the file. But as it seems when you make copy paste the forum interprets that symbol as black highlighted, I don’t know if you understand me.

I have removed the part of [automount template] but when I restart I still appear both the resource with the uuid and the resource defined in Samba of the same automount disk.

I’ve edited your post to make the config file more readable.

Thanks, I didn’t know how to do it so it wouldn’t show up in highlighted black.

This is my smb-local.conf

[global]
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

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

[Peliculas]
comment = Peliculas
path = /mnt/B28AAAFE8AAABE6B/Peliculas
browseable = yes
create mask = 0775
directory mask = 0775
read list = sambaread
writeable = yes
max connections = 8

[Series]
comment = Series
path = /mnt/01D238FE17203100/Series
browseable = yes
create mask = 0775
directory mask = 0775
read list = sambaread
writeable = yes
max connections = 8

[Series 2]
comment = Series 2
path = /mnt/4E1AEA7B1AEA6007/Series 2
browseable = yes
create mask = 0775
directory mask = 0775
read list = sambaread
writeable = yes
max connections = 8

[Almacen]
path = /mnt/6af7dfb5-e657-d001-20f7-c7b5e657d001
writeable = yes
write list = sambaread

Is there anything inside the smb-shares.conf file?

Solved, I generated the mount points in /media and I already appear correctly Samba shares. Apparently all the directories that you generate in /mnt osmc automatically mount them in Samba, but in /media this does not happen.