<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Computer Support &#187; sudo</title>
	<atom:link href="http://www.xiitec.com/blog/tag/sudo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xiitec.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 30 Dec 2009 08:40:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Granting Limited Rootly Powers with sudo</title>
		<link>http://www.xiitec.com/blog/2008/02/01/granting-limited-rootly-powers-with-sudo/</link>
		<comments>http://www.xiitec.com/blog/2008/02/01/granting-limited-rootly-powers-with-sudo/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 21:25:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Users / Groups]]></category>
		<category><![CDATA[sudo]]></category>

		<guid isPermaLink="false">http://www.xiitec.com/blog/?p=81</guid>
		<description><![CDATA[If you would like to delegate some system administration chores to other users, or set up an extra layer of safety for your own root chores—but you want to do it in a way that uses only limited rootly powers, and does not give away root&#8217;s password, use sudo. sudo grants limited root powers to [...]]]></description>
			<content:encoded><![CDATA[<p>If you would like to delegate some system administration chores to other users, or set up an extra layer of safety for your own root chores—but you want to do it in a way that uses only limited rootly powers, and does not give away root&#8217;s password, use <code>sudo</code>. <code>sudo</code> grants limited root powers to specific users for specific tasks, logs activity, and does not give away root&#8217;s password.</p>
<p><span id="more-81"></span></p>
<p>Let&#8217;s say that you have a user, <code>jhaugh</code>, upon whom you wish to bestow full rootly powers. Because <code>sudo</code> users use their own passwords, root&#8217;s password is protected. Edit <code>/etc/sudoers</code> with <code>visudo</code>—it will open in your default text editor:</p>
<blockquote><p># visudo<br />
# sudoers file.<br />
#<br />
# This file MUST be edited with the &#8216;visudo&#8217;<br />
# command as root.<br />
# See the man page for details on how to write<br />
# a sudoers file.<br />
#<br />
# Host alias specification<br />
# User alias specification<br />
# Cmnd alias specification<br />
# User privilege specification</p>
<p>root    ALL=(ALL) ALL</p></blockquote>
<p>First, set up a host alias:</p>
<blockquote><p>Host_Alias LOCALHOST= localhost</p></blockquote>
<p>Under the &#8220;User privilege specification&#8221; line, you can add individual users:</p>
<blockquote><p>jhaugh    ALL=(ALL) ALL</p></blockquote>
<p>This gives jhaugh root powers for everything on the system and on all connected machines. Now say you have another user, tgwynne, who needs root privileges only on the local machine. Add the following line for this user:</p>
<blockquote><p>tgwynne    LOCALHOST = ALL</p></blockquote>
<p>Adding to your delegation of minions is msmith, who is allowed only to shut down the local machine:</p>
<blockquote><p>msmith    LOCALHOST = /sbin/shutdown, /sbin/halt</p></blockquote>
<p>This grants groups of ordinary users shutdown privileges on their own machines:</p>
<blockquote><p># Host alias specification<br />
Host_Alias LOCALHOST= localhost<br />
# User alias specification<br />
User_Alias    USERS = tgwynne, msmith, jhaugh, \<br />
abyron, jwinters</p>
<p># Cmnd alias specification<br />
Cmnd_Alias  SHUTDOWN = /usr/sbin/shutdown, /usr/sbin/halt, \<br />
/usr/sbin/reboot, /usr/sbin/poweroff</p>
<p># User privilege specification<br />
USERS    LOCALHOST = SHUTDOWN</p></blockquote>
<p>To execute a sudo command, users do this:</p>
<blockquote><p>$ sudo /usr/sbin/halt</p></blockquote>
<p>They will be prompted for their passwords, then the command will execute. Users can check which commands they are authorized for with the following command:</p>
<blockquote><p> $ sudo -l</p>
<p>User jhaugh may run the following commands on this host:<br />
(ALL) ALL</p></blockquote>
<p>sudo logs all errors to the syslog, and tattles to root:</p>
<blockquote><p>$ sudo /usr/sbin/halt<br />
carla is not in the sudoers file.  This incident will be reported.</p></blockquote>
<p>Groups of servers can be defined, and users can be given privileges to the groups:</p>
<blockquote><p># Host alias specification<br />
Host_Alias    FILESERVERS = host1, host2, host3<br />
# User alias specification<br />
User_Alias    FILESERVADMINS = jhaugh, abyron, jwinters<br />
# Cmnd alias specification<br />
Cmnd_Alias    FILEUTILS = /bin/chgrp, /bin/chmod, \<br />
/bin/chown, /bin/cp, /bin/dd, /bin/df, \<br />
/bin/dir, /bin/dircolors, /bin/du, /bin/install, \<br />
/bin/ln, /bin/ls, /bin/mkdir, /bin/mkfifo, \<br />
/bin/mknod,bin/mv, /bin/rm, /bin/rmdir, \<br />
/bin/shred, /bin/touch, /bin/vdir sync<br />
# User privilege specification<br />
FILESERVADMIN     FILESERVERS = FILEUTILS</p></blockquote>
<p><code>sudo</code> can also be used to let users execute scripts, such as backup scripts. Be very careful with scripts, or any command that gives shell access or invokes a text editor, because these may allow users to escalate their privileges. You can try to restrict sudo users to RJOE, which is a restricted editor that cannot invoke a shell, but it&#8217;s better to be careful with how you delegate rootly chores in the first place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiitec.com/blog/2008/02/01/granting-limited-rootly-powers-with-sudo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

