Samba NT_STATUS_ACCESS_DENIED error on Ubuntu

authenticationremote-accesssamba

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):

[john]
    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?

Best Answer

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