How To Create/Add Sudo User on Ubuntu 22.04

Create/add sudo user on linux ubuntu 22.04; Through this tutorial, we will learn how to add or create new sudo user on linux ubuntu 22.04 system.

How To Create/Add New Sudo User in Ubuntu 22.04 Terminal

Steps to create or add new sudo user in linux ubuntu 22.04 using command line or terminal:

  • Step 1 – Log in to the server using ssh
  • Step 2 – Create a new user account Ubuntu
  • Step 3 – Ubuntu 22.04 Add User command line to sudo group
  • Step 4 – Test sudo user account

Step 1 – Log in to the server using ssh

Use the following ssh command to login into server:

ssh root@server_ip_address

Step 2 – Create a new user account Ubuntu

Execute the following command on command line to add or create new sudo user on ubuntu:

adduser username

Note that:- replace username with the user name that you want to create.

Once the user has been added; the Prompt box will appear to set and confirm the new user password.

Step 3 – Ubuntu 22.04 Add User command line to sudo group

Use the following command to add the user you created to the sudo group use the usermod command:

usermod -aG sudo username

Step 4 – Test sudo user account

Now, Use the following command to switch to the newly created user:

su - username

Use sudo to run the whoami command:

sudo whoami

Is the user have sudo access then the output of the whoami command will be “root”:

root

Conclusion

Through this tutorial, we 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

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button