tizen 2.0
[external/shadow.git] / man / su.1
1 '\" t
2 .\"     Title: su
3 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
4 .\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
5 .\"      Date: 07/24/2009
6 .\"    Manual: User Commands
7 .\"    Source: User Commands
8 .\"  Language: English
9 .\"
10 .TH "SU" "1" "07/24/2009" "User Commands" "User Commands"
11 .\" -----------------------------------------------------------------
12 .\" * set default formatting
13 .\" -----------------------------------------------------------------
14 .\" disable hyphenation
15 .nh
16 .\" disable justification (adjust text to left margin only)
17 .ad l
18 .\" -----------------------------------------------------------------
19 .\" * MAIN CONTENT STARTS HERE *
20 .\" -----------------------------------------------------------------
21 .SH "NAME"
22 su \- change user ID or become superuser
23 .SH "SYNOPSIS"
24 .HP \w'\fBsu\fR\ 'u
25 \fBsu\fR [\fIoptions\fR] [\fIusername\fR]
26 .SH "DESCRIPTION"
27 .PP
28 The
29 \fBsu\fR
30 command is used to become another user during a login session\&. Invoked without a
31 \fBusername\fR,
32 \fBsu\fR
33 defaults to becoming the superuser\&. The optional argument
34 \fB\-\fR
35 may be used to provide an environment similar to what the user would expect had the user logged in directly\&.
36 .PP
37 Additional arguments may be provided after the username, in which case they are supplied to the user\'s login shell\&. In particular, an argument of
38 \fB\-c\fR
39 will cause the next argument to be treated as a command by most command interpreters\&. The command will be executed by the shell specified in
40 /etc/passwd
41 for the target user\&.
42 .PP
43 You can use the
44 \fB\-\-\fR
45 argument to separate
46 \fBsu\fR
47 options from the arguments supplied to the shell\&.
48 .PP
49 The user will be prompted for a password, if appropriate\&. Invalid passwords will produce an error message\&. All attempts, both valid and invalid, are logged to detect abuse of the system\&.
50 .PP
51 The current environment is passed to the new shell\&. The value of
52 \fB$PATH\fR
53 is reset to
54 /bin:/usr/bin
55 for normal users, or
56 /sbin:/bin:/usr/sbin:/usr/bin
57 for the superuser\&. This may be changed with the
58 \fBENV_PATH\fR
59 and
60 \fBENV_SUPATH\fR
61 definitions in
62 /etc/login\&.defs\&.
63 .PP
64 A subsystem login is indicated by the presence of a "*" as the first character of the login shell\&. The given home directory will be used as the root of a new file system which the user is actually logged into\&.
65 .SH "OPTIONS"
66 .PP
67 The options which apply to the
68 \fBsu\fR
69 command are:
70 .PP
71 \fB\-c\fR, \fB\-\-command\fR \fICOMMAND\fR
72 .RS 4
73 Specify a command that will be invoked by the shell using its
74 \fB\-c\fR\&.
75 .RE
76 .PP
77 \fB\-\fR, \fB\-l\fR, \fB\-\-login\fR
78 .RS 4
79 Provide an environment similar to what the user would expect had the user logged in directly\&.
80 .sp
81 When
82 \fB\-\fR
83 is used, it must be specified as the last
84 \fBsu\fR
85 option\&. The other forms (\fB\-l\fR
86 and
87 \fB\-\-login\fR) do not have this restriction\&.
88 .RE
89 .PP
90 \fB\-s\fR, \fB\-\-shell\fR \fISHELL\fR
91 .RS 4
92 The shell that will be invoked\&.
93 .sp
94 The invoked shell is chosen from (highest priority first):
95 .PP
96 .RS 4
97 The shell specified with \-\-shell\&.
98 .RE
99 .PP
100 .RS 4
101 If
102 \fB\-\-preserve\-environment\fR
103 is used, the shell specified by the
104 \fB$SHELL\fR
105 environment variable\&.
106 .RE
107 .PP
108 .RS 4
109 The shell indicated in the
110 /etc/passwd
111 entry for the target user\&.
112 .RE
113 .PP
114 .RS 4
115 /bin/sh
116 if a shell could not be found by any above method\&.
117 .RE
118 .sp
119 If the target user has a restricted shell (i\&.e\&. the shell field of this user\'s entry in
120 /etc/passwd
121 is not listed in
122 /etc/shell), then the
123 \fB\-\-shell\fR
124 option or the
125 \fB$SHELL\fR
126 environment variable won\'t be taken into account, unless
127 \fBsu\fR
128 is called by root\&.
129 .RE
130 .PP
131 \fB\-m\fR, \fB\-p\fR, \fB\-\-preserve\-environment\fR
132 .RS 4
133 Preserve the current environment, except for:
134 .PP
135 \fB$PATH\fR
136 .RS 4
137 reset according to the
138 /etc/login\&.defs
139 options
140 \fBENV_PATH\fR
141 or
142 \fBENV_SUPATH\fR
143 (see below);
144 .RE
145 .PP
146 \fB$IFS\fR
147 .RS 4
148 reset to
149 \(lq<space><tab><newline>\(rq, if it was set\&.
150 .RE
151 .sp
152 If the target user has a restricted shell, this option has no effect (unless
153 \fBsu\fR
154 is called by root)\&.
155 .sp
156 Note that the default behavior for the environment is the following:
157 .PP
158 .RS 4
159 The
160 \fB$HOME\fR,
161 \fB$SHELL\fR,
162 \fB$USER\fR,
163 \fB$LOGNAME\fR,
164 \fB$PATH\fR, and
165 \fB$IFS\fR
166 environment variables are reset\&.
167 .RE
168 .PP
169 .RS 4
170 If
171 \fB\-\-login\fR
172 is not used, the environment is copied, except for the variables above\&.
173 .RE
174 .PP
175 .RS 4
176 If
177 \fB\-\-login\fR
178 is used, the
179 \fB$TERM\fR,
180 \fB$COLORTERM\fR,
181 \fB$DISPLAY\fR, and
182 \fB$XAUTHORITY\fR
183 environment variables are copied if they were set\&.
184 .RE
185 .PP
186 .RS 4
187 If
188 \fB\-\-login\fR
189 is used, the
190 \fB$TZ\fR,
191 \fB$HZ\fR, and
192 \fB$MAIL\fR
193 environment variables are set according to the
194 /etc/login\&.defs
195 options
196 \fBENV_TZ\fR,
197 \fBENV_HZ\fR,
198 \fBMAIL_DIR\fR, and
199 \fBMAIL_FILE\fR
200 (see below)\&.
201 .RE
202 .PP
203 .RS 4
204 If
205 \fB\-\-login\fR
206 is used, other environment variables might be set by the
207 \fBENVIRON_FILE\fR
208 file (see below)\&.
209 .RE
210 .sp
211 .RE
212 .SH "CAVEATS"
213 .PP
214 This version of
215 \fBsu\fR
216 has many compilation options, only some of which may be in use at any particular site\&.
217 .SH "CONFIGURATION"
218 .PP
219 The following configuration variables in
220 /etc/login\&.defs
221 change the behavior of this tool:
222 .PP
223 \fBCONSOLE\fR (string)
224 .RS 4
225 If defined, either full pathname of a file containing device names (one per line) or a ":" delimited list of device names\&. Root logins will be allowed only upon these devices\&.
226 .sp
227 If not defined, root will be allowed on any device\&.
228 .sp
229 The device should be specified without the /dev/ prefix\&.
230 .RE
231 .PP
232 \fBCONSOLE_GROUPS\fR (string)
233 .RS 4
234 List of groups to add to the user\'s supplementary groups set when logging in on the console (as determined by the CONSOLE setting)\&. Default is none\&.
235
236 Use with caution \- it is possible for users to gain permanent access to these groups, even when not logged in on the console\&.
237 .RE
238 .PP
239 \fBDEFAULT_HOME\fR (boolean)
240 .RS 4
241 Indicate if login is allowed if we can\'t cd to the home directory\&. Default in no\&.
242 .sp
243 If set to
244 \fIyes\fR, the user will login in the root (/) directory if it is not possible to cd to her home directory\&.
245 .RE
246 .PP
247 \fBENV_HZ\fR (string)
248 .RS 4
249 If set, it will be used to define the HZ environment variable when a user login\&. The value must be preceded by
250 \fIHZ=\fR\&. A common value on Linux is
251 \fIHZ=100\fR\&.
252 .RE
253 .PP
254 \fBENVIRON_FILE\fR (string)
255 .RS 4
256 If this file exists and is readable, login environment will be read from it\&. Every line should be in the form name=value\&.
257 .sp
258 Lines starting with a # are treated as comment lines and ignored\&.
259 .RE
260 .PP
261 \fBENV_PATH\fR (string)
262 .RS 4
263 If set, it will be used to define the PATH environment variable when a regular user login\&. The value can be preceded by
264 \fIPATH=\fR, or a colon separated list of paths (for example
265 \fI/bin:/usr/bin\fR)\&. The default value is
266 \fIPATH=/bin:/usr/bin\fR\&.
267 .RE
268 .PP
269 \fBENV_SUPATH\fR (string)
270 .RS 4
271 If set, it will be used to define the PATH environment variable when the superuser login\&. The value can be preceded by
272 \fIPATH=\fR, or a colon separated list of paths (for example
273 \fI/sbin:/bin:/usr/sbin:/usr/bin\fR)\&. The default value is
274 \fIPATH=/bin:/usr/bin\fR\&.
275 .RE
276 .PP
277 \fBENV_TZ\fR (string)
278 .RS 4
279 If set, it will be used to define the TZ environment variable when a user login\&. The value can be the name of a timezone preceded by
280 \fITZ=\fR
281 (for example
282 \fITZ=CST6CDT\fR), or the full path to the file containing the timezone specification (for example
283 /etc/tzname)\&.
284 .sp
285 If a full path is specified but the file does not exist or cannot be read, the default is to use
286 \fITZ=CST6CDT\fR\&.
287 .RE
288 .PP
289 \fBLOGIN_STRING\fR (string)
290 .RS 4
291 The string used for prompting a password\&. The default is to use "Password: ", or a translation of that string\&. If you set this variable, the prompt will no be translated\&.
292 .sp
293 If the string contains
294 \fI%s\fR, this will be replaced by the user\'s name\&.
295 .RE
296 .PP
297 \fBMAIL_CHECK_ENAB\fR (boolean)
298 .RS 4
299 Enable checking and display of mailbox status upon login\&.
300 .sp
301 You should disable it if the shell startup files already check for mail ("mailx \-e" or equivalent)\&.
302 .RE
303 .PP
304 \fBMAIL_DIR\fR (string)
305 .RS 4
306 The mail spool directory\&. This is needed to manipulate the mailbox when its corresponding user account is modified or deleted\&. If not specified, a compile\-time default is used\&.
307 .RE
308 .PP
309 \fBMAIL_FILE\fR (string)
310 .RS 4
311 Defines the location of the users mail spool files relatively to their home directory\&.
312 .RE
313 .PP
314 The
315 \fBMAIL_DIR\fR
316 and
317 \fBMAIL_FILE\fR
318 variables are used by
319 \fBuseradd\fR,
320 \fBusermod\fR, and
321 \fBuserdel\fR
322 to create, move, or delete the user\'s mail spool\&.
323 .PP
324 If
325 \fBMAIL_CHECK_ENAB\fR
326 is set to
327 \fIyes\fR, they are also used to define the
328 \fBMAIL\fR
329 environment variable\&.
330 .PP
331 \fBQUOTAS_ENAB\fR (boolean)
332 .RS 4
333 Enable setting of ulimit, umask, and niceness from passwd gecos field\&.
334 .RE
335 .PP
336 \fBSULOG_FILE\fR (string)
337 .RS 4
338 If defined, all su activity is logged to this file\&.
339 .RE
340 .PP
341 \fBSU_NAME\fR (string)
342 .RS 4
343 If defined, the command name to display when running "su \-"\&. For example, if this is defined as "su" then a "ps" will display the command is "\-su"\&. If not defined, then "ps" would display the name of the shell actually being run, e\&.g\&. something like "\-sh"\&.
344 .RE
345 .PP
346 \fBSU_WHEEL_ONLY\fR (boolean)
347 .RS 4
348 If
349 \fIyes\fR, the user must be listed as a member of the first gid 0 group in
350 /etc/group
351 (called
352 \fIroot\fR
353 on most Linux systems) to be able to
354 \fBsu\fR
355 to uid 0 accounts\&. If the group doesn\'t exist or is empty, no one will be able to
356 \fBsu\fR
357 to uid 0\&.
358 .RE
359 .PP
360 \fBSYSLOG_SU_ENAB\fR (boolean)
361 .RS 4
362 Enable "syslog" logging of
363 \fBsu\fR
364 activity \- in addition to sulog file logging\&.
365 .RE
366 .PP
367 \fBUSERGROUPS_ENAB\fR (boolean)
368 .RS 4
369 Enable setting of the umask group bits to be the same as owner bits (examples: 022 \-> 002, 077 \-> 007) for non\-root users, if the uid is the same as gid, and username is the same as the primary group name\&.
370 .sp
371 If set to
372 \fIyes\fR,
373 \fBuserdel\fR
374 will remove the user\'s group if it contains no more members, and
375 \fBuseradd\fR
376 will create by default a group with the name of the user\&.
377 .RE
378 .SH "FILES"
379 .PP
380 /etc/passwd
381 .RS 4
382 User account information\&.
383 .RE
384 .PP
385 /etc/shadow
386 .RS 4
387 Secure user account information\&.
388 .RE
389 .PP
390 /etc/login\&.defs
391 .RS 4
392 Shadow password suite configuration\&.
393 .RE
394 .SH "SEE ALSO"
395 .PP
396 \fBlogin\fR(1),
397 \fBlogin.defs\fR(5),
398 \fBsg\fR(1),
399 \fBsh\fR(1)\&.