Left Menu









Howto compile, configure and start using sudo

 The sudo command is a program for some Unix and Unix-like computer operating systems that allows users to run programs with the security privileges of another user (normally the superuser, a.k.a. root).
 The program was originally written by Bob Coggeshall and Cliff Spencer "around 1980" at the Department of Computer Science at SUNY/Buffalo. The current version is under active development and is maintained by OpenBSD developer Todd C Miller and distributed under a BSD-style license.
 Before running a command with sudo, users typically supply their password. Once authenticated, and if the /etc/sudoers configuration file permits the user access, then the command is run. There exist several graphical frontends for use in a GUI environment, notably kdesu, kdesudo, gksu, and gksudo; Mac OS X also has Authorization Services.[8] By default the user's password can be retained through a grace period, allowing the user to execute several successive commands as root without having to provide the password again.


Ok let's download and install and start using it!
NOTE: sudo usually comes by default with many distributions, but if something goes wrong, or you simply don't like something  (like typing your password everytime you use it) you can always modify it according to your needs.
Also is available in the official three of almost any distibution :

Ubuntu/Debian : apt-get install <package>
Gentoo : emerge <package>
Sabayon : equo install <package>
ArchLinux : pacman <package>
and so on ... it depends on the distribution
if not let's download and install it :

1. Download

$ wget http://www.sudo.ws/sudo/dist/sudo-1.6.9p20.tar.gz
As of now this is the latest version, but if you think there is later release

$ lynx http://www.sudo.ws/sudo/dist/

2. Extract the tarball

$ tar vfx sudo-1.6.9p20

3. Eneter (use "cd") the directory

$ cd sudo-1.6.9p20

4. Configure and install it
For a distribution specific installation


$ ./configure --prefix=/usr/bin/sudo
use --prefix to specify the path where you want it installed
Most of the distributions are going to look for it in /etc/bin/sudo, if you do not specify a path it will be installed in /usr/local/bin/sudo and will not be found when trying to execute "sudo".

$ make && make install

Now if you try to use it you are going to see something like :

kickar@linnewbies $ sudo reboot
 We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Password:
kickar is not in the sudoers file. This incident will be reported.
kickar@linnewbies $

To fix this you will need to edit /etc/sudoers via the "visudo" command as superuser a.k.a root

# /usr/bin/visudo
Here, if you simply want to add a user :

<username> ALL=(ALL) ALL
If you want to add all users in a group (for example %users) :

%users       ALL=(ALL) ALL
After that sudo will be configured and will ask for a user password (will remember it for like 10 minutes), but if you want you can remove the password prompt:

%users ALL=(ALL) NOPASSWD: ALL

6. Let's try it out

kickar@linnewbies $ sudo killall -9 X
 We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Password:

Oopps bad example! Don't execute this one :)

If you have any questions please refer to our FORUM





Delicious de.li.cio.us


|Home | LinuXchange| Updates | Contact Us | About The Project | Unique Visitors| Sponsorship|