Introduction
A Samba Server is a simple way to share files on your local network. In this article we are going to create a Samba share on the Raspberry Pi to make it easy to read and write files for everyone on your network to use.
[siteorigin_widget class=”SiteOrigin_Widget_Image_Widget”][/siteorigin_widget]
Steps
Connect to your Pi over terminal
- Enter: ssh pi@192.168.1.20
- default password is raspberry, you’ll likely want to change that after you login.
- Install Samba
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install samba samba-common-bin - Choose a folder to share and set permissions
Choose the folder from Part 1
Or create a new one: sudo mkdir -m 1777 /media/myusbdriveshare - Update the Samba configuration with the share details with permissions to read and write to the folder. Note that these are quick and dirty instructions. Meaning they will quickly allow you to share the drive but not necessarily in the most secure way. Use this configuration below assuming you don’t mind anyone on your local network can read, write and execute files on it.
sudo nano /etc/samba/smb.conf
[share]
Path = /media/myusbdriveshare
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = no - Create a Samba User to access the drive over the network
sudo smbpasswd -a pi - Now restart the Samba Service to update the settings
sudo systemctl restart smbd.service - Now you can access this Samba share from the network
- On a Mac smb://192.168.1.20
- On Windows \\192.169.1.20