1 Overview
A Samba file server enables file sharing across different operating systems over a network. It lets you access your desktop files from a laptop and share files with Windows and macOS users.
This guide covers the installation and configuration of Samba on Ubuntu.
2 Installing Samba
To install Samba, we run:
sudo apt install samba
3 Setting up Samba
The configuration file for Samba is located at /etc/samba/smb.conf. To add the new directory as a share, we edit the file by running:
sudo vim /etc/samba/smb.conf
At the bottom of the file, add the following lines:
[sambashare]
comment = Samba on Ubuntu
path = /home/username/sambashare
read only = no
browsable = yes
Now that we have our new share configured, save it and restart Samba for it to take effect:
sudo service smbd restart
Update the firewall rules to allow Samba traffic:
sudo ufw allow samba
4 Setting up User Accounts and Connecting to Share
Since Samba doesn’t use the system account password, we need to set up a Samba password for our user account:
sudo smbpasswd -a username
Note
Username used must belong to a system account, else it won’t save.
5 Connecting to Share
On Ubuntu: Open up the default file manager and click Connect to Server then enter:
On macOS: In the Finder menu, click Go > Connect to Server then enter:
On Windows, open up File Manager and edit the file path to:
\\ip-address\sambashare
Note: ip-address is the Samba server IP address and sambashare is the name of the share.
If you’d like to take your configuration further…