2 Ways to Add Users to SUDOERS Group in Debian

2 min

Here’s how you can add users to the SUDOERS group in Debian Linux.

In Debian Linux, the SUDOERS group plays a crucial role in granting administrative privileges to users. Adding users to the SUDOERS group enables them to execute commands with root privileges, providing them with the necessary administrative access to perform various tasks on a Debian system.

During the installation of Debian Linux, if you keep the password for “root” account empty, the first user created in the system will have the administrative rights. However, if you do set the “root” password, then the user names will not have the sudo privileges. Hence, you might get a similar error below when using the user account to perform administrative tasks.

<username> is not in the sudoers file. This incident will be reported.
Before adding a user to SUDOERS group
Before adding a user to the SUDOERS group

This article aims to provide a step-by-step guide on adding a user to the SUDOERS group in Debian, ensuring that you can effectively manage user permissions and system security.

How to Add User to SUDOERS Group in Debian

To add a user to the SUDOERS group in Debian, follow these simple steps:

  1. Open the terminal on your Debian system by clicking on the “Terminal” icon or by using the shortcut Ctrl+Alt+T.
  2. Switch to the root user using the following command:
su -

You will be prompted to provide the root password. Enter the root password and press enter.

After you log in as the root user, enter the following command. Make sure to change as per your username. For this example, replace “arindam” with your user name.

/sbin/addgroup arindam sudo

If the above command says invalid, you can also use the following command:

usermod -aG sudo arindam

Press exit to leave the root prompt. Log out and log in again. Now you can perform any administrative action using your username.

Another method

You can go into the root account using the same command as below. Use root account to log in:

su -

Then open the /etc/sudoers file using nano or visudo or any editor.

nano /etc/sudoers

Add the following lines with the username. Change “arindam” as per your user name.

arindam    ALL=(ALL)    ALL

Save and close the file. And then, log out and log in again. And that should give the user name the root privileges.

Verifying SUDOERS Group Membership

To verify that the user has been successfully added to the SUDOERS group, you can open a new terminal window and enter the following command. Replace “username” with the actual username of the user you added to the SUDOERS group.

sudo -l -U arindam

If the user is a member of the SUDOERS group, you will see the list of privileges they have. Here’s an example where you can see my username has all access.

After granting priviledges
After granting privileges

Closing notes

Adding a user to the SUDOERS group grants them significant administrative privileges. It is important to carefully consider the trustworthiness and responsibilities of the user before giving them such access. Improper use of sudo can lead to accidental damage or compromise of the system.

Remember to exercise caution when delegating administrative privileges and regularly review user permissions to maintain a secure Debian system.


Creator and author of debugpoint.com. Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Notify of

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

1 Comment
Oldest Most Voted
Inline Feedbacks
View all comments