Initial server setup with Ubuntu 20.04

In this article, we will teach you the initial server setup with Ubuntu 20.04. The important point about this article is that, before starting with Ubuntu 20.04, you need to make some basic settings for its preparation and security, which are fully mentioned in this article.

Initial server setup with Ubuntu 20.04

Root login on Ubuntu 20.04

If you aren’t connected to your server, log in as the root.

Note: if you use Linux based system for connecting to the Ubuntu server use the following command in the other hand if you use Windows, use software like Putty then enter the following command:


If it is your first time logging into the server, you should change the root password with a password.

Create a new user on Ubuntu 20.04

You can add a user on Ubuntu 20.04 with the following command:

Note: In the following example, a username called Orca will be created.

adduser orca

It will ask you for a password and choose a strong password for your new user.

Root privileges

If a user wants to access the root privileges for the initial server setup on Ubuntu 20.04, the user should join the “sudo” group. Only sudoers have to access the root privileges.
To add your new user to the “sudo” group run the following command:

usermod -aG sudo orca

Now your user has to access the root privileges by using “sudo” before each command.

Setup a basic firewall on Ubuntu 20.04

For basic server setup on Ubuntu 20.04, you need to set up a basic firewall. The default firewall configuration tool for Ubuntu is UFW.
Use the following command to see available applications in your output:

ufw app list

Then allow openSSH from it by the following command:

ufw allow openSSH

After that enable the firewall:

ufw enable

Enter ‘y’ and you can see SSH connections with the following command:

ufw status

Now you can SSH to your new account. Open a new terminal and run the following command:

ssh username@your_server_ip

Then enter your user password to log in.
If you want to use root privileges as we mentioned before you should use sudo before each command.

sudo command-to-run

Note: if the root account uses SSH key authentication you need to add a copy of your local public key to the new user’s ~/.ssh/authorized_keys file to log in successfully. The simple way is to use the Rsync command:

rsync --archive --chown=username:username ~/.ssh /home/username

Now SSH to your new user without using a password:

ssh username@your_server_ip

Remember you need a user password for each time you use sudo for your command.

Note: if you don’t have an SSH key you can easily create a new one by visiting this article about How to generate SSH key pairs in Linux.

I hope you enjoy this article about the initial server setup with Ubuntu 20.04.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!