Create Sudo User on Ubuntu 22.04 Tutorial Example




Create Sudo User on Ubuntu 22.04 Tutorial Example

Hi Guys,

Now, let's see example of Create Sudo User on Ubuntu 22.04 Tutorial Example. step by step explain Create a Sudo User on Ubuntu. we will help you to give example of Configure Sudo User on Ubuntu 22.04. it's simple example of A complete guide on creating a Sudo User on Ubuntu 22.04 LTS. Follow bellow tutorial step of Step-by-step Sudo User on Ubuntu.

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