Networking Resources - selmling/Analytics-and-Data-Exploration GitHub Wiki

  1. measure a raspberry pi’s temp with measure_temps.py

  2. Mount an smb share within terminal:

sudo mount -t cifs -o username=pi //192.168.0.XXX/Downloads /mnt/WD_disk/
  1. Transfer a file:
rsync -ah --progress [file] [directory]
  1. Open up permissions on directory
sudo chmod -R 777 /srv/dev-disk-by-uuid-40fcf7a3-a413-452d-8751-318146c099ce/Video_Share/
  1. create a bash script:
sudo nano /usr/bin/maintenance.sh
#!/bin/bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get autoremove -y
sudo apt-get autoclean
  1. Set execute permission to script:
sudo chmod +x /usr/bin/maintenance.sh
  1. Add script execution to crontab

  2. Create a system service to run the script at reboot (change shellscript to a more appropriate name):

sudo nano /lib/systemd/system/shellscript.service 

Add these lines in the script, changing the name and directory to reflect your target .sh script:

[Unit]
Description=My Shell Script

[Service]
ExecStart=/usr/bin/script.sh

[Install]
WantedBy=multi-user.target

Enable the new service you just created:

sudo systemctl daemon-reload 
sudo systemctl enable shellscript.service 
sudo systemctl start shellscript.service
sudo systemctl status shellscript.service 
  1. Set up an ssh keypair
  • Generate key pair files
ssh-keygen -t rsa -b 2048
  • Give a different file name like id_vscode

  • Press enter when prompted for a passphrase

    • keys will now be generated in your home directory
  • Open the .pub file that was just created and copy the contents into the clipboard

    • navigate to your remote machine's .ssh > authorized_keys file and paste and save
  • Open your ssh config within vscode (command + shift + P)

    • under the remote's entry in this file, add a IdentityFile field and paste the directory of your private key file after it (e.g., the file with no .pub extension)