source: postlfs/security/sudo.xml@ 7f99ddf

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 7f99ddf was 7f99ddf, checked in by Pierre Labastie <pieere@…>, 4 years ago

Expand the explanation of --with-passprompt for sudo. Thanks to K. Buckley
for the patch

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@23041 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 11.9 KB
RevLine 
[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">
[9da80b86]9 <!ENTITY sudo-md5sum "ffb34c62c511fd3f9862d7f48eb8d655">
[d7bbb40]10 <!ENTITY sudo-size "3.2 MB">
[741f35be]11 <!ENTITY sudo-buildsize "39 MB (with tests)">
12 <!ENTITY sudo-time "0.4 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
[66c4901f]40 &lfs91_checked;
[a8d3d55a]41
[cf341b4]42 <bridgehead renderas="sect3">Package Information</bridgehead>
43 <itemizedlist spacing="compact">
44 <listitem>
[bcd2922]45 <para>
46 Download (HTTP): <ulink url="&sudo-download-http;"/>
47 </para>
[cf341b4]48 </listitem>
49 <listitem>
[bcd2922]50 <para>
51 Download (FTP): <ulink url="&sudo-download-ftp;"/>
52 </para>
[cf341b4]53 </listitem>
54 <listitem>
[bcd2922]55 <para>
56 Download MD5 sum: &sudo-md5sum;
57 </para>
[cf341b4]58 </listitem>
59 <listitem>
[bcd2922]60 <para>
61 Download size: &sudo-size;
62 </para>
[cf341b4]63 </listitem>
64 <listitem>
[bcd2922]65 <para>
66 Estimated disk space required: &sudo-buildsize;
67 </para>
[cf341b4]68 </listitem>
69 <listitem>
[bcd2922]70 <para>
71 Estimated build time: &sudo-time;
72 </para>
[cf341b4]73 </listitem>
74 </itemizedlist>
75
76 <bridgehead renderas="sect3">Sudo Dependencies</bridgehead>
77
78 <bridgehead renderas="sect4">Optional</bridgehead>
[bcd2922]79 <para role="optional">
80 <xref linkend="linux-pam"/>,
81 <xref linkend="mitkrb"/>,
82 <xref linkend="openldap"/>,
[6b4f8529]83 <xref linkend="server-mail"/> (that provides a
84 <command>sendmail</command> command),
85 <ulink url="http://www.openafs.org/">AFS</ulink>,
[06915b3]86 <ulink url="http://www.fwtk.org/">FWTK</ulink>, and
[8dfc5c3]87 <ulink url="&sourceforge-dl;/opie/">Opie</ulink>
[06915b3]88<!-- <ulink url="http://www.rsa.com/node.aspx?id=1156">SecurID</ulink>-->
[bcd2922]89 </para>
[b35e86b2]90
[3597eb6]91 <para condition="html" role="usernotes">User Notes:
[bcd2922]92 <ulink url="&blfs-wiki;/sudo"/>
93 </para>
[cf341b4]94 </sect2>
95
96 <sect2 role="installation">
97 <title>Installation of Sudo</title>
98
[0f79af41]99 <para>
100 First, fix a problem that prevents installation from completion:
101 </para>
102
103<screen><userinput>sed -e '/^pre-install:/{N;s@;@ -a -r $(sudoersdir)/sudoers;@}' \
104 -i plugins/sudoers/Makefile.in</userinput></screen>
105
[bcd2922]106 <para>
[6e5d584]107 Install <application>Sudo</application> by running the following commands:
[bcd2922]108 </para>
[cf341b4]109
[1c69133]110<!-- Developer: apparently it is disabled by default, although in configure it
111is written otherwise -disable-static \-->
[b9d56ad4]112<screen><userinput>./configure --prefix=/usr \
[edaee95]113 --libexecdir=/usr/lib \
[1a657ca]114 --with-secure-path \
[b9d56ad4]115 --with-all-insults \
116 --with-env-editor \
117 --docdir=/usr/share/doc/sudo-&sudo-version; \
[9dabcf3]118 --with-passprompt="[sudo] password for %p: " &amp;&amp;
[cf341b4]119make</userinput></screen>
120
[bcd2922]121 <para>
[6b4f8529]122 To test the results, issue: <command>env LC_ALL=C make check 2&gt;&amp;1
123 | tee ../make-check.log</command>. Check the results with <command>grep
[ecd8cc2]124 failed ../make-check.log</command>. One test, test3, is known to fail
125 if the tests are run as the root user.
[bcd2922]126 </para>
[21755bc]127
[bcd2922]128 <para>
129 Now, as the <systemitem class="username">root</systemitem> user:
130 </para>
[cf341b4]131
[2809c8c]132<screen role="root"><userinput>make install &amp;&amp;
133ln -sfv libsudo_util.so.0.0.0 /usr/lib/sudo/libsudo_util.so.0</userinput></screen>
[cf341b4]134
135 </sect2>
136
137 <sect2 role="commands">
138 <title>Command Explanations</title>
139
[663b79c2]140 <para>
[edaee95]141 <parameter>--libexecdir=/usr/lib</parameter>: This switch controls where
[663b79c2]142 private programs are installed. Everything in that directory is a library, so
143 they belong under <filename class="directory">/usr/lib</filename> instead of
144 <filename class="directory">/usr/libexec</filename>.
[8466229]145 </para>
146
147 <para>
148 <parameter>--with-secure-path</parameter>: This switch transparently adds
149 <filename class="directory">/sbin</filename> and <filename
150 class="directory">/usr/sbin</filename> directories to the
151 <envar>PATH</envar> environment variable.
[663b79c2]152 </para>
153
[bcd2922]154 <para>
[f3d174f]155 <parameter>--with-all-insults</parameter>: This switch includes all the
[bcd2922]156 <application>sudo</application> insult sets.
157 </para>
[cf341b4]158
[bcd2922]159 <para>
[f3d174f]160 <parameter>--with-env-editor</parameter>: This switch enables use of the
[bcd2922]161 environment variable EDITOR for <command>visudo</command>.
162 </para>
[8890b85f]163
[f3d174f]164 <para>
[ecea644]165 <parameter>--with-passprompt</parameter>: This switch sets the password prompt.
[7f99ddf]166 The <parameter>%p</parameter> will be expanded to the name of the user whose password is being requested.
[f3d174f]167 </para>
168
[14c71e0]169 <para>
[f586237]170 <option>--without-pam</option>: This switch avoids building
171 <application>Linux-PAM</application> support when
172 <application>Linux-PAM</application> is installed on the system.
[14c71e0]173 </para>
[17b685f1]174<!-- See the developer note above before the configure command
[b9d56ad4]175 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[f1d7196]176 href="../../xincludes/static-libraries.xml"/>-->
[b9d56ad4]177
[33d90fe]178 <note>
[bcd2922]179 <para>
180 There are many options to <application>sudo</application>'s
181 <command>configure</command> command. Check the
182 <command>configure --help</command> output for a complete list.
183 </para>
[33d90fe]184 </note>
[cf341b4]185
[2809c8c]186 <para>
[f586237]187 <command>ln -sfv libsudo_util...</command>: Works around a bug in the
[2809c8c]188 installation process, which links to the previously installed
189 version (if there is one) instead of the new one.
190 </para>
191
[cf341b4]192 </sect2>
193
194 <sect2 role="configuration">
195 <title>Configuring Sudo</title>
196
197 <sect3 id="sudo-config">
198 <title>Config File</title>
199
[7a47afc]200 <para>
201 <filename>/etc/sudoers</filename>
202 </para>
[cf341b4]203
204 <indexterm zone="sudo sudo-config">
205 <primary sortas="e-etc-sudoers">/etc/sudoers</primary>
206 </indexterm>
207
208 </sect3>
209
210 <sect3>
211 <title>Configuration Information</title>
212
[bcd2922]213 <para>
214 The <filename>sudoers</filename> file can be quite complicated. It
215 is composed of two types of entries: aliases (basically variables) and
216 user specifications (which specify who may run what). The installation
[b4c31a6]217 installs a default configuration that has no privileges installed for
218 any user.
[bcd2922]219 </para>
[bccbdaea]220
[a5b9f1e]221 <para>
[77b64bd]222 A couple of common configuration chanes are to set the path for the
223 super user and to allow members of the wheel group to execute all
224 commands after providing their own credientials. Use the following
225 commands to create the <filename>/etc/sudoers.d/sudo</filename>
226 configuration file as the
227 <systemitem class="username">root</systemitem> user:
[a5b9f1e]228 </para>
229
[77b64bd]230<screen role="root"><userinput>cat &gt; /etc/sudoers.d/sudo &lt;&lt; "EOF"
231<literal>Defaults secure_path="/usr/bin:/bin:/usr/sbin:/sbin"
232%wheel ALL=(ALL) ALL</literal>
233EOF</userinput></screen>
[a5b9f1e]234
[bcd2922]235 <para>
236 For details, see <command>man sudoers</command>.
237 </para>
[cf341b4]238
[3c0f868f]239 <note>
[bcd2922]240 <para>
241 The <application>Sudo</application> developers highly recommend
242 using the <command>visudo</command> program to edit the
243 <filename>sudoers</filename> file. This will provide basic sanity
[b4c31a6]244 checking like syntax parsing and file permission to avoid some
245 possible mistakes that could lead to a vulnerable configuration.
[bcd2922]246 </para>
[3c0f868f]247 </note>
248
[bcd2922]249 <para>
[14c71e0]250 If <application>PAM</application> is installed on the system,
251 <application>Sudo</application> is built with
[b4c31a6]252 <application>PAM</application> support. In that case, issue the
253 following command as the <systemitem class="username">root</systemitem>
254 user to create the <application>PAM</application> configuration file:
[bcd2922]255 </para>
[8890b85f]256
[add8d4f]257<screen role="root"><userinput>cat &gt; /etc/pam.d/sudo &lt;&lt; "EOF"
258<literal># Begin /etc/pam.d/sudo
[b3a4f60]259
260# include the default auth settings
261auth include system-auth
262
263# include the default account settings
264account include system-account
265
266# Set default environment variables for the service user
267session required pam_env.so
268
269# include system session defaults
270session include system-session
271
[add8d4f]272# End /etc/pam.d/sudo</literal>
[b3a4f60]273EOF
274chmod 644 /etc/pam.d/sudo</userinput></screen>
[fd7e0ed6]275
[cf341b4]276 </sect3>
277
278 </sect2>
279
280 <sect2 role="content">
281 <title>Contents</title>
282
283 <segmentedlist>
284 <segtitle>Installed Programs</segtitle>
[9d53187]285 <segtitle>Installed Libraries</segtitle>
[cf341b4]286 <segtitle>Installed Directories</segtitle>
287
288 <seglistitem>
[bcd2922]289 <seg>
[d7bbb40]290 cvtsudoers, sudo, sudoedit (symlink), sudoreplay, and visudo
[bcd2922]291 </seg>
292 <seg>
[6b4f8529]293 group_file.so, libsudo_util.so,
294 sudoers.so, sudo_noexec.so, and system_group.so
[bcd2922]295 </seg>
296 <seg>
[7a47afc]297 /etc/sudoers.d,
[b378aa0]298 /usr/lib/sudo,
[06915b3]299 /usr/share/doc/sudo-&sudo-version;, and
300 /var/{lib,run}/sudo
[bcd2922]301 </seg>
[cf341b4]302 </seglistitem>
303 </segmentedlist>
304
305 <variablelist>
306 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
307 <?dbfo list-presentation="list"?>
308 <?dbhtml list-presentation="table"?>
309
[d7bbb40]310 <varlistentry id="cvtsudoers">
311 <term><command>cvtsudoers</command></term>
312 <listitem>
313 <para>
314 converts between sudoers file formats.
315 </para>
316 <indexterm zone="sudo cvtsudoers">
317 <primary sortas="b-cvtsudoers">cvtsudoers</primary>
318 </indexterm>
319 </listitem>
320 </varlistentry>
321
[cf341b4]322 <varlistentry id="sudo_prog">
323 <term><command>sudo</command></term>
324 <listitem>
[bcd2922]325 <para>
326 executes a command as another user as permitted by
327 the <filename>/etc/sudoers</filename> configuration file.
[cf341b4]328 </para>
329 <indexterm zone="sudo sudo">
330 <primary sortas="b-sudo">sudo</primary>
331 </indexterm>
332 </listitem>
333 </varlistentry>
334
335 <varlistentry id="sudoedit">
336 <term><command>sudoedit</command></term>
337 <listitem>
[bcd2922]338 <para>
[a1e0f76]339 is a symlink to <command>sudo</command> that implies the
[bcd2922]340 <option>-e</option> option to invoke an editor as another user.
341 </para>
[cf341b4]342 <indexterm zone="sudo sudoedit">
343 <primary sortas="b-sudoedit">sudoedit</primary>
344 </indexterm>
345 </listitem>
346 </varlistentry>
347
[72d90b67]348 <varlistentry id="sudoreplay">
349 <term><command>sudoreplay</command></term>
[3c0f868f]350 <listitem>
[bcd2922]351 <para>
[72d90b67]352 is used to play back or list the output
353 logs created by <command>sudo</command>.
[bcd2922]354 </para>
[72d90b67]355 <indexterm zone="sudo sudoreplay">
356 <primary sortas="b-sudoreplay">sudoreplay</primary>
[3c0f868f]357 </indexterm>
358 </listitem>
359 </varlistentry>
360
[72d90b67]361 <varlistentry id="visudo">
362 <term><command>visudo</command></term>
[61b8305]363 <listitem>
[bcd2922]364 <para>
[72d90b67]365 allows for safer editing of the <filename>sudoers</filename>
366 file.
[bcd2922]367 </para>
[72d90b67]368 <indexterm zone="sudo visudo">
369 <primary sortas="b-visudo">visudo</primary>
[61b8305]370 </indexterm>
371 </listitem>
372 </varlistentry>
[3c0f868f]373
[cf341b4]374 </variablelist>
375
376 </sect2>
377
378</sect1>
Note: See TracBrowser for help on using the repository browser.