0

I've stumbled upon a peculiar issue regarding samba share. It only works when ownership is given to the samba user (shared) by running chown -R shared:sambasecure /mnt/Backup. I'm running CentOS 8, SELinux enabled. Let me explain what I did.

I created a user (shared) and a group (sambasecure)

adduser --no-create-hom --shell /usr/sbin/nologin shared
smbpasswd -a shared
smbpasswd -e shared
usermod -G sambasecure shared

I set permissions (777 for testing purposes) and ownership

chown -R root:sambasecure /mnt/Backup
chcon -t samba_share_t /mnt/Backup
chmod 777 /mnt/Backup

My smb.conf

[global]
    workgroup = WORKGROUP
    security = user
    netbios name = server
    passdb backend = tdbsam
    interfaces = team0
    printing = cups
    printcap name = cups
    load printers = yes
    cups options = raw

[homes]
    comment = Home Directories
    valid users = %S, %D%w%S
    browseable = No
    read only = No
    inherit acls = Yes
    
[media]
    path = /mnt/Backup
    writeable = yes
    write list = @sambasecure
    valid users = @sambasecure
    browseable = yes
    guest ok = no

Now, in this configuration file sharing does not work. Windows cannot access \... warning shows up. But if I run chown -R shared:sambasecure /mnt/Backup sharing works but I cannot access drives locally.

chmod doesn't affect this at all. It either works for root locally or samba user shared over samba, just by changing ownership.

It seems to me like samba doesn't recognize shared to be a part of sambasecure group. I tried many variations of smb.conf with zero success. Changing valid users to shared doesn't work either.

Any help would be appreciated. Thank you

2
  • Solved using setfacl -m user:shared:rwx /mnt/MediaFiles/. But I stiill don't get why it won't work with group sambasecure only.
    – Roman
    Commented Jan 19, 2021 at 20:31
  • I think the problem is related to the command chown -R root:sambasecure. This set the owner to root. It might be better to use chown -R :sambasecure.
    – harrymc
    Commented Jan 19, 2021 at 20:44

0

You must log in to answer this question.

Browse other questions tagged .