Showing posts with label sudo. Show all posts
Showing posts with label sudo. Show all posts

Tuesday, April 24, 2012

SUDO on Freebsd / Linux



as root install 
sudo located at /usr/ports/security/sudo
make configure
make && make install

edit conf at
ee /usr/local/etc/sudoers

example and edit :
# Runas alias specification

#User privilege specification
root ALL=(ALL) ALL
kenan ALL=(www) ALL


note :

This Sudo command limits the user's power on the basis of the configuration made on the file "/etc/sudoers".
Generally in default case you might see something like this:

root ALL=(ALL) ALL
Above, you can see ALL 3 times. But what does it mean?
The first ALL: Run from any(all) host
The Second ALL: From any Terminal
The third ALL: Can Run any command

example :
usename ALL=(group) ALL


** note : !/usr/bin/su (this will prevent user to sudo su)

General sudoers File Record Format
usernames/group servername = (usernames command can be run as) command



Add user as sudoer


1. Open Unix Server

2. Login as root (sudo su)
Type command:

# setenv EDITOR ee
# visudo

3. Add within this line to add new sudoer:
## User privilege specification
root ALL=(ALL) ALL
hassan ALL=(ALL) ALL

Press ESC to save & exit.
Done.

==========================================
OR
=============================

Set sudoer permission in admin group:

# nano /etc/group

Change/Add admin
*admin: name1, name2, name3

Ctrl X > Y > Enter
Done.. :)