Easy Raspberry basics: Project 23a Raspberry PI Zero W board - File Server with Samba

of Lex C. in Raspberry Pi Zero W

Raspberry basics: Project 23a

Project name: Raspberry PI Zero W board - File Server with Samba

Tags: Raspberry, Raspberry PI Zero W board, vers 1.1, v 1.1, file server, Samba, Pi share, share, windows 10, back up on Raspberry Pi, share files

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1. Raspberry PI Zero W board 1 pc

2. Micro SD card with NOOBS and SD card adapter 1 pc

3. Micro USB power supply (2 A 5V or 5V 3A) 1 pc

4. USB keyboard 1 pc

5. USB mouse 1 pc

6. TV or PC monitor 1 pc

7. HDMI cable 1 pc

8. T-Cobbler Breakout and GPIO Cable 1 pc

9. Micro USB 2.0 OTG Cable 1 pc

10. Mini HDMI to HDMI Adapter (HDMI to Mini HDMI Adapter) 1 pc

11. 4-Port USB 2.0 Hub 1 pc


We will learn how to create a file server using Raspberry PI Zero W board. 

It’s easy to use a Raspberry Pi as a Samba file server where you can store backups and share files from all the other computers on your network.

Samba is the Linux implementation of the SMB/CIFS file sharing standard used by Windows PCs and Apple computers, and widely supported by media streamers, games consoles and mobile apps. With Samba activated you can quickly copy files from a computer on your network to a Raspberry using wireless LAN (or a direct Ethernet connection).

We also assume you’re using a 32GB (or smaller) micro SD card, which provides a reasonable amount of storage space without requiring any extra steps to make it accessible. However, if you need extra storage, it’s easy to mount a large external USB drive and create a Samba entry for it.

Alternatively, if you want to keep things compact, you can install Raspbian on micro SD cards of up to 256GB, although we suggest checking online (non-working SD cards) before you buy to make sure you get one that’s fully compatible with the Raspberry Pi.

Once set up, you can mount your home file server on all the other computers on your network, and use it as a convenient place to store everything from music files you want to share with your housemates, to backups of important documents and save-game files you’d like to share between computers.

We recommend using a wired Ethernet connection for stability and fast transfer speeds. The project will still work if you connect your Pi via WiFi, although performance will be affected, particularly when it comes to copying over large files.

Understanding the Raspberry PI Zero W board

You can read more about it here.

Signals and connections of the Raspberry PI Zero W board

Step by Step instruction

We recommend using a high-performance SD card for increased stability as well as plugging your device into an external display to see the default application booting up.

1. Setup and preparation

We assume that you have Windows 10 installed on your PC and Raspbian OS installed on your Raspberry Pi Zero W board. 

  1. Do wiring.
  2. Insert your micro SD card with Raspbian OS into the TF card slot on the Raspberry Pi Zero W board. It will only fit one way.
  3. Connect Raspberry PI Zero W board mini HDMI port to your TV or Monitor HDMI (DVI) port (use HDMI cable and mini HDMI to HDMI adapter and/or HDMI to DVI adapter).
  4. Make sure that your monitor or TV is turned on, and that you have selected the right input (e.g. HDMI/DVI,  etc).
  5. Plug in micro USB 2.0 OTG Cable to USB data port of Pi Zero and 4-Port USB 2.0 Hub to micro USB 2.0 OTG Cable. 
  6. Plug in your USB mouse and USB keyboard to 4-Port USB 2.0 Hub.
  7. If you intend to connect your Raspberry Pi Zero vers 1.2 or vers 1.3 to the internet, connect a WiFi dongle to one of the 4-Port USB 2.0 Hub ports.
  8. Connect Micro USB power supply to Raspberry PI Zero board micro USB input.
  9. The Raspberry PI desktop will start up.
  10. Open Terminal window and type the command: sudo apt-get update
  11. Then type the command: sudo apt-get install 
  12. We will need to know our Raspberry Pi Zero W board IP address to access it. Type this command: hostname -I As you can see we have
  13. Using obtained IP address you can remote login to Raspberry Pi Zero W board with SSH.
  14. Open the Raspberry Pi Configuration tool from the main menu. Go to Raspberry icon-> Preferences -> Raspberry PI configuration

  15. Select Interfaces and make sure that all settings are enabled so you will not need to come back to these configuration tool again.

  16. Click on OK button.
  17. We need to reboot our Raspberry PI. If it will not reboot automatically go to Terminal. Type this command in the Terminal: sudo reboot

2. Installing Samba

  1. After restart of Raspberry Pi set up the remote access to your Raspberry Pi Zero W board . You can read hotw to do it here.
  2. Once you remote login to your Raspberry Pi Zero W board create a folder named Share that contains folder named Server in the home directory. We will use Server folder for file server demo. Go to Terminal. Type these commands in the Terminal: sudo mkdir Share
  3. cd Share/
  4. sudo mkdir Server
  5. cd Server/
  6. Samba lets you easily share files over network. Wecan install samba by typing this command in the Terminal:  sudo apt-get install samba samba-common-bin

3. Configuring Samba

  1. Once SAMBA installed we need to edit configuration file so it knows where to look for our Server. Open configuration file by typing this command in the Terminal: sudo nano /etc/samba/smb.conf
  2. Add the following settings to the bottom of this file:[Pi share] comment = Pi shared folder path = /home/pi/Share browseable = yes writeable = Yes only guest = no create mask = 0777 directory mask = 0777 public = yes guest ok = yes
  3. This means that anyone will be able to read, write, and execute files in the share, either by logging in as a Samba user (which we’ll set up below) or as a guest. If you don’t want to allow guest users, omit the guest ok = yes line. You could also use Samba to share a user’s home directory so they can access it from elsewhere on the network, or to share a larger external hard disk that lives at a fixed mount point. Just create a smb.conf entry for any path you want to share, and it’ll be made available across your network when you restart Samba.
  4. Press Ctrl+X, Y, Enter buttons to save the file.
  5. Before we start the server, we’ll want to set a Samba password – this is not the same as your standard default password (raspberry), but there’s no harm in reusing this if you want to, as this is a low-security, local network project. Type this command in the Terminal: sudo smbpasswd -a pi

  6. You will need to type your password and press Enter button, then type again the same password and press Enter button. Your password will be saved for user pi.
  7. Restart Samba by typing this command in the Terminal: sudo /etc/init.d/samba restart
  8. From now on, Samba will start automatically whenever you power on your Pi. Once you’ve made sure that you can locate your shared folder on the network, you can safely disconnect the mouse, monitor, and keyboard from your Pi and just leave it running as a headless file server.
  9. YWe’ll now be able to find your Raspberry Pi file server (named RASPBERRYPI by default) from any device on your local network. If you’ve left smb.conf’s default settings as they are, it will appear in a Windows network workgroup called WORKGROUP. If you have Windows 10 go to File Explorer and check for Network - you will see the RASPBERRYPI. 
  10. Double-click on RASPBERRIPI. You will need to enter your network credentials (username (we have pi) and password) and tick on box Remember my credentials and press OK button. Your network credentials will be saved and used every time for automatic log on.
  11. You will see two network folders Pi and Pi share.
  12. Double-click on Pi Share.
  13. You should see Server folder appearing.


We have learnt how to create a file server using Raspberry PI Zero W board. 

Libraries in use

  • no libraries used


  • none

Other projects of Lex C.

Published at 04-01-2019
Viewed: 8467 times