Personal Guide to VPS

This will be my go-to guide for whenever I need to setup a VPS instance, so that I don’t have to memorize it by heart.

Creating a new user
adduser lashoun  # user-friendly version of useradd
usermod -aG sudo lashoun  # add to sudoers group

The next commands will be issued as the lashoun user.

Updating packages
sudo apt update
sudo apt upgrade

First, to avoid getting locked out, copy the contents of /root/.ssh/authorized_keys to /home/lashoun/.ssh/authorized_keys. Then,

sudo vim /etc/ssh/sshd_config

Once inside sshd_config, uncomment and set those lines with those values:

Port CUSTOM_PORT  # changing port helps avoiding script kiddies
PermitRootLogin no
PasswordAuthentication no  # only allow key authentication
systemctl restart ssh

Now, let’s put a trap for people knocking on port 22. We’ll use endlessh:

sudo apt install git gcc make build-essentials
cd ~; mkdir utilities; cd utilities
git clone
sudo ./endlessh -p 22 &  # launches the trap for port 22

If you don’t feel like tinkering with the system, Docker, and proxies — which I can understand — or if you need only basic selfhosted systems (cloud, calendar, pastebin, etc.), just install Yunohost as root!

curl | bash
comments powered by Disqus