Ubuntu Server

How to set up your Ubuntu 18.04 server

In this tutorial, we shall go through the initial steps required to set up an Ubuntu server. The configurations we will discuss will enhance the security and usability of the server. We will be using an Ubuntu 18.04 LTS image.

Step 1: Setting up the instance on CloudSigma

I am using a machine with the following resources:

  • 8 GHz CPU
  • 8 GB RAM
  • 50 GB SSD

I am cloning Ubuntu 18.04 from the library and resizing it to 50 GB. Ubuntu 18.04 on the library comes pre-installed with 64bit with VirtIO drivers, superuser, Python 2.7.17, Pip 20.0.2 OpenSSL 1.1.1d, Cloud-init and latest updates until 2019-03-03.

It is not recommended to use the root user as it has very broad privileges and should only be used for very specific activities. Therefore we should create a different user with lesser privileges. Fortunately for us, images provided by CloudSigma already have a user ‘cloudsigma’ created.

I have linked an ssh key with my instance to access the machine. We will now set up a password for user ‘cloudsigma’ to access it without the key.

Step 2: Allowing Login Using Passwords

It is recommended to access the server using ssh keys rather than passwords, but if you need to access it using passwords, you can follow the steps below:

First, use the following command to set a password for the user – cloudsigma:


After that password is set, we will enable login using a password in sshd configurations using the following commands:

Now you can access ssh to your Ubuntu server using passwords as well.

Step 3: Creating Additional Users

We can always create a new user for a particular user. I will create a user on my name to use it for this tutorial.

Once I run the above command, the system asks me for a password and some information. Once I fill those in, it creates a user for me.

Step 4: Granting Administrative Privileges

With the previous step, we have got a user with regular permissions and privileges. However, some of your users might have to do administrative tasks as well. To avoid switching between the root user and their user account, we can add them to the sudo user/superuser list. With that, the users will able to run commands with root user privileges by adding the ‘sudo’ keyword before the command.

To add user ‘akshay’ to the list, we can run this command from root user or cloudsigma user, which is already a superuser.

After running this command, we can run commands with administrative privileges from user ‘akshay’ as well by adding the keyword ‘sudo’.

Step 5: Setting up a Basic Firewall

We can use the UFW – Uncomplicated Firewall, part of Ubuntu 18.04 OS, to ensure only connections to trusted applications are allowed. With UFW, profiles can be registered by different applications which can be used to manage them. OpenSSH is the application that lets us establish a connection to our server. It already has a profile registered with UFW with the name OpenSSH.

We can see the app profiles with this command:


We need to ensure that OpenSSH is in the allow list so we can log on the next time or the firewall will block the connection. We can run the following command to do the same:

Next, once we have added the application to the allow list, we will enable the firewall by using the command:

After that, we can check the status of the firewall and the application in it’s allow list by using the command:


Finally, as we have configured the firewall to only allow SSH connections, other applications would have to be configured when installed to allow the traffic.

Our Ubuntu server is now set up and ready to be used!