]> git.saurik.com Git - apple/shell_cmds.git/blob - su/su.1
shell_cmds-116.tar.gz
[apple/shell_cmds.git] / su / su.1
1 .\" Copyright (c) 1988, 1990, 1993, 1994
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
19 .\"
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
30 .\" SUCH DAMAGE.
31 .\"
32 .\" from: @(#)su.1 8.2 (Berkeley) 4/18/94
33 .\" $NetBSD: su.1,v 1.14 1997/10/19 23:31:52 lukem Exp $
34 .\"
35 .Dd April 18, 1994
36 .Dt SU 1
37 .Os
38 .Sh NAME
39 .Nm su
40 .Nd substitute user identity
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl
44 .Op Fl flm
45 .Op Ar login Op Ar args
46 .Sh DESCRIPTION
47 .Nm
48 requests the password for
49 .Ar login
50 and switches to
51 that user and group ID after obtaining proper authentication.
52 A shell is then executed, and any additional
53 .Ar "shell arguments"
54 after the login name
55 are passed to the shell.
56 If
57 .Nm
58 is executed by root, no password is requested and a shell
59 with the appropriate user ID is executed.
60 .Pp
61 The options are as follows:
62 .Bl -tag -width Ds
63 .It Fl f
64 If the invoked shell is
65 .Xr csh 1 ,
66 this option prevents it from reading the
67 .Dq Pa .cshrc
68 file.
69 .It Fl l
70 Simulate a full login.
71 The environment is discarded except for
72 .Ev HOME ,
73 .Ev SHELL ,
74 .Ev PATH ,
75 .Ev TERM ,
76 and
77 .Ev USER .
78 .Ev HOME
79 and
80 .Ev SHELL
81 are modified as above.
82 .Ev USER
83 is set to the target login.
84 .Ev PATH
85 is set to
86 .Dq Pa /bin:/usr/bin .
87 .Ev TERM
88 is imported from your current environment.
89 The invoked shell is the target login's, and
90 .Nm
91 will change directory to the target login's home directory.
92 This option is identical to just passing "-", as in "su -".
93 .It Fl m
94 Leave the environment unmodified.
95 The invoked shell is your login shell, and no directory changes are made.
96 As a security precaution, if the target user's shell is a non-standard
97 shell (as defined by
98 .Xr getusershell 3 )
99 and the caller's real uid is
100 non-zero,
101 .Nm
102 will fail.
103 .El
104 .Pp
105 The
106 .Fl l
107 and
108 .Fl m
109 options are mutually exclusive; the last one specified
110 overrides any previous ones.
111 .Pp
112 Only users in group
113 .Dq wheel
114 (normally gid 0)
115 or group
116 .Dq admin
117 (normally gid 20) can
118 .Nm
119 to
120 .Dq root .
121 .Pp
122 By default (unless the prompt is reset by a startup file) the super-user
123 prompt is set to
124 .Dq Sy \&#
125 to remind one of its awesome power.
126 .Sh SEE ALSO
127 .Xr csh 1 ,
128 .Xr login 1 ,
129 .Xr sh 1 ,
130 .Xr skey 1 ,
131 .Xr kinit 1 ,
132 .Xr kerberos 1 ,
133 .Xr passwd 5 ,
134 .Xr group 5 ,
135 .Xr environ 7
136 .Sh ENVIRONMENT
137 Environment variables used by
138 .Nm
139 :
140 .Bl -tag -width "HOME"
141 .It Ev HOME
142 Default home directory of real user ID unless modified as
143 specified above.
144 .It Ev PATH
145 Default search path of real user ID unless modified as specified above.
146 .It Ev TERM
147 Provides terminal type which may be retained for the substituted
148 user ID.
149 .It Ev USER
150 The user ID is always the effective ID (the target user ID) after an
151 .Nm
152 unless the user ID is 0 (root).
153 .El
154 .Sh HISTORY
155 A
156 .Nm
157 command appeared in
158 .At v7 .