How to create a shared storage from Raspberry Pi

2019-07-31 | 236 words

Today we will show you how to create a shared disk in your local network. We will use Raspberry Pi and Samba software for this purpose.

Connecting to Raspberry

I have already described the installation in the previous article.

We start the command line (cmd) and connect with the command:

ssh pi@raspberrypi

Installing Samba

We will use Samba - this way we will be able to access the Raspberry file system from Windows.

sudo apt-get update sudo apt-get upgrade sudo apt-get install samba samba-common-bin

Samba Configuration

We create a folder /home/pi/share, which will be shared.

mkdir /home/pi/share

We open the configuration file in the “nano” editor.

sudo nano /etc/samba/smb.conf

And at the end of the file, we can write our own settings. Especially the definition of the shared folder - its path, name, etc.

[share] path = /home/pi/share writeable=Yes create mask=0777 directory mask=0777 public=no

We save it using Ctrl+X and then Y.

Samba User

We create a Samba user, for simplicity, we will call it pi (just like the default Unix user created on Raspberry). It will ask us for a password, so we choose one.

sudo smbpasswd -a pi

We restart Samba:

sudo service smbd restart

Let’s connect

Now in Windows Explorer, we enter the path (or navigate there through the Network):

\\RASPBERRYPI\pi

We fill in the username we created (pi) and the chosen password. And we are there, in the Raspberry home folder (/home/pi/share).