Install Samba server on a Raspberry Pi 4

You can have your own file server at home using a Raspberry Pi and Samba server installed on it. Connect to your raspberry pi and enter this command to install samba:

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

Let’s add pi user to Samba

sudo smbpasswd -a pi

You will be prompted to enter the password twice.

Now we will create a share folder to the home directory of pi

mkdir /home/pi/share

Configuring Samba

Let’s make a backup of the original configuration of Samba first.

sudo cp /etc/samba/smb.conf /etc/samba/smb.bak

Now open the configuration file:

sudo nano /etc/samba/smb.conf

Go down to the bottom and paste this code:

[Share]
     comment=Shared Files
     path=/home/pi/share
     browseable=Yes
     writeable=Yes
     only guest=no
     create mask=0777
     directory mask=0777
     public=no

Save the file and restart samba

sudo service smbd restart

You can use a windows computer to see if it works. Open a file explorer and on the address type the ip address of your PI

\\192.168.1.10

You should see your shared folder.