Setting up Samba on Ubuntu

First of all, check the documentation:

then go ahead:

sudo apt-get install samba

decide which LINUX user should be used (or create a new). This user must have LINUX access rights to the files!

You can list UNIX users with:

awk -F: '{ print $1}' /etc/passwd | sort

Assuming the linux user is “joe”

create a SAMBA user  and link it to the UNIX user (you MUST do this – Each SMB user must have a UNIX user!)

sudo smbpasswd -a joe

<now enter SMB password for joe>

sudo nano /etc/samba/smb.conf

Create a share by adding this at the end:

   force user=joe
   valid users=joe
   comment=Joes shared Files 
   read only=no 
   create mask=0775 
   directory mask=0775

Test the config with


then restart the Samba server

sudo systemctl restart smbd


sudo service smbd restart

You can list registered SAMBA user accounts with

sudo pdbedit -L -v

Remember the read only = no statement in your shares

 force-user = alpha
 valid-users = alpha
 path = /home/alpha
 comment = Alpha Files
 browseable = yes
 read only = no
 create mask = 0775
 directory mask = 0775

If you cant connect, check that the firewall isnt blocking you!

sudo ufw status

# if you have ufw enabled:

sudo ufw allow samba
sudo systemctl restart nmbd
sudo systemctl restart smbd

If you can connect, but get ANY problems accessing the files, first check the UNIX rights to the file in question! It is almost always there you will find the problem.

If you get this eror (or any other where you can’t list the shares):

SMB1 disabled -- no workgroup available

You can use this MAGIC option (section [global], just under workgroup = ) that has saved me many times:

client min protocol = NT1
server min protocol = NT1

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.