Configuring a Raspberry Pi as a Linux Network Appliance

2018-11-01

Initial setup

Configure keyboard

sudo raspi-config

Enable SSH service

sudo raspi-config

Get IP address

hostname -I

From now on you can remotely access the system from an SSH client at this IP address, which we’ll refer to as ip below.

Expand filesystem

sudo raspi-config

Create new root user

sudo adduser newuser
sudo adduser newuser sudo

Remove default pi user

sudo deluser --remove-home pi

Copy SSH public key to system

From your client machine:

ssh-copy-id newuser@ip

Lock down SSH config

Add the following to /etc/ssh/sshd_config to enforce public key authentication etc.:

Protocol 2
PasswordAuthentication no
PermitRootLogin no
PubkeyAuthentication yes
AuthenticationMethods publickey
AllowUsers newuser
PermitEmptyPasswords no

Change your host name

Edit the host name file:

sudo nano /etc/hostname

Then replace occurrences of raspberrypi with the new host name:

sudo nano /etc/hosts

Then reboot your system:

sudo reboot
Tags: Raspberry Pi, Raspbian, Linux

All content © 2018 Richard Cook. All rights reserved.