Raspberry Pi: Samba File Server Setup

A Samba file server enables file sharing across different operating systems over a network.

It lets you access your files on a Raspberry Pi and share them with Windows, Linux and macOS clients.

In this note i will show how to turn your Raspberry Pi into a file server by installing Samba and creating a shared folder.

Cool Tip: Mount USB drives in Raspberry Pi automatically! Read more →

Samba File Server on Raspberry Pi

Install Samba:

$ sudo apt-get install samba

During the installation you may be asked:

Modify smb.conf to use WINS settings from DHCP?

In most of the case the answer should be “No” unless you have a multi-homed SMB network.

Create a folder to share:

$ mkdir -p /home/pi/share

To add the new directory as a share, edit the configuration file of Samba:

$ sudo nano /etc/samba/smb.conf

Warning: The shares in these examples are accessible without authentication!

At the bottom of the file, add the following lines, to create a Read-Only share:

   # This share allows anonymous (guest)
   # Read-Only access without authentication!
   comment = Raspberry Pi File Server
   path = /home/pi/share
   read only = yes
   guest ok = yes
   guest only = yes

Read-Write share example:

   # This share allows anonymous (guest)
   # Read-Write access without authentication!
   comment = Raspberry Pi File Server
   path = /home/pi/share
   writable = yes
   force user = pi
   guest ok = yes
   guest only = yes

Save that file and restart Samba with this command:

$ sudo systemctl restart smbd

Access Samba Share on Raspberry Pi

Cool Tip: How to find the Raspberry Pi’s IP on network! Read more →

To access the shared folder from a Windows machine, open the Windows Explorer and in the address bar type the IP address of your Raspberry Pi followed by the share name:


On a Linux machine with GUI, open the File Browser application and in the address bar type:


On a macOS device, open up the Finder, click on “Go” -> “Connect to Server” and in the resulting window type the path to the Raspberry Pi’s shared folder in the same format as for the Linux machine in the example above.

Leave a Reply