System

Installation

Download balenaEtcher Make a blank file on the image named: ssh Then you can use ssh to connect.

Security

Password and ssh

How to SSH Properly https://gravitational.com/blog/how-to-ssh-properly/ To save time elevate yourself to super user
sudo su
sudo -s # Alternatively, gives root access, but maintains current SHELL

Update and Upgrade

Raspbian Pi Firmware Update http://www.futurity.co.uk/raspberry-pi-help/how-to-make-raspbian-jessie-lite-even-smaller-lighter/ Other cleanup https://www.raspberrypi.org/forums/viewtopic.php?t=217664 apt update apt -y upgrade apt -y dist-upgrade apt -y autoremove apt -y autoremove -purge ??? apt clean Danger Danger apt install rpi-update rpi-update reboot

Enabling VNC Remote Desktop Enable in raspi-config May fail, need to also set display resolution in raspi-config

Static IP

Set IP Address

https://www.ionos.ca/digitalguide/server/configuration/provide-raspberry-pi-with-a-static-ip-address/ Check whether DHCPCD is already activated using the following command:
service dhcpcd status
In case it’s not, activate DHCPCD as follows:
service dhcpcd start
systemctl enable dhcpcd
For the editing of the activated DHCPCDs, start by opening the configuration file
nano /etc/dhcpcd.conf
Example of section to change
interface eth0
static ip_address=192.168.0.4/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
reboot

Set the area and time zone

raspi-config

Disk Management

df
fdisk -l
List of fdisk things: how to list, format etc. GUI: gparted

Copying Files

SCP

scp username@from_host:file.txt /local/directory/ # remote to local
scp file.txt username@to_host:/remote/directory/ # local to remote
scp -r username@from_host:/remote/directory/ /local/directory/ # directory remote to local
scp -r /local/directory/ username@to_host:/remote/directory/ # directory local to remote
scp username@from_host:/remote/directory/file.txt username@to_host:/remote/directory/ # file remote host to remote

Backups

https://www.raspberrypi.org/forums/viewtopic.php?t=184316 What model of “USB micro SD reader”? (Make, model, link or picture perhaps?) What does lsusb and usb-devices report when it’s plugged in? (I’ve used quite a few**, but prefer those supplied by a uSDHC card manufacturer). Are you sure the USB reader/writer is /dev/sda? (ie. you don’t have any other USB storage devices plugged as well?)
lsblk
blkid
fdisk -l

Mounting

Create Mount point
mkdir /media/usb
mount /dev/sdxxx /media/usb
unmount /media/usb
  Hot tip get usb mount

Now install USBmount from the repositories:

sudo apt-get install usbmount
 

To use NTFS

sudo apt-get install ntfs-3g
Alternative using udiskctl

Image Backup

dd bs=4M if=/dev/sda2 of=./filename.img

Veeam Backup for Linux

Veeam provides a suite of backup tools. I use the free versions on my personal Windows machines. There is also a free Linux version. I am using the non-GUI version on an Ubuntu server now. More information on setup here. There is also Clonezilla https://clonezilla.org/show-live-doc-content.php?topic=clonezilla-live/doc/11_lite_server

Setting up Raspberry Pi as a VPN Server

PCMag How to Create a VPN Server With Raspberry Pi This article uses Open VPN. I did it with WireGuard. Works great! You can pretty well go with the defaults
curl -L https://install.pivpn.io | bash
To add a client configuration you run the following. Note each client must have a unique configuration file.
pivpn add
https://confluence.jaytaala.com/display/TKB/Mount+drive+in+linux+and+set+auto-mount+at+boot lsblk sdb 8:16 0 2.7T 0 disk ├─sdb1 8:17 0 128M 0 part └─sdb2 8:18 0 2.7T 0 part sudo mkdir /media/data sudo mount /dev/sdb2 /media/data If NTFS Disk gives errors do this Thanks: https://askubuntu.com/questions/462381/cant-mount-ntfs-drive-the-disk-contains-an-unclean-file-system sudo ntfsfix /dev/sdXY https://ubuntuforums.org/showthread.php?t=1880423 Auto-mount at boot We want the drive to auto-mount at boot. This usually means editing /etc/fstab. Firstly, it’s always best to use the drives UUID. To find the drive’s UUID do misterian@biggy:~$ ls -al /dev/disk/by-uuid/ lrwxrwxrwx 1 root root 10 May 11 21:33 56B84885B8486619 -> ../../sdb2 Need to edit fstab, need type of file sudo nano /etc/fstab example in page # data drive UUID=19fa40a3-fd17-412f-9063-a29ca0e75f93 /media/data ext4 defaults 0 0 but type is not ext4 in this case, look it up misterian@biggy:/media/data/testing$ mount | grep sdb /dev/sdb2 on /media/data type fuseblk (rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096) https://ubuntuforums.org/showthread.php?t=1880423 Mine UUID=56B84885B8486619 /media/data ntfs defaults,nls=utf8,umask=000,uid=1000,windows_names 0 0 Use the following as a template: [a] Run the following command to get the right UUID number for your partition: Code: sudo blkid -c /dev/null [b] Unmount the partition from Nautilus if you currently have it mounted Create a permanent mount point: Code: sudo mkdir /media/DriveD [d] Add the following line to /etc/fstab: Code: UUID=DA9056C19056A3B3 /media/DriveD ntfs defaults,nls=utf8,umask=000,uid=1000,windows_names 0 0 sudo chmod not working to change execute permissions! https://ubuntuforums.org/showthread.php?t=1880238 https://askubuntu.com/questions/37767/how-to-access-a-usb-flash-drive-from-the-terminal/865453#865453 https://confluence.jaytaala.com/display/TKB/Mount+drive+in+linux+and+set+auto-mount+at+boot Make sure you run apt-get update/upgrade before starting the installation: sudo apt-get update && sudo apt-get upgrade Now install USBmount from the repositories: sudo apt-get install usbmount USBmount mounts all USB drives in /media/usb* (usb0, usb1, usb2 …) Now plug a USB drive and wait for it to be detected and mounted. As long as the host OS supports the File System it should be mounted. To verify whether the USB drive was mounted correctly you can use df -h to view all available drives and their respective mount points To un-mount a drive you can use umount. sudo umount /media/usb0 shareimprove this answerfollow answered May 14 ’16 at 16:35 Sandro 6111 silver badge33 bronze badges add a comment 3 That’s simple. When I want to use a usb drive in terminal I do this: Create a folder in /media with: mkdir /media/mountDrive This folder will be used for the mount point. Use this command: sudo mount /dev/sdd1 /media/mountDrive sdd1 is the first partition of my USB. Then you can navigate to folder you already mounted with cd /media/mountDrive If you want to list the files in drive you can use the ls command. To unmount the drive you can use sudo umount /dev/sdd1 Note that in my system the usb drive is /dev/sdd1, but in your system it may be something different. To find out what it is use the df command to see all disks connected at the present time. ————- Mount drive Make a folder (will be mount point) sudo mkdir /media/data sudo mount /dev/sdb1 /media/data Now you can access the drive at /media/data. Auto-mount at boot We want the drive to auto-mount at boot. This usually means editing /etc/fstab. Firstly, it’s always best to use the drives UUID. To find the drive’s UUID do ls -al /dev/disk/by-uuid/ Copy the resultant UUID (for your disk) and then open fstab for editing: sudo nano /etc/fstab You want to add an entry for the UUID and mount point. Below is an example of an fstab file with an entry added for the mount above: # /etc/fstab: static file system information. # # Use ‘blkid’ to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # # / was on /dev/sdb1 during installation UUID=63a46dce-b895-4c1f-9034-b1104694a956 / ext4 errors=remount-ro 0 1 # swap was on /dev/sdb5 during installation UUID=b9b9ee49-c69c-475b-894b-1279d44034ae none swap sw 0 0 # data drive UUID=19fa40a3-fd17-412f-9063-a29ca0e75f93 /media/data ext4 defaults 0 0 Note: the entry added is the last line. Test fstab We always want to test the fstab before rebooting (an incorrect fstab can render a disk unbootable). To test do: sudo mount -a If nothing is returned (e.g. no errors) then you should be good to go. Unmounting drive with umount You can unmount drives using umount. For example, to unmount the data drive above mount at /media/data you would do: sudo umount /media/data