Techolac - Computer Technology News
  • Home
  • Internet
  • Business
  • Computers
  • Gadgets
  • Lifestyle
  • Phones
  • Travel
  • Tech
  • More
    • Automotive
    • Education
    • Entertainment
    • Health
    • SEO
    • Linux
    • WordPress
    • Home Improvement
    • How to
    • Games
No Result
View All Result
  • Home
  • Internet
  • Business
  • Computers
  • Gadgets
  • Lifestyle
  • Phones
  • Travel
  • Tech
  • More
    • Automotive
    • Education
    • Entertainment
    • Health
    • SEO
    • Linux
    • WordPress
    • Home Improvement
    • How to
    • Games
No Result
View All Result
Techolac - Computer Technology News
No Result
View All Result
Home Linux

How to Add a User to Sudoers on Debian

by Editorial Staff
June 13, 2020
in Linux
Reading Time: 3 mins read

Upon the setup of a new Debian system, a default root account is created. The root user has full system access and privileges and can pretty much do anything on the system that a regular user can’t. Some of the tasks confined only to the root user include installing, updating, upgrading and deleting software packages, modifying configuration files, starting and stopping system services and performing server shutdown and reboots. The root user is powerful, but extremely dangerous because actions performed cannot be undone. Some commands, if issued, can render the system unusable.

To mitigate this risk, there is a need to add a new regular user and later assign root privileges to the user to perform day-to-day administrative privileges when needed. This is possible by issuing sudo before the command, which will elevate the user’s privileges temporarily.

In this guide, we will cover how to create a new user and later on add a user to sudoers group on Debian.

Step 1: Login to your server

To start off,  log into your Debian server as root user  via SSH

# ssh [email protected]

Step 2: Create a new user account

To create a new user in the linux system, we are going to use the adduser command followed by the username

The syntax is shown below:

# adduser  username

In our case, we will add a new user called jack.

#  adduser jack

This command will prompt you for the new user’s password and will later require you to confirm it. Always keep in mind to set a strong password ( One with a combination of Uppercase, lowercase, numerical  & special characters ).

Sample output

add a new user on Debian 10

Once the password has been successfully set, the command will prompt you for additional information about the user as shown below. Fill out the details where applicable and finally hit the ‘Y’ button on the keyboard at the tail end of the prompt to save the changes.

If you wish to leave out all of this information, simply hit ENTER to accept the defaults.

adduser prompts for user information

Information about the new user is stored in the /etc/password file. Therefore, to view information about the user run

# cat /etc/passwd

Step 3: Add the new user to sudoers group

To add the newly created user to sudoers group, use the usermod command as shown in the syntax below:

# usermod -aG sudo username

In our case, to add user Jack to sudoers group, we will run

# usermod -aG sudo jack

Step 4: Testing the user with sudo

The final step is confirming if the new user has sudo privileges.

Switch to the new user as shown

# su - jack

Now, invoke the sudo command followed by any command. in this case, we will run the whoami command.

sudo whoami

This will be followed by a list of a few points you should bear in mind working as a root user.

You will then be prompted for the user’s password and thereafter, the command will be executed.

Sample output

add a user to sudoers group

Closing thoughts

In this guide, you learned how to add a user to sudoers group. As good practice, it is normally recommended to use a regular user in a server system instead of logging in as root. This avoids the likelihood of making a mistake as root user and causing irreversible damage to the server.

Your feedback is most welcome.

 

Related Posts

Top 5 MySQL Performance Tuning Tips
Linux

Top 5 MySQL Performance Tuning Tips

January 25, 2023
Top Commands to Check the Running Processes in Linux
Linux

Top Commands to Check the Running Processes in Linux

May 27, 2022
4 Tips to Prevent and Troubleshoot the ImagePullBackOff Kubernetes Error
Linux

4 Tips to Prevent and Troubleshoot the ImagePullBackOff Kubernetes Error

March 30, 2022

Leave a Reply Cancel reply

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

Recent Articles

  • 30 FZMovies Alternatives To Watch Movies And TV Shows Online
  • Google Search Console Everything It Can Do
  • Top 26 Best AniWorld Alternatives To Watch Anime Free
  • The Power of Good UI/UX Design in Driving Sales: A Comprehensive Guide
  • Use eBook Content Development to Enhance Your Real Estate Business
  • 30 CoolMovieZone Alternatives To Watch Movies HD Online
  • Private Equity Trends: Expectations Vs Reality
  • DashTech
  • TechDaddy
  • Terms and Conditions
  • Disclaimer
  • Write for us

© Techolac © Copyright 2019 - 2022, All Rights Reserved.

No Result
View All Result
  • Home
  • Internet
  • Business
  • Computers
  • Gadgets
  • Lifestyle
  • Phones
  • Travel
  • Tech
  • More
    • Automotive
    • Education
    • Entertainment
    • Health
    • SEO
    • Linux
    • WordPress
    • Home Improvement
    • How to
    • Games

© Techolac © Copyright 2019 - 2022, All Rights Reserved.