Ubuntu Linux 22.04.2
Samba version 4.15.13-Ubuntu

I am using the default installation of Samba on Ubuntu.

I added this to /etc/samba/smb.conf

browseable = yes
printable = no
comment = Web Root Dir
create mode = 0644
directory mode = 0775
path = /var/www/html
writeable = yes
valid users = @www-data

Also there is this line active in the settings:

unix password sync = Yes

After this I restarted Samba as recommented.

systemctl status smbd

shows no errors. Samba is active (running)

I added myself to the www-data group before.

Now I tried to connect to the network share (\\<HOST>\www) from Windows with my Linux credentials. But I can't. The connection is refused.

/var/www/html is owned by www-data

ls -la /var/www/html

drwxrwxr-x  3 www-data www-data 4096 Apr 24 20:44 .
drwxr-xr-x  3 root root     4096 Apr 21 10:37 ..

What am I doing wrong? Am I missing any setting in Samba which isn't default?

I can access the host from windows and there is no firewall activated.

2 Answers 2


Ok. I realized that I have to use smbpasswd to somehow add the user to samba's own database.

sudo smbpasswd -a <user>

But why does it not sync with the linux credetials as indicated by unix password sync = Yes

I don't get it.


That's because is Samba which have to sync *Nix, not the reverse, so you must use smbpasswd to change a Samba enabled user. Internally, Samba know that have to change also the *Nix password and do that.
There is a couple options that could be setted to use a custom program to have syncro between the two, Samba and *Nix.

passwd program = /bin/another_program %u
passwd chat = *old*password* %o\n *new*password* %n\n *new*password* %n\n *changed*

You must log in to answer this question.

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