Annotation of src/usr.bin/su/su.1, Revision 1.9
1.9 ! aaron 1: .\" $OpenBSD: su.1,v 1.8 1999/06/05 01:21:41 aaron Exp $
! 2: .\"
1.1 deraadt 3: .\" Copyright (c) 1988, 1990 The Regents of the University of California.
4: .\" All rights reserved.
5: .\"
6: .\" Redistribution and use in source and binary forms, with or without
7: .\" modification, are permitted provided that the following conditions
8: .\" are met:
9: .\" 1. Redistributions of source code must retain the above copyright
10: .\" notice, this list of conditions and the following disclaimer.
11: .\" 2. Redistributions in binary form must reproduce the above copyright
12: .\" notice, this list of conditions and the following disclaimer in the
13: .\" documentation and/or other materials provided with the distribution.
14: .\" 3. All advertising materials mentioning features or use of this software
15: .\" must display the following acknowledgement:
16: .\" This product includes software developed by the University of
17: .\" California, Berkeley and its contributors.
18: .\" 4. Neither the name of the University nor the names of its contributors
19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
34: .\" from: @(#)su.1 6.12 (Berkeley) 7/29/91
35: .\"
36: .Dd July 29, 1991
37: .Dt SU 1
38: .Os
39: .Sh NAME
40: .Nm su
41: .Nd substitute user identity
42: .Sh SYNOPSIS
43: .Nm su
44: .Op Fl Kflm
45: .Op Ar login Op Ar "shell arguments"
46: .Sh DESCRIPTION
1.8 aaron 47: .Nm
1.1 deraadt 48: requests the Kerberos password for
49: .Ar login
50: (or for
51: .Dq Ar login Ns .root ,
52: if no login is provided), and switches to
1.7 aaron 53: that user and group ID after obtaining a Kerberos ticket granting access.
1.1 deraadt 54: A shell is then executed, and any additional
55: .Ar "shell arguments"
56: after the login name
57: are passed to the shell.
1.8 aaron 58: .Nm
1.1 deraadt 59: will resort to the local password file to find the password for
60: .Ar login
1.4 millert 61: if there is a Kerberos error or if Kerberos is not installed.
1.1 deraadt 62: If
1.8 aaron 63: .Nm
1.1 deraadt 64: is executed by root, no password is requested and a shell
65: with the appropriate user ID is executed; no additional Kerberos tickets
66: are obtained.
67: .Pp
68: Alternately, if the user enters the password "s/key", they will be
69: authenticated using the S/Key one-time password system as described in
70: .Xr skey 1 .
71: S/Key is a Trademark of Bellcore.
72: .Pp
73: By default, the environment is unmodified with the exception of
1.5 millert 74: .Ev LOGNAME ,
1.1 deraadt 75: .Ev USER ,
76: .Ev HOME ,
77: and
78: .Ev SHELL .
79: .Ev HOME
80: and
81: .Ev SHELL
82: are set to the target login's default values.
1.5 millert 83: .Ev LOGNAME
84: and
1.1 deraadt 85: .Ev USER
1.5 millert 86: are set to the target login, unless the target login has a user ID of 0,
1.1 deraadt 87: in which case it is unmodified.
88: The invoked shell is the target login's.
89: This is the traditional behavior of
90: .Nm su .
91: .Pp
92: The options are as follows:
93: .Bl -tag -width Ds
94: .It Fl K
95: Do not attempt to use Kerberos to authenticate the user.
96: .It Fl f
97: If the invoked shell is
98: .Xr csh 1 ,
99: this option prevents it from reading the
100: .Dq Pa .cshrc
101: file.
102: .It Fl l
103: Simulate a full login.
104: The environment is discarded except for
105: .Ev HOME ,
106: .Ev SHELL ,
107: .Ev PATH ,
108: .Ev TERM ,
1.5 millert 109: .Ev LOGNAME ,
1.1 deraadt 110: and
111: .Ev USER .
112: .Ev HOME
113: and
114: .Ev SHELL
115: are modified as above.
1.5 millert 116: .Ev LOGNAME
117: and
1.1 deraadt 118: .Ev USER
1.5 millert 119: are set to the target login.
1.1 deraadt 120: .Ev PATH
121: is set to
1.4 millert 122: .Dq Pa /usr/bin:/bin .
1.1 deraadt 123: .Ev TERM
124: is imported from your current environment.
125: The invoked shell is the target login's, and
1.8 aaron 126: .Nm
1.1 deraadt 127: will change directory to the target login's home directory.
128: .It Fl m
129: Leave the environment unmodified.
130: The invoked shell is your login shell, and no directory changes are made.
131: As a security precaution, if the target user's shell is a non-standard
132: shell (as defined by
133: .Xr getusershell 3 )
1.7 aaron 134: and the caller's real UID is
1.1 deraadt 135: non-zero,
1.8 aaron 136: .Nm
1.1 deraadt 137: will fail.
138: .El
139: .Pp
140: The
141: .Fl l
142: and
143: .Fl m
144: options are mutually exclusive; the last one specified
145: overrides any previous ones.
1.8 aaron 146: .Pp
147: If the optional
1.4 millert 148: .Ar "shell arguments"
1.8 aaron 149: are provided on the command line, they are passed to the login shell of
1.9 ! aaron 150: the target login.
! 151: This allows it to pass arbitrary commands via the
1.8 aaron 152: .Fl c
1.9 ! aaron 153: option as understood by most shells.
! 154: Note that
1.8 aaron 155: .Fl c
1.4 millert 156: usually expects a single argument only; you have to quote it when
1.8 aaron 157: passing multiple words.
1.1 deraadt 158: .Pp
1.2 deraadt 159: If group 0 (normally
1.1 deraadt 160: .Dq wheel )
1.2 deraadt 161: has users listed then only those users can
1.8 aaron 162: .Nm
1.2 deraadt 163: to
164: .Dq root .
1.6 provos 165: It is not sufficient to change a user's
166: .Pa /etc/passwd
167: entry to add them to the
168: .Dq wheel
169: group; they must explicitly be listed in
170: .Pa /etc/group .
171: If no one is in the
172: .Dq wheel
173: group, it is ignored, and anyone who knows the root password is permitted to
1.8 aaron 174: .Nm
1.1 deraadt 175: to
176: .Dq root .
177: .Pp
1.9 ! aaron 178: By default (unless the prompt is reset by a startup file) the superuser
1.1 deraadt 179: prompt is set to
180: .Dq Sy \&#
181: to remind one of its awesome power.
1.8 aaron 182: .Sh EXAMPLES
183: .Bl -tag -width 5n -compact
184: .It Li "su bin -c makewhatis"
185: Runs the command
186: .Li makewhatis
187: as user
188: .Li bin .
189: You will be asked for bin's password unless your real UID is 0.
1.4 millert 190: .Pp
191: .It Li "su bin -c 'makewhatis /usr/local/man'"
1.8 aaron 192: Same as above, but the target command consists of more than a
193: single word.
1.4 millert 194: .Pp
1.8 aaron 195: .It Li "su -l foo"
196: Pretend a login for user
197: .Li foo .
198: .El
1.1 deraadt 199: .Sh ENVIRONMENT
1.9 ! aaron 200: The following environment variables affect the execution of
1.1 deraadt 201: .Nm su :
1.9 ! aaron 202: .Bl -tag -width LOGNAME
1.1 deraadt 203: .It Ev HOME
204: Default home directory of real user ID unless modified as
205: specified above.
206: .It Ev PATH
207: Default search path of real user ID unless modified as specified above.
208: .It Ev TERM
209: Provides terminal type which may be retained for the substituted
210: user ID.
1.5 millert 211: .It Ev LOGNAME
1.1 deraadt 212: The user ID is always the effective ID (the target user ID) after an
1.8 aaron 213: .Nm
1.1 deraadt 214: unless the user ID is 0 (root).
1.5 millert 215: .It Ev USER
216: Same as
217: .Ev LOGNAME .
1.1 deraadt 218: .El
1.9 ! aaron 219: .Sh SEE ALSO
! 220: .Xr csh 1 ,
! 221: .Xr kerberos 1 ,
! 222: .Xr kinit 1 ,
! 223: .Xr login 1 ,
! 224: .Xr sh 1 ,
! 225: .Xr skey 1 ,
! 226: .Xr group 5 ,
! 227: .Xr passwd 5 ,
! 228: .Xr environ 7
1.1 deraadt 229: .Sh HISTORY
230: A
231: .Nm
232: command appeared in
233: .At v7 .
234: The version described
235: here is an adaptation of the
236: .Tn MIT
237: Athena Kerberos command.