su(8) CLIX su(8)
NAME
su - Accesses another user account
SYNOPSIS
su [-] [name [arg ... ]]
DESCRIPTION
The su command allows one to become another user without logging off. The
default user name is root (or superuser).
To use su, the appropriate password must be supplied (unless one is
already root). If the password is correct, su will execute a new shell
with the real and effective user identification set to that of the
specified user. The new shell will be the optional program named in the
shell field of the specified user's password file entry (see passwd), or
/bin/sh if none is specified (see sh). To restore normal user ID
privileges, enter an end-of-file character (the <Ctrl-D> sequence) to the
new shell.
Any additional arguments given on the command line are passed to the
program invoked as the shell. When using programs like sh, an arg of the
form -c string executes string with the shell and an arg of -r will give
the user a restricted shell.
The following statements are true only if the optional program named in
the shell field of the specified user's password file entry is like sh.
If the first argument to su is a -, the environment will be changed to
what would be expected if the user actually logged in as the specified
user. This is done by invoking the program used as the shell with an arg0
value whose first character is -, thus causing first the system's profile
(/etc/profile) and then the specified user's profile (.profile in the new
$HOME directory) to be executed. Otherwise, the environment is passed
along with the possible exception of $PATH, which is set to
/bin:/etc:/usr/bin for root. Note that if the optional program used as
the shell is /bin/sh, the user's .profile can check arg0 for -sh -su to
determine if it was invoked by login or su, respectively. If the user's
program is other than /bin/sh, then .profile is invoked with an arg0 of -
program by both login and su.
All attempts to become another user using su are logged in the log file
/usr/adm/sulog.
EXAMPLES
1. To become user bin while retaining your previously exported
environment, key in:
su bin
2/94 - Intergraph Corporation 1
su(8) CLIX su(8)
2. To become user bin but change the environment to what would be
expected if bin had originally logged in, key in the following:
su - bin
3. To execute command with the temporary environment and permissions of
user bin, key in the following:
su - bin -c command args
FILES
/etc/passwd
System password file.
/etc/profile
System profile.
$HOME/.profile
User profile.
/usr/adm/sulog
Log file.
NOTES
The su command does not recognize password aging, and will allow access to
accounts with the command-dot (,.) password without forcing a password to
be entered.
RELATED INFORMATION
Commands: env(1), login(1), sh(1)
Files: environ(4), passwd(4), profile(4)
2 Intergraph Corporation - 2/94