How to Add User to Sudoers in Debian Linux 8

In This Tutorial We are going to Learn How to Add User to Sudoers in Debian Linux 8.

In Debian Linux sudo allow users to run Linux commands with root privileges using their own Password. This way you do not have to share the root password with everyone in your Debian Linux system.

Once you add a user to Sudoers, user can execute commands with superuser privileges.

Install sudo On Debian Linux 8

Sudo in Debian 8 is not installed by default. So First, we need to Install sudo on Debian 8 using apt-get apt-get install command.

apt-get install sudo

During the installation new group called sudo will be created.

Add User to Sudoers using usermod command

In order to give sudo privileges to a user, we need to add user to sudo administrative group. We can add user to group in Debian Linux using usermod command as follows.

usermod -a -G sudo username

Example

Let's assume we have a user called josh in our Debian Linux System. And we will add user josh to the debian Sudoers using the usermod command.

usermod -a -G sudo josh

Debian add user to sudoers

Now if you looked at the /etc/group file, you can see josh is now a member of the sudo Linux group.

Debian Sudo Group

user is not in the sudoers file

Following Error message will receive If the user is not a member of sudo group and tried to use the sudo command.

user is not in the sudoers file.  This incident will be reported.

user is not in the sudoers file. This incident will be reported.

Summary : What we Learned

In This Tutorial We Learned how to add User to Sudoers in Debian Linux 8.

  • First We installed sudo on debian 8 using apt-get install command.
  • Then We add user to sudo group using the usermod command.