Setup Raspberry Pi to Collect and Log Data from Arduino

Samba the Shared Folder

If you were wondering if there is a better way to transfer files rather than by VNCViewer, or FTP, this session is for that question. We will install Samba and setup a share folders just like one in your office share network.

This session will walk you through some basic setup to have a share folder hosted on Raspberry Pi that can be accessed from other computers.

First, login Raspberry Pi by Terminal or PyTTY. To install Samba to RPi, enter this to the terminal:

sudo apt-get install samba
Install Samba
Install Samba

Make a share folder on Desktop

mkdir ~/Desktop/sambaShare

Modify the configuration file for the samba by:

sudo nano /etc/samba/smb.conf

Add the following lines to the end of the file:

[sambaShare]
        comment = share Folder on Research RPI
        path = /home/pi/Desktop/sambaShare
        browseable = yes
        read only = no
        writable = yes
        public = yes
        create mask = 0777
        directory mask = 0777
        guest ok = yes
Config Samba
Modify config file for Samba

If you have problem with writing on Windows, force it by adding this line to the end of the file: force user = pi.

On Linux, you may need to use the root user to write to this folder from the desktop machine (I will post the problem once I found out).

Next, add a user to Samba and create a password as well:

sudo smbpasswd -a pi

Then enter a password for the samba (can be the same or different than the password for pi user on the system)

Test if the config file is okay

testparm

Press Ctrl+X, then Y to save, and then restart samba service by:

sudo systemctl restart smbd
Restart Samba
Restart Samba

On the your desktop computer, assuming Linux. if not yes install samba plus sambaclient, and cifs to support the share drive, please do so by running:

sudo apt-get installs samba smbclient cifs-utils

Check if the shared folder on RPi is ready by (192.168.1.40 is the IP of RPi):

sudo smbclient -L 192.168.1.40
Maping folder
Looking for share folder by Samba

If you see the share drive, then create a mount point on Linux:

sudo mkdir /mnt/researchRPi
sudo chown user:usergroup -R /mnt/researchRPI

user, usergroup is your Linux user and group name. pi:pi works fine.

Almost done, mount the share folder by:

sudo mount -f cifs -o username=pi //your_rpi_IP/sambaShare /mnt/researchRPi

Enter your passwords, and make a soft link to your desktop:

sudo ln -s /mnt/researchRPi ~/Desktop/researchRPi
smbclient listen
Bingo, shared folder on both machines

If you have problem with read-write permission on the share folder, experiment with a weaker permission. On RPi's terminal:

sudo chmod -R 776 ~/Desktop/sambaShare

On Windows, it is even easier. Go to My Computer, and map a folder, then enter the IP of RPI, the shared folder should appear. I believe there is something on Mac that you can browse the shared folder on the network.

It works on Windows
Easy mapping by Windows, but trade-off for permission

That is this, you have a share folder now 😃.