su - super-user, temporarily switch to a new user ID
su [ - ] [ -f ] [ username [ arg... ] ]
SYSTEM V SYNOPSIS
su [ - ] [ username [ arg... ] ]
The System V version of this command is available with the System V
software installation option. Refer to for information on how to
install optional software.
su creates a new shell process that has the user ID for the specified
username as its real and effective user ID. su asks for the password,
just as if you were logging in as username, and, if the password is
given, changes the real and effective user IDs and group IDs and group
set to those of username and invokes the shell specified in the pass-
word file for that username, without changing the current directory.
The user environment is thus unchanged except for HOME and SHELL, which
are taken from the password file for the user being substituted (see
environ(5V)). If username is not root, USER is changed to username.
The new user ID stays in force until the shell exits.
The new shell will not be a login shell, so it will not read username's
.login or .profile files, but it will read any other configuration
files for that user (for instance, the .cshrc file for the C shell)
just as if that user had invoked a new shell.
If no username is specified, root is assumed. If the wheel group
(group 0) does not contain a null user list and has members, only they
can su to root, even with the root password. To remind the super-user
of his responsibilities, the shell substitutes `#' for '$' or '%' in
its usual prompt (except if you will be running sh(1) and PS1 is set -
in this case, the prompt will not be modified). If args are given,
they are passed to username's shell.
Any additional arguments given on the command line are passed to the
program invoked as the shell. When using programs like sh(1) and
csh(1), an arg of the form -c string executes string via the shell.
- Perform a complete login. Remove all variables from the
environment except for TERM, set USER to username, set
HOME and SHELL as specified above, set PATH to
:/usr/ucb:/bin:/usr/bin, change directories to user-
name's home directory, and tell the shell to read user-
name's .login or .profile file.
-f Perform a fast su by passing the -f flag to the shell.
This flag is only meant for use with the C shell; it
will prevent the C shell from reading username's .cshrc
file. If it is used with the Bourne shell, it will dis-
able filename generation.
csh(1), login(1), sh(1), environ(5V)
su does not accept 8-bit user IDs. See login(1) for explanations about
why 8-bit login names are not acceptable.
su fails when run from within a subdirectory of a directory that user-
name either cannot search, or cannot read (that is, username does not
have both read and execute permission).
su fails to reset the user ID to root when the current working direc-
tory is in an NFS-mounted file system, and does not have its search
permission set for "other" users.
21 September 1989 SU(1V)