Raspberry Pi Setup
prepare sd card and install headless raspbian, use Using Raspberry Pi Imager as described here https://www.raspberrypi.org/documentation/installation/installing-images/README.md
to enable ssh, create a file called ‘ssh’ on the pi’s boot folder
cd /Volumes/boot
touch ssh
attach to power, let it boot, find the IP for example from your router’s menu, then connect to it
ssh-copy-id -i ~/.ssh/id_XXXXXXXX pi@192.168.1.xxx
(the default password is raspberry)
and from now on simply connect through
ssh pi@192.168.1.xxx
change default password next
passwd
sudo adduser lars
sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi lars
sudo su - lars
log out, copy key over also for new user
ssh-copy-id -i ~/.ssh/id_rsa lars@192.168.1.42
apt install openssh-server
sudo nano /etc/ssh/sshd_config
add AllowUsers lars
restart service
sudo systemctl restart ssh
sudo apt install ufw
sudo ufw allow 80/tcp
sudo ufw allow 53/tcp
sudo ufw allow 53/udp
sudo ufw allow 67/tcp
sudo ufw allow 67/udp
ufw enable
chron job auto updates
# m h dom mon dow command
0 2 * * * sudo apt -y update
0 3 * * * sudo apt -y dist-upgrade
0 4 * * * sudo apt -y install openssh-server
0 5 * * * sudo pihole -up 2>/home/lars/logs/cronlog.txt
because otherwise i had trouble editing files
.vimrc
set nocompatible