To use su, the appropriate password must be supplied (unless the invoker is already root). If the password is correct, su creates a new shell process that has the real and effective user ID, group IDs, and supplementary group list set to those of the specified username. The new shell will be the shell specified in the shell field of username's password file entry (see passwd.4 If no shell is specified, /usr/bin/sh is used (see sh.1 To return to normal user ID privileges, type an EOF character (CTRL-D) to exit the new shell.
Any additional arguments given on the command line are passed to the new shell. When using programs such as sh, an arg of the form -c string executes string using the shell and an arg of -r gives the user a restricted shell.
If the first argument to su is ` - ' (dash), the environment will be changed to what would be expected if the user actually logged in as the specified user. This is accomplished by invoking the program used as the shell with a first argument value whose initial character is ` - ' (dash), thus simulating a login. If the first argument to su is not ` - ' (dash), the environment is passed along unchanged, with the exception of $PATH, which is controlled by PATH and SUPATH in /etc/default/su.
All attempts to become another user using su are logged in the log file /var/adm/sulog (see sulog.4
To become user bin but change the environment to what would be expected if bin had originally logged in, execute:
To execute command with the temporary environment and permissions of user bin, type:
If any of the
LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC,
are not set in the environment, the operational behavior of
for each corresponding locale category is determined by
the value of the
environment variable. If
is set, its contents are used to override both the
and the other
variables. If none of the
above variables are set in the environment, the "C" (U.S. style)
locale determines how
Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97