1

I've recently set up Samba on one of my CentOS 7 servers and it works fine, it allows anyone to access it as long as they are on the LAN.

Now I need to set up a second share that can only be accessed with a password.

I added a linux user for samba with a password

I then edited my smb.conf

unix charset = UTF-8
dos charset = CP392
workgroup = WORKGROUP

hosts allow = 192.168.20.0/24 127.0.0.1

security = user
passdb backend = tdbsam
map to guest = Bad User

[Public]
    path = /share/public
    writable = yes
    browsable = yes
    guest ok = yes
    guest only = yes
    create mode = 777
    directory mode = 777

[Secret]
    path = /share/secret
    browsable = yes
    valid users = samba
    force user = samba
    create mask = 777
    directory mask = 777

Then I installed samba-client and create the samba user password

smbpasswd -a samba

When I try to mount the share on windows it brings up the request for user and password but when I enter the samba username and password it denies me access.

Did I miss something in the setup?

  • There are potentially important parts of the smb.conf missing. Could you perhaps give the full one minus comments (redacted as needed): grep -vE '^[#;]' /etc/samba/smb.conf|grep -v '^[[:space:]]*$' – 0xC0000022L Dec 4 '15 at 8:45
  • ... also, did you check the folder permissions? And what passdb backend are you using etc? Problem is that it's not even clear whether the user that samba would try to log in is the one from Samba's own passdb or a system account. – 0xC0000022L Dec 4 '15 at 8:50
  • It would be ideal to have the user logging in using the samba system account, I will add other smb.conf settings to my question – TheLovelySausage Dec 4 '15 at 9:27
  • I know this should be kinda implied by the CentOS version, but which Samba are you using? – 0xC0000022L Dec 4 '15 at 15:58
  • it's version 4.1.12 – TheLovelySausage Dec 7 '15 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.