I set up a Samba server on Ubuntu. Everything goes fine when I allow guest access, but when I try to setup a configuration for a specific user, I receive the error below:

$ smbclient  //x.x.x.x/john -U john
Enter john's password:
Domain=[MYDOMAIN] OS=[Unix] Server=[Samba 4.1.6-Ubuntu]
tree connect failed: NT_STATUS_ACCESS_DENIED

Here's the configuration on server side (/etc/samba/smb.conf):

    comment = Ubuntu File Server Share
    path = /home/john
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755
    valid users = john
    writable = yes

Please note that:

  • john account exists in /etc/passwd
  • /home/john exists and it's owned by john:john
  • as mentioned, the connection works fine when I allow guest access

It's the first time I do this. Am I missing something?


It turns out that, besides the Unix username, I'm also required to add a Samba username with the command below:

smbpasswd -a john

To see the users that are already created the command below can be used:

sudo pdbedit -L
| improve this answer | |
  • It also solved my problem on OpenSUSE Leap 42.2 – user4838962 Jul 5 '17 at 10:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.