HP-UX Reference (11i v1 00/12) - 1 User Commands N-Z (vol 2)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/neqn.1
________________________________________________________________
___ ___
s
su(1) su(1)
NAME
su - switch user
SYNOPSIS
su [-][username [arguments]]
DESCRIPTION
The su (set user or superuser) command allows one user to become another user without logging out.
username is the name of a user defined in the /etc/passwd file (see passwd(4)). The default name is
root (that is, superuser).
To use su, the appropriate password must be supplied unless the current user is superuser. If a valid pass-
word is entered, su executes a new shell with the real and effective user ID, real and effective group ID,
and group access list set to that of the specified user. The new shell is the one specified in the shell field of
the new user’s entry in the password file, /etc/passwd .
The arguments are passed along to the new shell for execution, permitting the user to run shell procedures
with the new user’s privileges.
When exiting from the new shell, the previous username and environment are restored.
If the
- option is specified, the new shell starts up as if the new user had initiated a new login session.
Exceptions are as follows:
The HOME variable is reset to the new user’s home directory.
If the new user name is root, the path and prompt variablesare reset:
PATH=/usr/bin:/usr/sbin:/sbin
PS1=#
For other user names:
PATH=/usr/bin
PS1=$
The TERM variable is retained.
The rest of the environment is deleted and reset to the login state. However, the login files are nor-
mally executed anyway, usually restoring the expected value of PATH and other variables.
If the - option is omitted, the new shell starts as if a subshellwas invoked. Exceptions are as follows:
If the new user name is root, the path and prompt variablesare reset:
PATH=/usr/bin:/usr/sbin:/sbin
PS1=#
The previously defined HOME and ENV environment variables are removed.
The rest of the environment is retained.
If the shell specified in /etc/passwd is /usr/bin/sh , su sets the value of parameter 0 in the new
shell (referenced as $0)tosu. If the - option of the su command is specified,
su sets parameter 0 to
-su.
If the shell specified in /etc/passwd is not /usr/bin/sh , su sets the value of parameter
0 in the
new shell to shellname. If the
- option of the su command is specified,
su sets parameter 0 to
-shellname. For example, if the Korn shell is invoked, the value of shellname will be either
ksh or -ksh.
By comparison, the
login command always sets parameter 0 to -shellname.
All attempts to become another user are logged in /var/adm/sulog, including failures. Successful
attempts are flagged with +; failures, with -. They are also logged with syslog() (see syslog(3C)).
HP-UX Smart Card Login
If the user account is configured to use a Smart Card, the user password is stored in the card. This pass-
word has characteristics identical to a normal password stored on the system.
In order to su using a Smart Card account, the Smart Card from the destination user account must be
inserted into the Smart Card reader. The user is prompted for a PIN instead of a password during authen-
tication.
HP-UX Release 11i: December 2000 1 Section 1903
___
___