The Personal Website of Jeremy Boles

Remote Server

Getting a new box to a state I trust.

I run my servers on Debian. It’s stable, it’s reliable, and it runs just about everywhere, including cheap-ass bare-metal boxes and every VPS provider I’ve ever come across. Everything below assumes a clean install.

Set Up Users

First, change the root password. Hosting providers will often set up an admin user for you, in which case switch to root first. If all you have is a root account, skip the su and go straight to passwd.

sudo su -
passwd
exit

Create a user for yourself, and make sure it can use sudo.

sudo adduser jb
sudo usermod -aG sudo jb

Switch to it, then add your public SSH key to its authorized_keys and set the permissions properly.

su jb
cd ~
mkdir ~/.ssh
vi ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Configure SSH

Make sure people can only log in with a key, and that root can’t log in at all.

PermitRootLogin no
PasswordAuthentication no
PermitEmptyPasswords no
sudo systemctl restart sshd

Set Up a Firewall

Allow SSH before enabling it, so you don’t lock yourself out of the box you’re standing on.

sudo apt install ufw
sudo ufw allow OpenSSH
sudo ufw enable

Hostname, Updates, Reboot

sudo hostnamectl set-hostname server
sudo apt update
sudo apt upgrade
sudo reboot now