How To Create New Sudo User on Ubuntu 22.04

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

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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