How to Create a New User on a Linux VPS

When managing a Linux VPS, it is recommended to create a normal user account instead of performing all actions as the root user.

Using a separate user account helps improve security and reduces the risk of accidental system changes.

This guide explains how to create a new user and give it administrative permissions.

Common Linux distributions used on VPS servers include:


Step 1: Connect to Your Server

First, connect to your server using SSH.

Linux servers are accessed using:

Example:

ssh root@your_server_ip

Once connected, you will have access to the server terminal.


Step 2: Create a New User

To create a new user, run the following command:

adduser username

Replace username with the name you want for the new account.

Example:

adduser adminuser

The system will ask you to create a password and optional user information.


Step 3: Give the User Administrative Permissions

To allow the new user to run administrative commands, add the user to the sudo group.

Run:

usermod -aG sudo username

Example:

usermod -aG sudo adminuser

This allows the user to run commands with administrative privileges using sudo.


Step 4: Test the New User

Log in using the new account to make sure everything works correctly.

Example:

ssh username@your_server_ip

You can test administrative permissions by running:

sudo apt update

If the command runs successfully, the user has administrative access.


Why This Is Important

Using a separate user account improves server security because:


Summary

To create a new user on a Linux VPS:

  1. Connect to your server using SSH

  2. Run adduser username

  3. Add the user to the sudo group

  4. Test the new account

Using a dedicated administrative user is considered a best practice when managing Linux servers.