Setting up samba

Following the topic below this (at the time of writing this)

What am i doing wrong?

i have set up a samba server and i already have one which works

the new one i have setup i just cant get access to it.

it keeps popping up asking for the username and password but the two users i have on the linux machine details dont seem to be working.

i get this


i have a very basic conf file

comment = CompanyData
path = /share/companydata/
valid users = mason64 freddie
read only = no
browseable = yes
writeable = yes
create mask = 0644
directory mask = 0775

Where am i going wrong - this works fine on my other vm with the same conf file so i dont understand where am going wrong.

I am just going to file explorer and typing \\ or \\companydata\ but both keep asking for the credentials.

Any help would be so grateful.

Think I answered my own question

I forgot to give the user a samba password using smbpasswd -a mason64

I guess that this has to be done for all users that want adding to samba ?

Yes. It’s been ages since I worked with samba, but I remember this needing to be done.

I prefer using linux groups in the samba config. Just add the group to the config and you only need to add the user to the group if you want them to gain access to a share. That was one of my proudest samba manageability improvements (compared to the way the previous guys were doing it, with symlinks in users home dirs, which broke very often and resulted in infinite loops in windows).

Thanks for the reply

Sorry to ask but could you show me an example if you get time?

(look after “valid users =”)

sudo groupadd financial
sudo chgrp -R financial /mnt/finances
sudo usermod -a -G financial eddiebrown
sudo smbpasswd -a eddiebrown
sudo smbpasswd -e eddiebrown
sudo nano /etc/samba/smb.conf

Add the share “finances” with the valid user set to a group (the “@” symbol represents a group - you can add both multiple groups and multiple users on the same line).

path = /mnt/finances
browsable = yes
writable = yes
guest ok = no
read only = no
valid users = @financial

sudo systemctl restart smbd

After this, any individual you add to the “financial” group on the system will be able to access the “finances” share, without you having to modify the config and I’m pretty sure without needing to restart samba, just a usermod away.

1 Like


thats brilliant thank you so much for taking the time out to help with that.