Initial Server Setup with Ubuntu 22.04

In this article, we intend to show you an Initial Server Setup with Ubuntu 22.04.

When you first create a new Ubuntu 22.04 server, you should perform some important configuration steps as part of the initial setup.

Initial Server Setup with Ubuntu 22.04

To know more about Ubuntu 22.04, you can follow our guide Introduce Ubuntu 22.04 and IT’s New Features.

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:

ssh [email protected]_IP_ADDRESS

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 22.04

You can add a user on Ubuntu 22.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 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 22.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 22.04

For basic server setup on Ubuntu 22.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 [email protected]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 [email protected]_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.

Conclusion

At this point, you learn an Initial Server Setup with Ubuntu 22.04.

Hope you enjoy it.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular