To create a non root user on The VPS Server, You have an Access of your VPS server.
For Example, here we have a VPS Server purchase from Hostinger. It's not compulsory, you can use any VPS service provider like :

Digitalocean
Hostinger
HostGator
Ionos
A2 Hosting
Liquidweb
Bluehost
UltaHost
DreamHost
GoDaddy and many more.


 

Let's say we choose Hostinger as a VPS.

Now you have to set up your VPS as per instructions and get an IP address for that VPS.

vps image

 

You only need to things to create a new user on VPS.

  1. IP address of that VPS
  2. Password of that VPS

On My VPS:
IP Address is : 195.35.20.80
Password is : Eeeee@123456

Let's start to create user on VPS:


 

Login in to the VPS server using root user:

Open Your Terminal or Powershell and Type:

ssh root@your_ip_address

In my case it looks like:

ssh [email protected]

After typing hit enter.

It Looks like:

vps server user login

Now type yes and hit enter.

After that Enter the Password that you set when you setup your VPS.

Note: Remember! When you enter your password you do not see that. Due to Security reasons. 

After That, it looks like this:

C:\Users\17nru>ssh [email protected]
[email protected]'s password:
Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-49-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Thu Jan 16 16:51:53 UTC 2025

  System load:  0.0               Processes:             97
  Usage of /:   4.2% of 47.39GB   Users logged in:       0
  Memory usage: 5%                IPv4 address for eth0: 192.35.20.80
  Swap usage:   0%                IPv6 address for eth0: 2a02:4784:12:111a::1

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

root@srv691477:~#

 

Creating a non-root user:

Syntax:

adduser new_user_name

In my case it looks like:

adduser theagleye

And hit enter.

Now create a new password for this user. Enter the password or Retype password. And hit enter.

Then it asks for basic information, if you want to add then you can otherwise just skip them by pressing enter.

After that it Looks like:

root@srv691477:~# adduser theagleye
info: Adding user `theagleye' ...
info: Selecting UID/GID from range 1000 to 59999 ...
info: Adding new group `theagleye' (1001) ...
info: Adding new user `theagleye' (1001) with group `theagleye (1001)' ...
info: Creating home directory `/home/theagleye' ...
info: Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for theagleye
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y
info: Adding new user `theagleye' to supplemental / extra groups `users' ...
info: Adding user `theagleye' to group `users' ...
root@srv691477:~#

Now we successfully create a user with their username and password.
But this user have only basic access to VPS.


 

Giving root permissions to the user:

Let's make the user little more powerful or giving some root permissions.

By the command:

usermod -aG sudo user_name

In my case:

usermod -aG sudo theagleye

After hitting enter, now user have root permissions.

Our VPS server is public, and we needwant to protect it from external unwanted connections.
For that We will set up the UFW firewall on our Ubuntu 20.04 server and allow OpenSSH.
Execute these commands to allow OpenSSH:

ufw allow OpenSSH
ufw enable

And all set.


 

Change user from root to newly created user using su command:

Now let's login to the VPS server using our new user:

su user_name

In my Case

su theagleye

It Shows like:

root@srv691477:~# su theagleye
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

theagleye@srv691477:/root$

 

Login to VPS server by the created user:

This was simple becasue we only move from root user to new created user.

If we have to direct login to VPS using the new user. Then open your terminal and type:

ssh user_name@your_ip_address

In my case it looks like:

ssh user_name@your_ip_address

It looks like:

C:\Users\17nru>ssh [email protected]
[email protected]'s password:              #enter password for this user
Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-49-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Thu Jan 16 17:30:59 UTC 2025

  System load:  0.0               Processes:             99
  Usage of /:   4.4% of 47.39GB   Users logged in:       0
  Memory usage: 5%                IPv4 address for eth0: 195.35.20.80
  Swap usage:   0%                IPv6 address for eth0: 2a02:4780:12:111a::1

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

theagleye@srv691477:~$

And all set.

And all set! We just learn how to create user on VPS using very simple commands.

 

Leave a comment

You must be logged in to post a comment.

0 Comments