How to Create a User with sudo access in Linux [3 Steps]

In this article, We are going to cover How to Create a User with sudo access in Linux or any other cloud platform like Amazon EC2, Azure VM, Google Cloud Compute, etc. with preinstalled Linux OS.

Step #1: How to Create a User with sudo access in Linux

First create a user in Linux with adduser command

sudo adduser devopsbyrushi

output:

Adding user `devopsbyrushi' ...
Adding new group `devopsbyrushi' (1001) ...
Adding new user `devopsbyrushi' (1001) with group `devopsbyrushi' ...
Creating home directory `/home/devopsbyrushi' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for devopsbyrushi
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] y

Step #2 : changing sshd configuration file

once user created, open sshd config file.

sudo nano /etc/ssh/sshd_config

File looks like below PasswordAuthentication no

# To disable tunneled clear text passwords, change to no here!

PasswordAuthentication no

Change to PasswordAuthentication yes

# To disable tunneled clear text passwords, change to no here!

PasswordAuthentication yes

once changed Save and Exit.

Step #3: updating in sudoers file

open the visudo file to give the sudo access

sudo visudo

add the new user in visudo as shown below.

# User privilege specification
root    ALL=(ALL:ALL) ALL
devopsbyrushi ALL=(ALL:ALL) ALL

Conclusion:

We have covered How to Create a User with sudo access in Linux.

Related Articles:

MySQL Tutorials

Reference

Linux official page

Rushikesh Neerukondi

I am Rushikesh Neerukondi working as DevOps Engineer and Cloud Solution Architect.Likes to Share Knowledge.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link