First, you need to install samba into your raspberry pi.
After doing that, you run
I do this every time I work with Linux or raspberry pi, and I advise you to do it too.
sudo apt-get update
sudo apt-get upgrade
Next, let’s get samba.
sudo apt-get install samba samba-common-bin
Now we need to define the folder/directory we are going to use, this will be the folder that PC A and B will have access to.
The folder can be located anywhere, even in an external folder. the SDcard I was using died a few days after and because I set the folder in a thumb drive I didn’t last the information, I just need it to bake another SDCard install samba and I was up and running.
mkdir /home/pi/shared
Access configuration
The next step is to modify the file smb.conf to let samba knows where the folder to share is and how to handle the access.
sudo nano /etc/samba/smb.conf
at the end of the file add:
[pimyshare]
path = /home/pi/shared
writeable=Yes
create mask=0777
directory mask=0777
public=no
Save the document in this case Ctrl + X and Y .
Set a user for the samba share
To control the access to this folder, I add a user and a password.
With this command we can set the password, the user will be pi
sudo smbpasswd -a pi
Restart the server.
sudo systemctl restart smbd
If we need to get the hostname, we can obtain it with hostname -I
The final step is to configure access to the shared directory.
Windows
File Explorer > Computer > Map network drive
Now we need to input the name of the host or the IP address followed by the name of the folder ( name in brackets in the configuration file)
The system will ask you for the user and password, as explained in a previous step the user is “pi” and the password was the one defined before.