YouTube Icon

Code Playground.

How To Create a Sudo User on Ubuntu

CFG

How To Create a Sudo User on Ubuntu

The sudo order is intended to permit clients to run programs with the security advantages of another client, naturally the root client. 

In this guide, we will tell you the best way to make another client with sudo access on Ubuntu frameworks. You would then be able to utilize this client record to execute authoritative orders without a need to signing in to your Ubuntu worker as a root client. 

Steps to Create a Sudo User

Follow the means beneath to make another client record and give it sudo access. On the off chance that you need to design sudo for a current client, jump to stage 3. 

1. Log in to your server.

Sign in to your framework as the root client: 

ssh root@server_ip_address

2. Create a new user account.

Make another client account utilizing the adduser order. Remember to supplant username with the client name that you need to make: 


adduser username

You will be incited to set and affirm the new client secret phrase. Ensure that the secret key for the new record is as solid as could reasonably be expected. 

Adding user `username' ...
Adding new group `username' (1001) ...
Adding new user `username' (1001) with group `username' ...
Creating home directory `/home/username' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully

When you set the secret key the order will make a home catalog for the client, duplicate a few arrangement records in the home registry, and prompts you to set the new client's data. On the off chance that you need to leave the entirety of this data clear press ENTER to acknowledge the defaults. 

Changing the user information for username
Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
Is the information correct? [Y/n]

3. Add the new user to the sudo group

Naturally on Ubuntu frameworks, individuals from the gathering sudo are allowed with sudo access. To add the client you made to the sudo bunch utilize the usermod order: 

usermod -aG sudo username

Test the sudo access

Change to the recently made client: 

su - username

Use sudo to run the whoami order: 

sudo whoami

Is the client have sudo access then the yield of the whoami order will be "root": 

root

How to use sudo

To utilize sudo, essentially prefix the order with sudo and space: 

sudo ls -l /root

The first occasion when you use sudo in a meeting, you will be incited to enter the client secret key: 

[sudo] password for username:

Conclusion

You have figured out how to make a client with sudo advantages. You would now be able to sign in to your Ubuntu worker with this client record and use sudo to run regulatory orders. 

There's nothing more to it! Don't hesitate to leave a remark in the event that you have any inquiries.




CFG