2

I'm trying to setup a CentOS 7 samba server but I just can't make some permissions work.

All my files and directories are allowed only to their respective owners, e.g:

drwxrwx---.  5 root setcob        4.0K Feb 12  2016 setcob
drwxrwx---+  7 root setorpessoal  4.0K Oct 25 19:30 setorpessoal

But when I connect via smbclient, I can't ls inside setorpessoal.

smb.conf:

[global]
        workgroup = workgroup
        netbios name = sambaserver
        netbios aliases = sambaserver
        server string = sambaserver
        map to guest = Bad User
        passdb backend = smbpasswd
        log level = 4
        log file = /var/log/samba/%U.log
        max log size = 1000
        max xmit = 65535
        deadtime = 15
        socket options = TCP_NODELAY IPTOS_LOWDELAY
        os level = 100
        preferred master = Yes
        domain master = Yes
        dns proxy = No
        wins support = Yes
        full_audit:prefix = %u|%i|%S
        recycle:keeptree = yes
        recycle:versions = yes
        recycle:repository = /mnt/samba/lixeira
        recycle:exclude = *.tmp, *.log, *.obj, ~*.*, *.bak, *.iso
        recycle:exclude_dir = tmp, cache
        invalid users = root
        admin users = user1, user2, user3
        write list = user1, user2, user3
        veto files = /~*/
        hide files = /~*/
        vfs objects = recycle

[setorpessoal]
        comment = Setor Pessoal
        path = /mnt/samba/setorpessoal
        valid users = @setorpessoal, setorpessoal, user1, user2, user3
        read only = No
        force create mode = 0777
        force directory mode = 0777
        write cache size = 384000
        veto files = /*.mp3/*.wav/*.tif/*.pif/
        recycle:keeptree = yes
        recycle:versions = yes
        recycle:repository = lixeira
        recycle:exclude = *.tmp, *.log, *.obj, ~*.*, *.bak, *.iso
        recycle:exclude_dir = tmp

Log error:

[2018/10/26 17:41:52.458256,  3] ../source3/smbd/service.c:120(set_current_service)
  chdir (/mnt/samba_novo/samba/setorpessoal) failed, reason: Permission denied
[2018/10/26 17:41:52.458296,  3] ../source3/smbd/smb2_server.c:3120(smbd_smb2_request_error_ex)
  smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../source3/smbd/smb2_server.c:2472

I'm using CentOS 7 with Samba 4.7.1.

1 Answer 1

3

Okay, I found the problem: I didn't set my new permissions to its root directory. All the folders were OK, but /mnt and /mnt/samba belonged to root. I've set to 777. BTW, I also disabled SElinux.

1
  • THANK YOU! I was having this exact issue caused by SELinux! I spent days trying to figure out why I couldn't access my Samba share on Fedora from Windows 10, it would connect OK but not list the files, sometimes getting "Access Denied" messages, I tried so many configuration options, everything. Disabling SELinux finally solved it, it was silently blocking the Samba server from accessing anything!
    – Qjimbo
    Oct 13, 2021 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .