The Backyard Meteorological Instrumentation will be running on a local Ethernet subnet. Although the Raspberry Pi is the primary processor for this project, it still requires connections to, and from, other processors on the network:
(1) Web Server - A Raspberry Pi 4 node that serves this website out to the Internet. Results will be placed here; (2) Database Server - A Fedora Linux node running a MariaDB that is used to store the readings from the Weather Station, sky camera, and these sensors; (3) Backup Server - A Raspberry Pi 2 node that manages the backing up important data from the other nodes; (4) Sandpit Server - A Raspberry Pi 2 node that is used as a sandbox for the development of the primary website; and (6) General Purpose Computer - A Windows based computer holding programs such as Office, TurboCAD and other documentation programs.
Installing File Sharing & Creating Users
To allow the Raspberry Pi to share files between the Fedora computer, the Raspberry Pi computers and the Windows computer the Samba File Sharing must be installed. On the Raspberry Pi, open a console and enter the following command:
$ sudo apt install samba -y
When this installation runs, it will correctly warn of an error that can be ignored. Howeer, if you wish to confirm that the installation completed, enter the following command:
$ ps -A | grep smbd This should result in a response similar to below:
2939 ? 00:00:00 smbd 2941 ? 00:00:00 smbd-notifyd
Although Samba is now installed and running it is not able to do anything because it does not yet know what directories and files it can share, or who is authorised to use those shared directories and files. Let's start by defining a user who is allow to access Samba. I will initially add myself (mark) but you will need to add your account name. A special account for the sensor activities will be created later.
$ sudo smbpasswd -a mark
The program should respond with the following lines as you enter the Samba Password (which should be different to your login password).
New SMB Password: Retype new SMB Password: Added user mark
NOTE: This username and password is what the computer will use to see if users on other computers are allowed to access the files on this system. It is NOT the username and password used to access remote systems from this system.
Defining Local Directories to Share
Now it is time to tell Samba which directories it can share to users on remote systems. This is done by editing the Samba configuration file /etc/samba/smb.conf. Before editing this file the directories to be shared and the Samba users permitted to use those directories must be selected. During the development phase, the widest access will be granted to an authorised user. After development, access will be restricted to the minimum required.
The following directory definition provides full and exclusive access to the Raspberry Pi's directory structure to the user mark (me). Normally this level of access is not required but is provided during development. Normally, I would connect with a session using VNC if I was playing with graphical activities.
[system] path = / browseable = yes readonly = no guest ok = no valid users = mark At this stage browseable = yes means that the share can be seen when searching for shares, which is okay at this stage, but it should be changed to no after development.
to activate this share, open the configuration files with the following command and the definition to the end of the file.
$ sudo nano /etc/samba/smb.conf After editing the file, test if the configuration file is valid by running:
Among other things, the response should start with:
Load smb config files from /etc/samba/smb.conf Loaded serves file OK.
It's now time to restart Samba so that this will be available for remote access by using this command to restart Samba:
$ sudo systemctl restart smbd.service
Licenced under Creative Commons Attribution Share Alike 4.0 International or better by Mark Little (2022 - 2023)