Installation

Server

# Create user and add to sudo group
adduser louisa # With empty password to prevent password login
usermod -aG sudo louisa
 
# Add ssh dir and auth key
su louisa
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys # Add the public key in authorized_keys
chmod 600 ~/.ssh/authorized_keys
 
# Disallow password auth and root login (Test above before)
sudo nano /etc/ssh/sshd_config
# set lines PasswordAuthentication & PermitRootLogin to no
sudo systemctl restart ssh

Client

# Add ssh keys
nano ~/.ssh/id_ed25519        # Your private key (keep this secret!)
nano ~/.ssh/id_ed25519.pub    # Your public key (safe to share, this is what goes on the server)
 
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub