Installing Samba
Install Samba.
sudo apt install samba
Create storage/share directory to be used with Samba. (In this example, I’ve chosen to mount a storage device to /mnt/samba, but this can be any folder on the system.)
sudo mkdir /mnt/samba
sudo mount [storage directory] /mnt/samba
Open Samba configuration file.
sudo nano /etc/samba/smb.conf
Add the following code to the bottom of the document.
Replace [share name] with the desire name for your Samba share.
Replace /mnt/samba with the directory you’ve chosen for your storage/share directory.
[share name]
path = /mnt/samba
browsable = yes
read only = no
guest ok = no
Set permissions for the Samba storage/share directory.
sudo chmod -R 0775 /mnt/samba
Create a (Linux) user to manage the Samba application.
Follow the on-screen instructions.
sudo adduser newusername
Create a Samba user and set password.
Follow the on-screen instructions.
sudo smbpasswd -a sambausername
Set storage/share directory’s user ownership to the Linux user you created two steps back.
sudo chown -R newusername:newusername /mnt/samba
Restart Samba.
sudo systemctl restart smbd.service
Open Samba’s Firewall port.
sudo ufw allow Samba
Reload Firewall.
sudo ufw reload