• Techblog369, India
  • December 1, 2022

Create a simple password strength indicator with JavaScript

You’ve probably seen many examples of password strength indicators around the web. They let users know the password they’re using is weak and indicate how the strength changes when it’s modified. …

How to create PHP QR code and Save it to Database?

Hi In this Article I am going to show how to create QR code and save it to database also fetch QR Code in a Table Create a Page addqrcode.php in …


In this article, I am showing how to create a non-root user on Ubuntu 20.04Server.

How to create a non-root user on Ubuntu 20.04 Server. I have already installed Ubuntu Server on DigitalOcean. Hope you have also installed Ubuntu Server. Here I am only showing how to create a non-root user.
Initial Login

We will use an SSH Client to get access to the server’s terminal (this remote computer), and once we have access
to the terminal, we can start executing commands on this server. You can also use putty software for the same, but in
this article, I am using SSH Client.

Execute the following command on the PowerShell or terminal

ssh root@your_server_ip

Enter the password provided by your service provider. We have created a password in DigitalOcean, which we will
enter here. Once you enter the password when prompted, you will be logged in as root.

The root user is a user having the highest privileges on the server. This means that a root user can do anything and
everything on the server. This is why it is strongly discouraged to use a root account as it might accidentally
delete files/uninstall programs/install programs etc. Hence we will create a user who will have restricted permissions on the server for day-to-day use.

Creating a non-root user
Now we are creating the non-root user Execute following command

  • adduser username

You will be asked to enter some information and a password. Choose a strong password to avoid getting hacked!

We have successfully created an account with basic access. We want this user to be able to elevate to root access when required. This will be useful when you want to use your server and sometimes do something which requires root
access.

Execute the following command on the server:

  • usermod -aG sudo username

Firewall setup

Our server is public, and we want to protect it from external unwanted connections. We want only selected services
exposed to the public on our server.

We will set up the UFW firewall on our Ubuntu 20.04 server and allow OpenSSH, which allows us to connect to our
server.

Execute the following command to allow OpenSSH:

  • ufw allow OpenSSH
  • ufw enable

The firewall will now block all the connections except SSH

You have successfully created a new user. Try to log in through this user in a new terminal tab and verify everything
works before logging out from the current session.

You can type the following command to elevate to the root access as and when required.

  • sudo su
  • exit

Note: Please check is successfully user-created or not, So open a new terminal and paste the below code

  • ssh username@your_server_ip

If successfully logged in then you have to set up a firewall for OpenSSH. it is recommended that you should not log out from the root user until the setup of the firewall.

Author

nw.ippm@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *