Sunday, March 20, 2011

Introduction Sudo


Sudo is a utility that allows system administrators to give users the ability to user or group to run an application, read a file, which can only be run or read by root or another user.
stable version of this utility is sudo 1.6.9p4, released on August 16, 2007. Sudo is free software and distributed under the ISC-style license. Sudo the first time known and implemented by Bob Coggeshall and Cliff Spencer around 1980 at the Department of Computer Science at SUNY / Buffalo. running on the system VAX-11/750 running 4.1BSD. and updated version, credited to Phil Betchel, Cliff Spencer, Gretchen Phillips, John LoVerso and Don Gworek, have been distributed through Usenet newsgroups net.sources in December of 1985. You can read more about the history of sudo in http://www.sudo.ws/sudo/history.html

Many people have joined to write the sudo application from year to year, its current version is a major maker:

* Todd Miller http://www.courtesan.com/todd/
* Chris Jepeway http://www.blasted-heath.com/
* Aaron Spangler (LDAP support)

sudo up to version 1.6 also contains code that is created by:

* Jeff Nieusma
* Dave Hieb

To learn more about sudo, you can refer to the http://www.gratisoft.us/sudo/ or read the sample samples of sudo configuration in / usr / local / etc / sudoers

how to install sudo
login as root to the server
indofreebsd #

enter the ports collection sudo
indofreebsd # cd / usr / ports / security / sudo

sudo install applications
indofreebsd # make install clean

configuring sudo
indofreebsd # pico / usr / local / etc / sudoers

add to your sudoers file

% Ogeb ALL = (ALL) NOPASSWD: ALL

save sudo configuration

examples of how to use sudo

indofreebsd $ ls-al
Total 36 928
drwxr-xr-x 4 ogeb ogeb 512 Jun 29 08:54.
drwxr-xr-x 15 root wheel 512 Jul 27 09:46 ..
-Rw ------- 1 root wheel 28901 May 4 00:10 modsecurity-rules_2.1-core-1.4.tar.gz

above shows that there is a file named modsecurity-core-1.4.tar.gz-rules_2.1 root ownership
now with a normal user conditions let us try to decompress the file
indofreebsd $ tar-zxvf modsecurity-rules_2.1-core-1.4.tar.gz
tar: Error opening archive: Failed to open 'modsecurity-rules_2.1-core-1.4.tar.gz': Permission denied

permision denied and it turns out you can not do anything to serve targeted file.

now compare with using sudo

indofreebsd $ sudo tar-zxvf modsecurity-rules_2.1-core-1.4.tar.gz
x modsecurity_crs_40_generic_attacks.conf
x modsecurity_crs_20_protocol_violations.conf
x modsecurity_crs_21_protocol_anomalies.conf
x modsecurity_crs_35_bad_robots.conf
x modsecurity_crs_45_trojans.conf
x modsecurity_crs_50_outbound.conf
x modsecurity_crs_55_marketing.conf
x blocking/modsecurity_crs_20_protocol_violations.conf
x blocking/modsecurity_crs_21_protocol_anomalies.conf
x blocking/modsecurity_crs_40_generic_attacks.conf
x modsecurity_crs_10_config.conf
x modsecurity_crs_30_http_policy.conf
x README
x CHANGELOG
x LICENSE

also succeeded in extracting files
in message.log seen that
Indofreebsd Aug 30 13:51:18 sudo: ogeb: TTY = ttyp0; PWD = / usr / home / ogeb; USER = root; COMMAND = / usr / bin / tar-zxvf modsecurity-core-rules_2.1-1.4.tar . gz

a lot of interesting things when using sudo, please dig yourself.

so hopefully about sudo is useful.

Sincerely,
ogeb

0 comments: