RaspberryPI – how to install and run SMB client and server

  1. First of all update the package list and all our packages by running the following two commands (as root).
sudo apt-get update
sudo apt-get upgrade

2. Now that we have our Raspbian operating system entirely up to date, we can now proceed on to installing the Samba software to our Raspberry Pi.

sudo apt-get install samba samba-common-bin

3. Before we set up our network storage on our Pi, we need to first create a folder that we will share.

This folder can be located anywhere, including on a mounted external hard drive. For this tutorial, we will be creating the directory within the “pi” users home directory.

Create this folder by running the following command.

mkdir /home/pi/shared

4. Now we can share this folder using the Samba software. To do this, we need to modify the samba config file.

sudo nano /etc/samba/smb.conf

5. Within this file, add the following to the bottom. This text defines various details of our share.

path = /home/pi/shared
create mask=0777
directory mask=0777

[PI_share]” – This defines the share itself, the text between the brackets is the point at which you will access the share. For example, ours will be at the following address: //raspberrypi/pimylifeupshare

path” – This option is the path to the directory on your Raspberry Pi that you want to be shared.

writeable” – When this option is set to “Yes“, it will allow the folder to be writable.

create mask” and “directory mask” – This option defines the maximum permissions for both files and folders. Setting this to 0777 allows users to read, write, and execute.

public” – If this is set to “no” the Pi will require a valid user to grant access to the shared folders.


Finally, before we connect to our Raspberry Pi Samba share, we need to restart the samba service so that it loads in our configuration changes.

sudo systemctl restart smbd

Now in network env. on Windows computer our PI_share should be visible with shared folder.

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *