[cf341b4] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[cf341b4] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[06915b3] | 7 | <!ENTITY sudo-download-http "http://www.sudo.ws/dist/sudo-&sudo-version;.tar.gz">
|
---|
[926d146d] | 8 | <!ENTITY sudo-download-ftp "ftp://ftp.sudo.ws/pub/sudo/sudo-&sudo-version;.tar.gz">
|
---|
[360e30c0] | 9 | <!ENTITY sudo-md5sum "ac4878e052837019473103c6deb35621">
|
---|
[77dc17a] | 10 | <!ENTITY sudo-size "2.8 MB">
|
---|
| 11 | <!ENTITY sudo-buildsize "30 MB (with tests)">
|
---|
[360e30c0] | 12 | <!ENTITY sudo-time "0.3 SBU (with tests)">
|
---|
[cf341b4] | 13 | ]>
|
---|
| 14 |
|
---|
[bcd2922] | 15 | <sect1 id="sudo" xreflabel="Sudo-&sudo-version;">
|
---|
[cf341b4] | 16 | <?dbhtml filename="sudo.html"?>
|
---|
| 17 |
|
---|
| 18 | <sect1info>
|
---|
[e19ad480] | 19 | <othername>$LastChangedBy$</othername>
|
---|
| 20 | <date>$Date$</date>
|
---|
[cf341b4] | 21 | </sect1info>
|
---|
| 22 |
|
---|
| 23 | <title>Sudo-&sudo-version;</title>
|
---|
| 24 |
|
---|
| 25 | <indexterm zone="sudo">
|
---|
[bcd2922] | 26 | <primary sortas="a-Sudo">Sudo</primary>
|
---|
[cf341b4] | 27 | </indexterm>
|
---|
| 28 |
|
---|
| 29 | <sect2 role="package">
|
---|
| 30 | <title>Introduction to Sudo</title>
|
---|
| 31 |
|
---|
[bcd2922] | 32 | <para>
|
---|
| 33 | The <application>Sudo</application> package allows a system administrator
|
---|
| 34 | to give certain users (or groups of users) the ability to run
|
---|
| 35 | some (or all) commands as
|
---|
| 36 | <systemitem class="username">root</systemitem> or another user while
|
---|
| 37 | logging the commands and arguments.
|
---|
| 38 | </para>
|
---|
[cf341b4] | 39 |
|
---|
[63a26beb] | 40 | &lfs80_checked;
|
---|
[77dc17a] | 41 | &gcc7_checked;
|
---|
[a8d3d55a] | 42 |
|
---|
[cf341b4] | 43 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 44 | <itemizedlist spacing="compact">
|
---|
| 45 | <listitem>
|
---|
[bcd2922] | 46 | <para>
|
---|
| 47 | Download (HTTP): <ulink url="&sudo-download-http;"/>
|
---|
| 48 | </para>
|
---|
[cf341b4] | 49 | </listitem>
|
---|
| 50 | <listitem>
|
---|
[bcd2922] | 51 | <para>
|
---|
| 52 | Download (FTP): <ulink url="&sudo-download-ftp;"/>
|
---|
| 53 | </para>
|
---|
[cf341b4] | 54 | </listitem>
|
---|
| 55 | <listitem>
|
---|
[bcd2922] | 56 | <para>
|
---|
| 57 | Download MD5 sum: &sudo-md5sum;
|
---|
| 58 | </para>
|
---|
[cf341b4] | 59 | </listitem>
|
---|
| 60 | <listitem>
|
---|
[bcd2922] | 61 | <para>
|
---|
| 62 | Download size: &sudo-size;
|
---|
| 63 | </para>
|
---|
[cf341b4] | 64 | </listitem>
|
---|
| 65 | <listitem>
|
---|
[bcd2922] | 66 | <para>
|
---|
| 67 | Estimated disk space required: &sudo-buildsize;
|
---|
| 68 | </para>
|
---|
[cf341b4] | 69 | </listitem>
|
---|
| 70 | <listitem>
|
---|
[bcd2922] | 71 | <para>
|
---|
| 72 | Estimated build time: &sudo-time;
|
---|
| 73 | </para>
|
---|
[cf341b4] | 74 | </listitem>
|
---|
| 75 | </itemizedlist>
|
---|
| 76 |
|
---|
| 77 | <bridgehead renderas="sect3">Sudo Dependencies</bridgehead>
|
---|
| 78 |
|
---|
| 79 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[bcd2922] | 80 | <para role="optional">
|
---|
| 81 | <xref linkend="linux-pam"/>,
|
---|
| 82 | <xref linkend="mitkrb"/>,
|
---|
| 83 | <xref linkend="openldap"/>,
|
---|
[6b4f8529] | 84 | <xref linkend="server-mail"/> (that provides a
|
---|
| 85 | <command>sendmail</command> command),
|
---|
| 86 | <ulink url="http://www.openafs.org/">AFS</ulink>,
|
---|
[06915b3] | 87 | <ulink url="http://www.fwtk.org/">FWTK</ulink>, and
|
---|
| 88 | <ulink url="http://sourceforge.net/projects/opie/files/">Opie</ulink>
|
---|
| 89 | <!-- <ulink url="http://www.rsa.com/node.aspx?id=1156">SecurID</ulink>-->
|
---|
[bcd2922] | 90 | </para>
|
---|
[b35e86b2] | 91 |
|
---|
[3597eb6] | 92 | <para condition="html" role="usernotes">User Notes:
|
---|
[bcd2922] | 93 | <ulink url="&blfs-wiki;/sudo"/>
|
---|
| 94 | </para>
|
---|
[cf341b4] | 95 | </sect2>
|
---|
| 96 |
|
---|
| 97 | <sect2 role="installation">
|
---|
| 98 | <title>Installation of Sudo</title>
|
---|
| 99 |
|
---|
[bcd2922] | 100 | <para>
|
---|
[6e5d584] | 101 | Install <application>Sudo</application> by running the following commands:
|
---|
[bcd2922] | 102 | </para>
|
---|
[cf341b4] | 103 |
|
---|
[1c69133] | 104 | <!-- Developer: apparently it is disabled by default, although in configure it
|
---|
| 105 | is written otherwise -disable-static \-->
|
---|
[b9d56ad4] | 106 | <screen><userinput>./configure --prefix=/usr \
|
---|
[edaee95] | 107 | --libexecdir=/usr/lib \
|
---|
[1a657ca] | 108 | --with-secure-path \
|
---|
[b9d56ad4] | 109 | --with-all-insults \
|
---|
| 110 | --with-env-editor \
|
---|
| 111 | --docdir=/usr/share/doc/sudo-&sudo-version; \
|
---|
[9dabcf3] | 112 | --with-passprompt="[sudo] password for %p: " &&
|
---|
[cf341b4] | 113 | make</userinput></screen>
|
---|
| 114 |
|
---|
[bcd2922] | 115 | <para>
|
---|
[6b4f8529] | 116 | To test the results, issue: <command>env LC_ALL=C make check 2>&1
|
---|
| 117 | | tee ../make-check.log</command>. Check the results with <command>grep
|
---|
| 118 | failed ../make-check.log</command>.
|
---|
[bcd2922] | 119 | </para>
|
---|
[21755bc] | 120 |
|
---|
[bcd2922] | 121 | <para>
|
---|
| 122 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 123 | </para>
|
---|
[cf341b4] | 124 |
|
---|
[2809c8c] | 125 | <screen role="root"><userinput>make install &&
|
---|
| 126 | ln -sfv libsudo_util.so.0.0.0 /usr/lib/sudo/libsudo_util.so.0</userinput></screen>
|
---|
[cf341b4] | 127 |
|
---|
| 128 | </sect2>
|
---|
| 129 |
|
---|
| 130 | <sect2 role="commands">
|
---|
| 131 | <title>Command Explanations</title>
|
---|
| 132 |
|
---|
[663b79c2] | 133 | <para>
|
---|
[edaee95] | 134 | <parameter>--libexecdir=/usr/lib</parameter>: This switch controls where
|
---|
[663b79c2] | 135 | private programs are installed. Everything in that directory is a library, so
|
---|
| 136 | they belong under <filename class="directory">/usr/lib</filename> instead of
|
---|
| 137 | <filename class="directory">/usr/libexec</filename>.
|
---|
[8466229] | 138 | </para>
|
---|
| 139 |
|
---|
| 140 | <para>
|
---|
| 141 | <parameter>--with-secure-path</parameter>: This switch transparently adds
|
---|
| 142 | <filename class="directory">/sbin</filename> and <filename
|
---|
| 143 | class="directory">/usr/sbin</filename> directories to the
|
---|
| 144 | <envar>PATH</envar> environment variable.
|
---|
[663b79c2] | 145 | </para>
|
---|
| 146 |
|
---|
[bcd2922] | 147 | <para>
|
---|
[f3d174f] | 148 | <parameter>--with-all-insults</parameter>: This switch includes all the
|
---|
[bcd2922] | 149 | <application>sudo</application> insult sets.
|
---|
| 150 | </para>
|
---|
[cf341b4] | 151 |
|
---|
[bcd2922] | 152 | <para>
|
---|
[f3d174f] | 153 | <parameter>--with-env-editor</parameter>: This switch enables use of the
|
---|
[bcd2922] | 154 | environment variable EDITOR for <command>visudo</command>.
|
---|
| 155 | </para>
|
---|
[8890b85f] | 156 |
|
---|
[f3d174f] | 157 | <para>
|
---|
| 158 | <parameter>--with-passprompt</parameter>: This switch sets the prompt.
|
---|
| 159 | </para>
|
---|
| 160 |
|
---|
[14c71e0a] | 161 | <para>
|
---|
[f586237] | 162 | <option>--without-pam</option>: This switch avoids building
|
---|
| 163 | <application>Linux-PAM</application> support when
|
---|
| 164 | <application>Linux-PAM</application> is installed on the system.
|
---|
[14c71e0a] | 165 | </para>
|
---|
[17b685f1] | 166 | <!-- See the developer note above before the configure command
|
---|
[b9d56ad4] | 167 | <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
---|
[f1d7196] | 168 | href="../../xincludes/static-libraries.xml"/>-->
|
---|
[b9d56ad4] | 169 |
|
---|
[33d90fe] | 170 | <note>
|
---|
[bcd2922] | 171 | <para>
|
---|
| 172 | There are many options to <application>sudo</application>'s
|
---|
| 173 | <command>configure</command> command. Check the
|
---|
| 174 | <command>configure --help</command> output for a complete list.
|
---|
| 175 | </para>
|
---|
[33d90fe] | 176 | </note>
|
---|
[cf341b4] | 177 |
|
---|
[2809c8c] | 178 | <para>
|
---|
[f586237] | 179 | <command>ln -sfv libsudo_util...</command>: Works around a bug in the
|
---|
[2809c8c] | 180 | installation process, which links to the previously installed
|
---|
| 181 | version (if there is one) instead of the new one.
|
---|
| 182 | </para>
|
---|
| 183 |
|
---|
[cf341b4] | 184 | </sect2>
|
---|
| 185 |
|
---|
| 186 | <sect2 role="configuration">
|
---|
| 187 | <title>Configuring Sudo</title>
|
---|
| 188 |
|
---|
| 189 | <sect3 id="sudo-config">
|
---|
| 190 | <title>Config File</title>
|
---|
| 191 |
|
---|
[7a47afc] | 192 | <para>
|
---|
| 193 | <filename>/etc/sudoers</filename>
|
---|
| 194 | </para>
|
---|
[cf341b4] | 195 |
|
---|
| 196 | <indexterm zone="sudo sudo-config">
|
---|
| 197 | <primary sortas="e-etc-sudoers">/etc/sudoers</primary>
|
---|
| 198 | </indexterm>
|
---|
| 199 |
|
---|
| 200 | </sect3>
|
---|
| 201 |
|
---|
| 202 | <sect3>
|
---|
| 203 | <title>Configuration Information</title>
|
---|
| 204 |
|
---|
[bcd2922] | 205 | <para>
|
---|
| 206 | The <filename>sudoers</filename> file can be quite complicated. It
|
---|
| 207 | is composed of two types of entries: aliases (basically variables) and
|
---|
| 208 | user specifications (which specify who may run what). The installation
|
---|
[b4c31a6] | 209 | installs a default configuration that has no privileges installed for
|
---|
| 210 | any user.
|
---|
[bcd2922] | 211 | </para>
|
---|
[cf341b4] | 212 |
|
---|
[bcd2922] | 213 | <para>
|
---|
| 214 | One example usage is to allow the system administrator to execute
|
---|
| 215 | any program without typing a password each time root privileges are
|
---|
| 216 | needed. This can be configured as:
|
---|
| 217 | </para>
|
---|
[bccbdaea] | 218 |
|
---|
[ed025d6] | 219 | <screen># User alias specification
|
---|
[b4c31a6] | 220 | User_Alias ADMIN = <replaceable>YourLoginId</replaceable>
|
---|
[cf341b4] | 221 |
|
---|
| 222 | # Allow people in group ADMIN to run all commands without a password
|
---|
| 223 | ADMIN ALL = NOPASSWD: ALL</screen>
|
---|
| 224 |
|
---|
[bcd2922] | 225 | <para>
|
---|
| 226 | For details, see <command>man sudoers</command>.
|
---|
| 227 | </para>
|
---|
[cf341b4] | 228 |
|
---|
[3c0f868f] | 229 | <note>
|
---|
[bcd2922] | 230 | <para>
|
---|
| 231 | The <application>Sudo</application> developers highly recommend
|
---|
| 232 | using the <command>visudo</command> program to edit the
|
---|
| 233 | <filename>sudoers</filename> file. This will provide basic sanity
|
---|
[b4c31a6] | 234 | checking like syntax parsing and file permission to avoid some
|
---|
| 235 | possible mistakes that could lead to a vulnerable configuration.
|
---|
[bcd2922] | 236 | </para>
|
---|
[3c0f868f] | 237 | </note>
|
---|
| 238 |
|
---|
[bcd2922] | 239 | <para>
|
---|
[14c71e0a] | 240 | If <application>PAM</application> is installed on the system,
|
---|
| 241 | <application>Sudo</application> is built with
|
---|
[b4c31a6] | 242 | <application>PAM</application> support. In that case, issue the
|
---|
| 243 | following command as the <systemitem class="username">root</systemitem>
|
---|
| 244 | user to create the <application>PAM</application> configuration file:
|
---|
[bcd2922] | 245 | </para>
|
---|
[8890b85f] | 246 |
|
---|
[add8d4f] | 247 | <screen role="root"><userinput>cat > /etc/pam.d/sudo << "EOF"
|
---|
| 248 | <literal># Begin /etc/pam.d/sudo
|
---|
[b3a4f60] | 249 |
|
---|
| 250 | # include the default auth settings
|
---|
| 251 | auth include system-auth
|
---|
| 252 |
|
---|
| 253 | # include the default account settings
|
---|
| 254 | account include system-account
|
---|
| 255 |
|
---|
| 256 | # Set default environment variables for the service user
|
---|
| 257 | session required pam_env.so
|
---|
| 258 |
|
---|
| 259 | # include system session defaults
|
---|
| 260 | session include system-session
|
---|
| 261 |
|
---|
[add8d4f] | 262 | # End /etc/pam.d/sudo</literal>
|
---|
[b3a4f60] | 263 | EOF
|
---|
| 264 | chmod 644 /etc/pam.d/sudo</userinput></screen>
|
---|
[fd7e0ed6] | 265 |
|
---|
[cf341b4] | 266 | </sect3>
|
---|
| 267 |
|
---|
| 268 | </sect2>
|
---|
| 269 |
|
---|
| 270 | <sect2 role="content">
|
---|
| 271 | <title>Contents</title>
|
---|
| 272 |
|
---|
| 273 | <segmentedlist>
|
---|
| 274 | <segtitle>Installed Programs</segtitle>
|
---|
[9d53187] | 275 | <segtitle>Installed Libraries</segtitle>
|
---|
[cf341b4] | 276 | <segtitle>Installed Directories</segtitle>
|
---|
| 277 |
|
---|
| 278 | <seglistitem>
|
---|
[bcd2922] | 279 | <seg>
|
---|
[a1e0f76] | 280 | sudo, sudoedit (symlink), sudoreplay, and visudo
|
---|
[bcd2922] | 281 | </seg>
|
---|
| 282 | <seg>
|
---|
[6b4f8529] | 283 | group_file.so, libsudo_util.so,
|
---|
| 284 | sudoers.so, sudo_noexec.so, and system_group.so
|
---|
[bcd2922] | 285 | </seg>
|
---|
| 286 | <seg>
|
---|
[7a47afc] | 287 | /etc/sudoers.d,
|
---|
[b378aa0] | 288 | /usr/lib/sudo,
|
---|
[06915b3] | 289 | /usr/share/doc/sudo-&sudo-version;, and
|
---|
| 290 | /var/{lib,run}/sudo
|
---|
[bcd2922] | 291 | </seg>
|
---|
[cf341b4] | 292 | </seglistitem>
|
---|
| 293 | </segmentedlist>
|
---|
| 294 |
|
---|
| 295 | <variablelist>
|
---|
| 296 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 297 | <?dbfo list-presentation="list"?>
|
---|
| 298 | <?dbhtml list-presentation="table"?>
|
---|
| 299 |
|
---|
| 300 | <varlistentry id="sudo_prog">
|
---|
| 301 | <term><command>sudo</command></term>
|
---|
| 302 | <listitem>
|
---|
[bcd2922] | 303 | <para>
|
---|
| 304 | executes a command as another user as permitted by
|
---|
| 305 | the <filename>/etc/sudoers</filename> configuration file.
|
---|
[cf341b4] | 306 | </para>
|
---|
| 307 | <indexterm zone="sudo sudo">
|
---|
| 308 | <primary sortas="b-sudo">sudo</primary>
|
---|
| 309 | </indexterm>
|
---|
| 310 | </listitem>
|
---|
| 311 | </varlistentry>
|
---|
| 312 |
|
---|
| 313 | <varlistentry id="sudoedit">
|
---|
| 314 | <term><command>sudoedit</command></term>
|
---|
| 315 | <listitem>
|
---|
[bcd2922] | 316 | <para>
|
---|
[a1e0f76] | 317 | is a symlink to <command>sudo</command> that implies the
|
---|
[bcd2922] | 318 | <option>-e</option> option to invoke an editor as another user.
|
---|
| 319 | </para>
|
---|
[cf341b4] | 320 | <indexterm zone="sudo sudoedit">
|
---|
| 321 | <primary sortas="b-sudoedit">sudoedit</primary>
|
---|
| 322 | </indexterm>
|
---|
| 323 | </listitem>
|
---|
| 324 | </varlistentry>
|
---|
| 325 |
|
---|
[72d90b67] | 326 | <varlistentry id="sudoreplay">
|
---|
| 327 | <term><command>sudoreplay</command></term>
|
---|
[3c0f868f] | 328 | <listitem>
|
---|
[bcd2922] | 329 | <para>
|
---|
[72d90b67] | 330 | is used to play back or list the output
|
---|
| 331 | logs created by <command>sudo</command>.
|
---|
[bcd2922] | 332 | </para>
|
---|
[72d90b67] | 333 | <indexterm zone="sudo sudoreplay">
|
---|
| 334 | <primary sortas="b-sudoreplay">sudoreplay</primary>
|
---|
[3c0f868f] | 335 | </indexterm>
|
---|
| 336 | </listitem>
|
---|
| 337 | </varlistentry>
|
---|
| 338 |
|
---|
[72d90b67] | 339 | <varlistentry id="visudo">
|
---|
| 340 | <term><command>visudo</command></term>
|
---|
[61b8305] | 341 | <listitem>
|
---|
[bcd2922] | 342 | <para>
|
---|
[72d90b67] | 343 | allows for safer editing of the <filename>sudoers</filename>
|
---|
| 344 | file.
|
---|
[bcd2922] | 345 | </para>
|
---|
[72d90b67] | 346 | <indexterm zone="sudo visudo">
|
---|
| 347 | <primary sortas="b-visudo">visudo</primary>
|
---|
[61b8305] | 348 | </indexterm>
|
---|
| 349 | </listitem>
|
---|
| 350 | </varlistentry>
|
---|
[3c0f868f] | 351 |
|
---|
[cf341b4] | 352 | </variablelist>
|
---|
| 353 |
|
---|
| 354 | </sect2>
|
---|
| 355 |
|
---|
| 356 | </sect1>
|
---|