1 .\" Copyright (c) 1988, 1990, 1993, 1994
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)su.1 8.2 (Berkeley) 4/18/94
35 .Dd September 28, 2003
40 .Nd substitute user identity
46 .Op Ar login Op Ar args
50 utility requests appropriate user credentials via PAM
51 and switches to that user ID
52 (the default user is the superuser).
53 A shell is then executed.
55 PAM is used to set all policy.
57 By default, the environment is unmodified with the exception of
65 are set to the target login's default values.
67 is set to the target login, unless the target login has a user ID of 0,
68 in which case it is unmodified.
69 The invoked shell is the one belonging to the target login.
70 This is the traditional behavior of
72 Resource limits and session priority applicable to the original user's
75 are also normally retained unless the target login has a user ID of 0.
77 The options are as follows:
80 If the invoked shell is
82 this option prevents it from reading the
86 Simulate a full login.
87 The environment is discarded except for
97 are modified as above.
99 is set to the target login.
102 .Dq Pa /bin:/usr/bin .
104 is imported from your current environment.
105 Environment variables may be set or overridden from the login class
106 capabilities database according to the class of the target login.
107 The invoked shell is the target login's, and
109 will change directory to the target login's home directory.
110 Resource limits and session priority are modified to that for the
111 target account's login class.
113 (no letter) The same as
116 Leave the environment unmodified.
117 The invoked shell is your login shell, and no directory changes are made.
118 As a security precaution, if the target user's shell is a non-standard
121 and the caller's real uid is
126 Set the MAC label to the user's default label as part of the user
128 Setting the MAC label may fail if the MAC label of the invoking process
129 is not sufficient to transition to the user's default MAC label.
130 If the label cannot be set,
134 Use the settings of the specified login class.
135 Only allowed for the super-user.
144 options are mutually exclusive; the last one specified
145 overrides any previous ones.
149 are provided on the command line, they are passed to the login shell of
151 Note that all command line arguments before the target login name are
154 itself, everything after the target login name gets passed to the login
157 By default (unless the prompt is reset by a startup file) the super-user
160 to remind one of its awesome power.
162 .Bl -tag -width /etc/pam.conf -compact
165 is configured with PAM support; it uses
167 entries with service name
179 Environment variables used by
183 Default home directory of real user ID unless modified as
186 Default search path of real user ID unless modified as specified above.
188 Provides terminal type which may be retained for the substituted
191 The user ID is always the effective ID (the target user ID) after an
193 unless the user ID is 0 (root).
196 .Bl -tag -width 5n -compact
197 .It Li "su man -c catman"
202 You will be asked for man's password unless your real UID is 0.
203 .It Li "su man -c 'catman /usr/share/man /usr/local/man /usr/X11R6/man'"
204 Same as above, but the target command consists of more than a
205 single word and hence is quoted for use with the
207 option being passed to the shell.
208 (Most shells expect the argument to
210 to be a single word).
211 .It Li "su -c staff man -c 'catman /usr/share/man /usr/local/man /usr/X11R6/man'"
212 Same as above, but the target command is run with the resource limits of
215 Note: in this example, the first
219 while the second is an argument to the shell being invoked.
221 Simulate a login for user foo.
225 Simulate a login for root.