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 .\" 4. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)su.1 8.2 (Berkeley) 4/18/94
36 .Nd substitute user identity
42 .Op Ar login Op Ar args
46 utility requests appropriate user credentials via PAM
47 and switches to that user ID
48 (the default user is the superuser).
49 A shell is then executed.
51 PAM is used to set the policy
54 In particular, by default only users in the
56 group can switch to UID 0
58 This group requirement may be changed by modifying the
64 for details on how to modify this setting.
66 By default, the environment is unmodified with the exception of
74 are set to the target login's default values.
76 is set to the target login, unless the target login has a user ID of 0,
77 in which case it is unmodified.
78 The invoked shell is the one belonging to the target login.
79 This is the traditional behavior of
81 Resource limits and session priority applicable to the original user's
84 are also normally retained unless the target login has a user ID of 0.
86 The options are as follows:
89 If the invoked shell is
91 this option prevents it from reading the
95 Simulate a full login.
96 The environment is discarded except for
106 are modified as above.
108 is set to the target login.
111 .Dq Pa /bin:/usr/bin .
113 is imported from your current environment.
114 Environment variables may be set or overridden from the login class
115 capabilities database according to the class of the target login.
116 The invoked shell is the target login's, and
118 will change directory to the target login's home directory.
119 Resource limits and session priority are modified to that for the
120 target account's login class.
122 (no letter) The same as
125 Leave the environment unmodified.
126 The invoked shell is your login shell, and no directory changes are made.
127 As a security precaution, if the target user's shell is a non-standard
130 and the caller's real uid is
135 Set the MAC label to the user's default label as part of the user
137 Setting the MAC label may fail if the MAC label of the invoking process
138 is not sufficient to transition to the user's default MAC label.
139 If the label cannot be set,
143 Use the settings of the specified login class.
144 Only allowed for the super-user.
153 options are mutually exclusive; the last one specified
154 overrides any previous ones.
158 are provided on the command line, they are passed to the login shell of
160 Note that all command line arguments before the target login name are
163 itself, everything after the target login name gets passed to the login
166 By default (unless the prompt is reset by a startup file) the super-user
169 to remind one of its awesome power.
171 Environment variables used by
175 Default home directory of real user ID unless modified as
178 Default search path of real user ID unless modified as specified above.
180 Provides terminal type which may be retained for the substituted
183 The user ID is always the effective ID (the target user ID) after an
185 unless the user ID is 0 (root).
188 .Bl -tag -width ".Pa /etc/pam.d/su" -compact
190 PAM configuration for
194 .Bl -tag -width 5n -compact
195 .It Li "su -m man -c catman"
196 Starts a shell as user
200 You will be asked for man's password unless your real UID is 0.
203 option is required since user
205 does not have a valid shell by default.
208 is passed to the shell of the user
210 and is not interpreted as an argument to
212 .It Li "su -m man -c 'catman /usr/share/man /usr/local/man'"
213 Same as above, but the target command consists of more than a
214 single word and hence is quoted for use with the
216 option being passed to the shell.
217 (Most shells expect the argument to
219 to be a single word).
220 .It Li "su -m -c staff man -c 'catman /usr/share/man /usr/local/man'"
221 Same as above, but the target command is run with the resource limits of
224 Note: in this example, the first
228 while the second is an argument to the shell being invoked.
230 Simulate a login for user foo.
234 Simulate a login for root.