How to Create New Sudo User on Ubuntu 22.04?

Jul 05, 2022 . Admin

Hi Guys,

In this tutorial, you will learn How to Create New Sudo User on Ubuntu 22.04?. This tutorial will give you simple example of Create new Sudo-enabled User on Ubuntu 22.04. you'll learn Ubuntu 22.04 Create Sudo User. we will help you to give example of Create a new Sudo User on Ubuntu Linux server. So, let's follow few step to create example of 4 ways to Create Sudo User on Ubuntu 22.04.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

Step 1: Log in to the server using ssh

SSH in to your server as the root user:

$ ssh root@your_server_ip_address
Step 2: Create a new user account on Ubuntu

Use the adduser command to add a new user to your system:

# adduser username

Be sure to replace username with the username that you want to create. You will be prompted to create and verify a password for the user:

Step 3: Add the new user to the sudo group

Use the usermod command to add the user to the sudo group:

# usermod -aG sudo username
Step 4: Test sudo user account

To test that the new sudo permissions are working, first use the su command to switch to the new user account:

# su - username

As the new user, verify that you can use sudo by prepending sudo to the command that you want to run with superuser privileges:

$ sudo command_to_run

For example, you can list the contents of the /root directory, which is normally only accessible to the root user:

sudo ls -la /root
#Ubuntu