Raspberry Pi Setup – Part 2 – Samba Server to Share Files

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.

Steps

Connect to your Pi over terminal

  1. Enter: ssh pi@192.168.1.20
  2. default password is raspberry, you'll likely want to change that after you login.
  3. Install Samba
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install samba samba-common-bin
  4. 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
  5. 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
  6. Create a Samba User to access the drive over the network
    sudo smbpasswd -a pi
  7. Now restart the Samba Service to update the settings
    sudo systemctl restart smbd.service
  8. Now you can access this Samba share from the network
    1. On a Mac smb://192.168.1.20
    2. On Windows \\192.169.1.20

Leave a Reply

Your email address will not be published. Required fields are marked *