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. 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 .\" from: @(#)su.1 8.2 (Berkeley) 4/18/94
29 .\" $NetBSD: su.1,v 1.48 2007/10/27 18:43:37 christos Exp $
36 .Nd substitute user identity
40 .Op Fl c Ar login-class
42 .Ar login Ns Op : Ns Ar group
43 .Op Ar "shell arguments"
47 .Op Fl c Ar login-class
50 .Op Ar "shell arguments"
54 allows one user to become another user
56 without logging out and in as
64 then the group is changed to
73 is provided (form two above), then
75 is assumed to be the current username.
77 When executed by a user, the
79 user's password is requested.
80 When using Kerberos, the password for
83 .Dq Ar login Ns .root ,
84 if no login is provided) is requested, and
86 switches to that user and group ID after obtaining a Kerberos ticket
88 A shell is then executed, and any additional
90 after the login name are passed to the shell.
92 will resort to the local password file to find the password for
94 if there is a Kerberos error.
97 is executed by root, no password is requested and a shell
98 with the appropriate user ID is executed; no additional Kerberos tickets
101 Alternatively, if the user enters the password "s/key", authentication
102 will use the S/Key one-time password system as described in
104 S/Key is a Trademark of Bellcore.
106 By default, the environment is unmodified with the exception of
116 are set to the target login's default values.
120 are set to the target login, unless the target login has a user ID of 0,
121 in which case they are unmodified.
123 is set to the caller's login.
124 The invoked shell is the target login's.
125 With the exception of
127 this is the traditional behavior of
130 The options are as follows:
133 Specify a login class.
134 You may only override the default class if you're already root.
141 but does not change the current directory.
143 If the invoked shell is
145 this option prevents it from reading the
148 If the invoked shell is
154 thus preventing the shell from executing the startup file pointed to by
157 Do not attempt to use Kerberos to authenticate the user.
159 Simulate a full login.
160 The environment is discarded except for
173 are modified as above.
177 are set to the target login.
179 is set to the path specified in the
181 file (or to the default of
182 .Dq Pa /usr/bin:/bin:/usr/pkg/bin:/usr/local/bin
185 is imported from your current environment.
186 The invoked shell is the target login's, and
188 will change directory to the target login's home directory.
193 Leave the environment unmodified.
194 The invoked shell is your login shell, and no directory changes are made.
195 As a security precaution, if the target user's shell is a non-standard
198 and the caller's real uid is
208 options are mutually exclusive; the last one specified
209 overrides any previous ones.
220 unless group wheel does not exist or has no members.
221 (If you do not want anybody to be able to
227 the only member of group
229 which is the default.)
231 For sites with very large user populations, group
233 can contain the names of other groups that will be considered authorized
239 By default (unless the prompt is reset by a startup file) the super-user
242 to remind one of its awesome power.
245 .It Changing required group
250 the name of the required group can be changed by setting
255 auth requisite pam_group.so no_warn group=gname root_only fail_safe
262 the same can be achieved by compiling with
264 set to the desired group name.
265 .It Supplying own password
267 can be configured so that users in a particular group can supply their
268 own password to become
274 this can be done by adding a line to
278 auth sufficient pam_group.so no_warn group=gname root_only authenticate
283 is the name of the desired group.
288 the same can be achieved by compiling with
290 set to the desired group name.
292 This option is not available with the
301 .Dv SU_INDIRECT_GROUP
306 groups are treated as indirect groups.
307 The group members of those two groups are treated as groups themselves.
311 returns the exit status of the executed subshell, or 1 if any error
312 occurred while switching privileges.
314 Environment variables used by
316 .Bl -tag -width "HOME"
318 Default home directory of real user ID unless modified as
321 The user ID is always the effective ID (the target user ID) after an
323 unless the user ID is 0 (root).
325 Default search path of real user ID unless modified as specified above.
327 Provides terminal type which may be retained for the substituted
330 The user ID is always the effective ID (the target user ID) after an
332 unless the user ID is 0 (root).
335 To become user username and use the same environment as in original shell, execute:
336 .Bd -literal -offset indent
340 To become user username and use environment as if full login would be performed,
342 .Bd -literal -offset indent
354 option, because any arguments after the
356 are passed to the shell.
363 To execute arbitrary command with privileges of user
366 .Bd -literal -offset indent
367 su username -c "command args"
375 .Xr setusercontext 3 ,
386 (and probably earlier).