MEMOS

Samba setup

Install the package

sudo apt-get update
sudo apt-get install samba

Backup & Update the config

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo vim /etc/samba/smb.conf

###Add shares

Restricted to authenticated users

All users have read/write permissions on every folders. But they can only write on their own files

[Restricted]
	comment = Restricted share
	path = /path/to/share
	read only = no
	browsable = yes
	create mask = 0775
	directory mask = 0777

Public read only, write allowed for some users

Guest users have readonly access, while user1, user2 and user3 have read/write permissions.

[Public]
	comment = Public share
	path = /path/to/share
	read only = yes
	browsable = yes
	guest ok = yes
	create mask = 0775
	directory mask = 0777
	write list = user1 user2 user3

path: The directory of the share

browsable: Allow auto discovery of the share

create mask: Permissions on created files

directory mask: Permissions on created folders

guest ok: Allow unauthenticated users

write list: Give specified users write permission

Restart the daemon

sudo systemctl restart smbd

Create a samba user

sudo smbpasswd -a username

Warning: User username must be present on the server to be created as a samba user.