Rasppbery Pi Base Setup – Headless
Rasppbery Pi Base Setup – Headless

Rasppbery Pi Base Setup – Headless

Setting up the Pi

To set up the Pi, I got the latest version from https://www.raspberrypi.org and got the lite one. I only want to have on there the apps I will use. Then wrote the image to the SD card, before I put it in the Pi I set it up to boot with SSH enabled. If i want it to connect to my wifi on boot See here

Once it has booted, SSH in to the Pi and run updates.

sudo apt-get update
sudo apt-get upgrade

Then change the hostname, I use raspi-config, cheating i know :p

Then change the default user and add the new user to sudo

sudo adduser bob
sudo adduser bob sudo

Now login as Bob via SSH and remove the Pi user.

sudo userdel -r pi

Setup SSH Public Key Authentication and copy my public key to .ssh/authorized_keys

Then I secure SSH from /etc/ssh/sshd_config

Port 22
LoginGraceTime 20
PermitRootLogin no
MaxAuthTries 3
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
PasswordAuthentication no
PermitEmptyPasswords no
KerberosAuthentication no
GSSAPIAuthentication no
UsePAM yes
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
ClientAliveInterval 300
PermitTunnel no
Banner none

I dont set a static IP but use DHCP reservations from the router.

Will add more as I think of it. things like backups and auto updates

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.