SU(1) DOMAIN/IX Reference Manual (SYS5) SU(1)
NAME
su - become super-user or another user
USAGE
su [ - ] [ name [ arg ... ] ]
DESCRIPTION
Su allows you to be recognized as another user without log-
ging off. The default user name is root (i.e., super-user).
Su requires that you supply the appropriate password (unless
you are already root). If the password is correct, su exe-
cutes a new Shell with the real and effective user ID 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, or /bin/sh if none is specified.
See passwd (4) and sh (1) for more information. To restore
normal user ID privileges, type an EOF (↑Z) to the new
Shell.
Any additional arguments given on the command line are
passed to the program invoked as the Shell. When using pro-
grams like sh(1), an arg of the form -c string executes
string via the Shell, and an arg of -r gives the user a res-
tricted Shell.
The following statements are true only if the optional pro-
gram named in the Shell field of the specified user's pass-
word file entry is like sh(1). If the first argument to su
is a dash (-), the environment is changed to what would be
expected if you 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, your .profile can check arg0 for -sh or -su to
determine if it was invoked by login (1) or su respectively.
If your program is other than /bin/sh, then .profile is
invoked with an arg0 of -program by both login (1) and su.
All attempts to become another user using su are logged in
the log file /usr/adm/sulog.
EXAMPLES
To become user bin while retaining your previously exported
environment, execute the following:
Printed 6/10/85 SU-1
SU(1) DOMAIN/IX Reference Manual (SYS5) SU(1)
su bin
To become user bin but change the environment to what would
be expected if bin had originally logged in, execute:
su - bin
SU-2 Printed 6/10/85
SU(1) DOMAIN/IX Reference Manual (SYS5) SU(1)
To execute command with the temporary environment and per-
missions of user bin, type:
su - bin -c command args
FILES
/etc/passwd system's password file
/etc/profile system's profile
$HOME.profile user's profile
/usr/adm/sulog log file
RELATED INFORMATION
env (1), login (1), sh (1), passwd (4), environ (5).
Printed 6/10/85 SU-3