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