Skip to content
Create account

First steps on a new Linux server

Five things to do right after your first login: update, create a user, use SSH keys, turn on the firewall and take a snapshot.

These commands are for Ubuntu and Debian. On AlmaLinux, Rocky Linux and Fedora use dnf instead of apt.

1. Install updates

apt update && apt upgrade -y

2. Create your own user

Working as root all the time is risky. Create a user that can use sudo:

adduser alex
usermod -aG sudo alex

3. Log in with a key, not a password

Add your SSH key (see "Connect to your Linux server with SSH"), check that you can log in with it, and only then turn password logins off. In /etc/ssh/sshd_config set:

PasswordAuthentication no

Then restart SSH with systemctl restart ssh. Keep your current session open until a second login with the key has worked.

4. Turn on the firewall

ufw allow OpenSSH
ufw allow 80,443/tcp
ufw enable

Open only the ports you really use.

5. Take a snapshot

When the server is set up the way you want, take a snapshot on the server's page. If something breaks later, you can return to this state.

Good to know

Outgoing connections on port 25 (mail delivery) are blocked on our Linux servers to prevent spam. To send email from your application, use a mail service through port 587 or its API.

More articles

Still need help?

Ask the assistant in the corner of the page or open a ticket. No question is too small.

Open a ticket