You are here

sudoers in Debian

Uditha Atukorala's picture

To add sudo users or sudoers in Debian first you need to install the sudo package if it is not already installed.

# aptitude install sudo

Then it is all about editing the sudoers file and giving the appropriate permissions. This is done by executing the visudo command as root.

# visudo

By adding the following line to the # User privilege specification section you can give all the privileges of root to the user.

         user ALL=(ALL) ALL

Note: In the above line 'user' is the user name of the user account

Following is a sample sudoers file from the Debian documentation which speaks for it self of the various levels of permissions that you can achieve using sudoers, but beware when using NOPASSWD: since users will not be asked for the password when executing sudo commands

# sudoers file.
# This file MUST be edited with the 'visudo' command as root.
# See the man page for details on how to write a sudoers file.
# This setting may be a security risk.  Osamu
# Host alias specification - not using
Host_Alias     LAN =
# User alias specification - not using, but using group
User_Alias     STAFF = admin
User_Alias     SRC   = admin, debian, osamu
# Cmnd alias specification
Cmnd_Alias     FILEUTILS = /bin/chown, /bin/chmod, /bin/chgrp, \
                           /bin/mount, /bin/umount, /usr/bin/cdrecord
Cmnd_Alias     DEBUTILS  = /usr/bin/dpkg, \
Cmnd_Alias     EDITORS   = /bin/vi, \
# User privilege specification
root       ALL = (ALL) ALL
%staff     ALL = (ALL) NOPASSWD: ALL
Defaults:%staff     !lecture
Defaults:%src       !lecture
Defaults:%staff     !authenticate
#Defaults:admin     !authenticate