SUDO Examples

11 May, 2005 at 15:25 Leave a comment

/etc/sudoers

You use “visudo” to edit the sudoers file. There are two reasons for that- it prevents two users from editing the file at the same time, and it also provides limited syntax checking. Even if you are the only root user, you need the syntax checking, so use “visudo”.

We’re going to start with the simplest setup of all: giving someone full root access. You might think there’s no reason to do this- it would make more sense just to give them the root password, wouldn’t it? Well, maybe, but then they can login as root also- with sudo they will have to use the sudo command and we can require a password that IS NOT root’s password. Sudo commands can be logged, so we can keep track of what the person did. We can turn their sudo capability on or off at will without affecting other sudo users- no need to change the root password back and forth. This is a great way to keep track of consultants and other support people who may need root power, but you want to keep tabs on what they do. Of course there’s a strong implication of honesty here- such a user could edit the sudo logs to hide any mischief.

So, here’s a simple /etc/sudoers file (remember, edit with “visudo”) to give “jim” access to root commands.

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#

# User privilege specification
root    ALL=(ALL) ALL
jim     ALL=(ALL)       ALL

That’s it. With this in place, “jim” can use sudo to run any command with root privileges.

Advertisements

Entry filed under: Uncategorized.

Office Romance, Politics, Equipment… Why Linux is Crap and Piracy is Good for Windows

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

May 2005
M T W T F S S
« Apr   Jun »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Tweets


%d bloggers like this: