Samba is one of the go-to protocols for sharing files over a network.
It is builtin to Windows, but needs to be installed and configured on other OSes like Linux and macOS.
Thankfully the process is not too difficult.
Installing on Rasbian
Run the following command on your Pi to install a samba server and client onto your Pi.
sudo apt update && sudo apt install samba samba-common-bin smbclient cifs-utils
Checking the smb server
To check the status of your smb server, use:
systemctl status smbd
Making a user
Samba users are different from Unix/Linux users, so we must create a new user
sudo smbpasswd -a pi
It should ask for a password for the new user before adding them
Network Shares, Permissions configuration
The main configuration file for samba is located at
is where you configure which folders/files are shared, what permissions they have (client side),
whether they are public, and more.
Let’s assume you have a folder
/home/pi/share that has files you want to share.
You can create this by doing
mkdir -m 1777 /home/pi/share
If you wanted samba to share this directory, you would need something like this
path = /home/pi/share
Note: always make sure to restart samba after changing configurations
systemctl restart smbd
Mounting a smb share on Linux
mount -t cifs -o username=pi //<ip of server>/myshare /mnt/share
Mapping a smb share as a drive on Windows
With File Explorer
Open File Explorer
Click “This PC”
In the ribbon view click “Map network drive”
\\<ip of server>\sharefor the folder (you can do this in File Explorer too)
Enter the user and password credentials setup earlier
The share should be mapped
net use Z: \\<ip of server>\folder
New-SmbMapping -LocalPath 'Z:' -RemotePath '\\<ip of server>\folder'