How To Create New Sudo User on Ubuntu 22.04

[ad_1]

To create a new user and add it to sudo in Ubuntu; For this, you have to start the command line and type sudo adduser USERNAME command in it to add new user, after that, type usermod -aG sudo USERNAME command in it to add sudo to linux ubuntu server.

How To Create OR Add New Sudo User in Ubuntu 22.04

Here are some steps to create new user and add to sudo in linux ubuntu 22.04 via command line or terminal:

Step 1 – Log in to the server using ssh

Start your ssh command line and type ssh root@server_ip_address command on linux ubuntu command line to connect as root user:

ssh root@server_ip_address

Step 2 – Create a New User Account Ubuntu

Now you are logged in to the server as the root user, To create a new user you have to type sudo adduser USERNAME command on the command line and press Enter.

sudo adduser USERNAME

In this command replace USERNAME with the name you want to create the user with, and then use the command.

On running the command, you will be prompted to set a password for the user you are adding on the command line, so type the password and press Enter.

Step 3 – Add User to Sudo Group Ubuntu

Add the created user to the sudo group, simply type usermod -aG sudo username command on linux ubuntu command line and press enter:

usermod -aG sudo username

In this command replace USERNAME with the name you want to add new user to sudo group with, and then use the command.

Step 4 – Verify New Sudo User Account

After you have created the user and added him to the sudo group, you will then need to verify whether the sudo privileges are working properly or not, For this you have to type the su - username command on the command line, then it will switch your new user account:

su - username

And if you type the sudo whoami command on a terminal window it will tell you which user you are in linux ubuntu system:

sudo whoami

Now you will see something like this output on the command line:

root

Here is the video guide on how to create a new user and add to sudo user access on Ubuntu Linux:

Conclusion

Through this tutorial, you have learned how to create a user with sudo privileges. And can now log in to Ubuntu server with this user account and use sudo to run administrative commands.

Recommended Linux Ubuntu Tutorials

[ad_2]

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
Jassweb, Rai Chak, Punjab, India. 143518