How to create a sudo user on your server
Creating a sudo user on your server allows you to manage administrative tasks securely without needing to use the root account directly. A sudo user has permission to execute commands with root privileges, which adds a layer of security to your system. Requirements Step 1: Log in to Your Server โ St
Creating a sudo user on your server allows you to manage administrative tasks securely without needing to use the root account directly. A sudo user has permission to execute commands with root privileges, which adds a layer of security to your system.
Requirements
- Root SSH access to the server.
Step 1: Log in to Your Server โ
- Log in to the server via SSH using these steps
Step 2: Create a New User
- Once logged in, create a new user by running the following command. Replace
newuserwith the desired username. This command creates a new user and its home directory.
adduser newuser
- Replace
newuserwith the desired username. This command creates a new user and its home directory. In the image below, we are creating a user called tke - You may be asked to input user details as in the image below. Youn can put them or just hit Enter key to proceed

- Now, set a password for the newly created user using the command below, again replacing new user with the name of your actual user that you just created
passwd newuser
- You will be prompted to enter and confirm a password.
Step 3: Add the User to the Sudo Group
- To grant the new user sudo privileges, add the user to the sudo or wheel group based on your OS destribution.
- On most Linux distributions, users in this groups are allowed to use
sudoto run commands with root privileges. - On Ubuntu, Linux Mint, Debian and other Debian-based OSes, use the command below to add your user to sudo group.
usermod -aG sudo newuser
- For CentOS, Almalinux or RedHat systems, use the wheel group instead:
usermod -aG wheel newuser
- The
-aGoption adds the user to the specified group (sudoin this case) without removing it from other groups.

Step 4: Verify Sudo Access
- To verify that the new user has sudo privileges, log out from the root account:
exit
- Log in again using the newly created user:
ssh newuser@your_server_ip
- Test sudo privileges by running a simple command such as the one below
- When you runt he command, youโll be prompted for the new userโs password.
- If everything is set up correctly, the command will return
root, indicating that the user has sudo privileges. See the highlights in the image below;
sudo whoami

Step 5: Optional โ Customize Sudo Privileges
- You can do other optional tweaks on the server as you desire. These are optional and you should only dot hem if you with. See the important links section below
Important Links
Still need help?Open a support ticket