su(1)
_________________________________________________________________
su Command
become super-user or another user
_________________________________________________________________
SYNTAX
su [ - ] [ name [ arg ... ] ]
DESCRIPTION
Su lets you become another user without logging off. The default
user name is root (i.e., superuser).
To use su, supply the appropriate password (unless it's already
root). If the password is correct, su will execute 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 (see
passwd(4)), or /bin/sh if none is specified (see sh(1)). To
restore normal user ID privileges, type an EOF (cntrl-d) 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(1), an arg of the form -c string executes string via 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(1):
If the first argument to su is a -, the environment is changed as
if you actually logged in as the specified user. You invoke the
program used as the shell with an arg0 value whose first
character is -, thus executing first the system's profile
(/etc/profile) and then the specified user's profile (.profile in
the new HOME directory). Otherwise, the environment is passed
along with the possible exception of $PATH, which is set to
/bin:/etc:/usr/bin for root.
If the optional program used as the shell is /bin/sh, the user's
.profile can check arg0 for -sh or -su to determine if it was
invoked by login(1) or su(1), respectively. If the user's
program is other than /bin/sh, then .profile is invoked with an
arg0 of -program by both login(1) and su(1).
All attempts to become another user using su are logged in the
log file /usr/adm/sulog.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
su(1)
EXAMPLES
To become user bin while retaining your previously exported
environment, execute:
su bin
To become user bin but change the environment to what would be
expected if bin had originally logged in, execute:
su - bin
To execute command with the temporary environment and permissions
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
SEE ALSO
env(1), login(1), sh(1).
passwd(4), profile(4), environ(5) in the Programmer's Reference
for the DG/UX System
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)