]> granicus.if.org Git - shadow/blob - man/su.1.xml
* man/faillog.8.xml: Minor updates.
[shadow] / man / su.1.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3    Copyright (c) 1989 - 1990, Julianne Frances Haugh
4    Copyright (c) 2007 - 2008, Nicolas François
5    All rights reserved.
6   
7    Redistribution and use in source and binary forms, with or without
8    modification, are permitted provided that the following conditions
9    are met:
10    1. Redistributions of source code must retain the above copyright
11       notice, this list of conditions and the following disclaimer.
12    2. Redistributions in binary form must reproduce the above copyright
13       notice, this list of conditions and the following disclaimer in the
14       documentation and/or other materials provided with the distribution.
15    3. The name of the copyright holders or contributors may not be used to
16       endorse or promote products derived from this software without
17       specific prior written permission.
18   
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22    PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
23    HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 -->
31 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
32   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
33 <!ENTITY CONSOLE               SYSTEM "login.defs.d/CONSOLE.xml">
34 <!ENTITY CONSOLE_GROUPS        SYSTEM "login.defs.d/CONSOLE_GROUPS.xml">
35 <!ENTITY DEFAULT_HOME          SYSTEM "login.defs.d/DEFAULT_HOME.xml">
36 <!ENTITY ENV_HZ                SYSTEM "login.defs.d/ENV_HZ.xml">
37 <!ENTITY ENVIRON_FILE          SYSTEM "login.defs.d/ENVIRON_FILE.xml">
38 <!ENTITY ENV_PATH              SYSTEM "login.defs.d/ENV_PATH.xml">
39 <!ENTITY ENV_SUPATH            SYSTEM "login.defs.d/ENV_SUPATH.xml">
40 <!ENTITY ENV_TZ                SYSTEM "login.defs.d/ENV_TZ.xml">
41 <!ENTITY LOGIN_STRING          SYSTEM "login.defs.d/LOGIN_STRING.xml">
42 <!ENTITY MAIL_CHECK_ENAB       SYSTEM "login.defs.d/MAIL_CHECK_ENAB.xml">
43 <!ENTITY MAIL_DIR              SYSTEM "login.defs.d/MAIL_DIR.xml">
44 <!ENTITY QUOTAS_ENAB           SYSTEM "login.defs.d/QUOTAS_ENAB.xml">
45 <!ENTITY SULOG_FILE            SYSTEM "login.defs.d/SULOG_FILE.xml">
46 <!ENTITY SU_NAME               SYSTEM "login.defs.d/SU_NAME.xml">
47 <!ENTITY SU_WHEEL_ONLY         SYSTEM "login.defs.d/SU_WHEEL_ONLY.xml">
48 <!ENTITY SYSLOG_SU_ENAB        SYSTEM "login.defs.d/SYSLOG_SU_ENAB.xml">
49 <!ENTITY USERGROUPS_ENAB       SYSTEM "login.defs.d/USERGROUPS_ENAB.xml">
50 ]>
51 <refentry id='su.1'>
52   <!--  $Id$ -->
53   <refmeta>
54     <refentrytitle>su</refentrytitle>
55     <manvolnum>1</manvolnum>
56     <refmiscinfo class="sectdesc">User Commands</refmiscinfo>
57   </refmeta>
58   <refnamediv id='name'>
59     <refname>su</refname>
60     <refpurpose>change user ID or become superuser</refpurpose>
61   </refnamediv>
62   <refsynopsisdiv id='synopsis'>
63     <cmdsynopsis>
64       <command>su</command>
65       <arg choice='opt'>
66         <replaceable>options</replaceable>
67       </arg>
68       <arg choice='opt'>
69         <arg choice='plain'>
70           <replaceable>username</replaceable>
71         </arg>
72       </arg>
73     </cmdsynopsis>
74   </refsynopsisdiv>
75
76   <refsect1 id='description'>
77     <title>DESCRIPTION</title>
78     <para>
79       The <command>su</command> command is used to become another user during
80       a login session. Invoked without a <option>username</option>, 
81       <command>su</command> defaults to
82       becoming the superuser. The optional argument <option>-</option> may
83       be used to provide an environment similar to what the user would
84       expect had the user logged in directly.
85     </para>
86
87     <para>
88       Additional arguments may be provided after the username, in which case
89       they are supplied to the user's login shell. In particular, an
90       argument of <option>-c</option> will cause the next argument to be
91       treated as a command by most command interpreters. The command will be
92       executed by the shell specified in <filename>/etc/passwd</filename>
93       for the target user.
94     </para>
95
96     <para>
97       You can use the <option>--</option> argument to separate
98       <command>su</command> options from the arguments supplied to the shell.
99     </para>
100
101     <para>The user will be prompted for a password, if appropriate. Invalid
102       passwords will produce an error message. All attempts, both valid and
103       invalid, are logged to detect abuse of the system.
104     </para>
105
106     <para>
107       The current environment is passed to the new shell. The value of
108       <envar>$PATH</envar> is reset to <filename>/bin:/usr/bin</filename>
109       for normal users, or <filename>/sbin:/bin:/usr/sbin:/usr/bin</filename>
110       for the superuser. This may be changed with the
111       <emphasis>ENV_PATH</emphasis> and <emphasis>ENV_SUPATH</emphasis>
112       definitions in <filename>/etc/login.defs</filename>.
113     </para>
114
115     <para>
116       A subsystem login is indicated by the presence of a "*" as the first
117       character of the login shell. The given home directory will be used as
118       the root of a new file system which the user is actually logged into.
119     </para>
120   </refsect1>
121
122   <refsect1 id='options'>
123     <title>OPTIONS</title>
124     <para>The options which apply to the <command>su</command> command are:
125     </para>
126     <variablelist remap='IP'>
127       <varlistentry>
128         <term>
129           <option>-c</option>, <option>--command</option>
130           <replaceable>COMMAND</replaceable>
131         </term>
132         <listitem>
133           <para>
134             Specify a command that will be invoked by the shell using its
135             <option>-c</option>.
136           </para>
137         </listitem>
138       </varlistentry>
139       <varlistentry>
140         <term>
141           <option>-</option>, <option>-l</option>, <option>--login</option>
142         </term>
143         <listitem>
144           <para>
145             Provide an environment similar to what the user would expect had
146             the user logged in directly.
147           </para>
148           <para>
149             When <option>-</option> is used, it must be specified as the last
150             <command>su</command> option.
151             The other forms (<option>-l</option> and <option>--login</option>)
152             do not have this restriction.
153           </para>
154         </listitem>
155       </varlistentry>
156       <varlistentry>
157         <term>
158           <option>-s</option>, <option>--shell</option>
159           <replaceable>SHELL</replaceable>
160         </term>
161         <listitem>
162           <para>The shell that will be invoked.</para>
163           <para>
164             The invoked shell is chosen from (highest priority first):
165             <itemizedlist>
166               <listitem>
167                 <para>The shell specified with --shell.</para>
168               </listitem>
169               <listitem>
170                 <para>
171                   If <option>--preserve-environment</option> is used, the
172                   shell specified by the <envar>$SHELL</envar> environment
173                   variable.
174                 </para>
175               </listitem>
176               <listitem>
177                 <para>
178                   The shell indicated in the <filename>/etc/passwd</filename>
179                   entry for the target user.
180                 </para>
181               </listitem>
182               <listitem>
183                 <para>
184                   <filename>/bin/sh</filename> if a shell could not be
185                   found by any above method.
186                 </para>
187               </listitem>
188             </itemizedlist>
189           </para>
190           <para>
191             If the target user has a restricted shell (i.e. the shell field of
192             this user's entry in <filename>/etc/passwd</filename> is not
193             listed in <filename>/etc/shell</filename>), then the
194             <option>--shell</option> option or the <envar>$SHELL</envar>
195             environment variable won't be taken into account, unless
196             <command>su</command> is called by root.
197           </para>
198         </listitem>
199       </varlistentry>
200       <varlistentry>
201         <term>
202           <option>-m</option>, <option>-p</option>,
203           <option>--preserve-environment</option>
204         </term>
205         <listitem>
206           <para>Preserve the current environment.</para>
207           <para>
208             If the target user has a restricted shell, this option has no
209             effect (unless <command>su</command> is called by root).
210           </para>
211         </listitem>
212       </varlistentry>
213     </variablelist>
214   </refsect1>
215
216   <refsect1 id='caveats'>
217     <title>CAVEATS</title>
218     <para>
219       This version of <command>su</command> has many compilation options,
220       only some of which may be in use at any particular site.
221     </para>
222   </refsect1>
223
224   <refsect1 id='configuration'>
225     <title>CONFIGURATION</title>
226     <para>
227       The following configuration variables in
228       <filename>/etc/login.defs</filename> change the behavior of this
229       tool:
230     </para>
231     <variablelist>
232       &CONSOLE;
233       &CONSOLE_GROUPS;
234       &DEFAULT_HOME;
235       <phrase condition="no_pam">&ENV_HZ;</phrase>
236       &ENVIRON_FILE;
237       &ENV_PATH;
238       &ENV_SUPATH;
239       &ENV_TZ;
240       <phrase condition="no_pam">&LOGIN_STRING;</phrase>
241       &MAIL_CHECK_ENAB;
242       <phrase condition="no_pam">&MAIL_DIR;</phrase>
243       &QUOTAS_ENAB;
244       &SULOG_FILE;
245       &SU_NAME;
246       &SU_WHEEL_ONLY;
247       &SYSLOG_SU_ENAB;
248       <phrase condition="no_pam">&USERGROUPS_ENAB;</phrase>
249     </variablelist>
250   </refsect1>
251
252   <refsect1 id='files'>
253     <title>FILES</title>
254     <variablelist>
255       <varlistentry>
256         <term><filename>/etc/passwd</filename></term>
257         <listitem>
258           <para>User account information.</para>
259         </listitem>
260       </varlistentry>
261       <varlistentry>
262         <term><filename>/etc/shadow</filename></term>
263         <listitem>
264           <para>Secure user account information.</para>
265         </listitem>
266       </varlistentry>
267     </variablelist>
268   </refsect1>
269
270   <refsect1 id='see_also'>
271     <title>SEE ALSO</title>
272     <para><citerefentry>
273         <refentrytitle>login</refentrytitle><manvolnum>1</manvolnum>
274       </citerefentry>,
275       <citerefentry>
276         <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
277       </citerefentry>,
278       <citerefentry>
279         <refentrytitle>sg</refentrytitle><manvolnum>1</manvolnum>
280       </citerefentry>,
281       <citerefentry>
282         <refentrytitle>sh</refentrytitle><manvolnum>1</manvolnum>
283       </citerefentry>
284     </para>
285   </refsect1>
286 </refentry>