The following lines will describe a procedure on how to mimic Ubuntu’s sudo privilege authorization system on Debian Linux. Sudo allows users to run programs with the authorization privileges of another user by supplying their own password for authentication.
If you have not done so yet, first install sudo
package:
# apt-get install sudo
Once sudo is installed run:
# visudo
which allows you to edit the content of /etc/sudoers
file. Change the content of this file as show below:
Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" root ALL=(ALL:ALL) ALL %admin ALL=(ALL) ALL %sudo ALL=(ALL:ALL) ALL
Alternatively, you should only add line:
%admin ALL=(ALL) ALL
which allows members of the admin group to gain root privileges. Next, create admin
group:
# addgroup admin
At this stage all what remains is to add all users you wish to use sudo command to admin
and sudo
group. For example the below command will add a user linuxconfig
to both groups:
# usermod -a -G sudo -G admin linuxconfig
To see which users currently belong to admin
and sudo
group run:
# getent group sudo admin
To start using sudo you must re-login that is log out and log in again with your sudo user otherwise you will see the following error message:
$ sudo -i [sudo] password for linuxconfig: linuxconfig is not in the sudoers file. This incident will be reported.