Guide – New Linux installation Hetzner Cloud

This is a very simple guide to setup a new server with basic tweaks to root and access.

First we have to create a new server via Hetzner Cloud portal.

I’m going to go with CPX11 with 40GB SSD and public IPv4.

After creating the server we will get our login credentials via email attached to our Hetzner account.

Sign in to the newly created VM and first of all let’s change the password for root and make it unable to use via SSH also let’s create a new account to use and enable UFW.

sudo ufw allow 22
sudo ufw enable

Now let’s create a new user for us to use.

sudo adduser <name>

Now we can add sudo rights. I also like to add admin group.
We also want to reboot after, so we can lock up root password.

sudo adduser <name> sudo
sudo adduser <name> admin
sudo reboot

Let’s lock root password.

sudo usermod –lock root

Now we can disable root ssh login by editing sshd_config file.

sudo nano /etc/ssh/sshd_config
Edit: PermitRootLogin yes -> PermitRootLogin no
sudo systemctl restart ssh.service

You can still access root user via command.

sudo su

Let’s update our packages and system.
Depends on your case, you can reboot after if you want to.

sudo apt-get update
sudo apt-get upgrade
sudo reboot

We are now ready to rock and roll what ever we want with server!

Leave a Reply