Setting up Samba on Ubuntu
First of all, check the documentation:
https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server
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:
[joes-files] force user=joe valid users=joe path=/home/joe/shared-files comment=Joes shared Files browseable=yes read only=no create mask=0775 directory mask=0775
Test the config with
testparm
then restart the Samba server
sudo systemctl restart smbd
or
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
[alpha-files] 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.
https://www.cyberciti.biz/faq/adding-a-user-to-a-samba-smb-share/
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