Additional arguments may be provided after the username, in which case they are supplied to the user's
login shell. In particular, an argument of -c will cause the next argument to be treated as a command by
most command interpreters. The command will be executed by the shell specified in /etc/passwd for the
target user.
|
-, -l, --login
Provide an environment similar to what the user would expect had the user logged in directly.
When - is used, it must be specified as the last su option. The other forms (-l and --login) do not
have this restriction.
|
-s, --shell SHELL
The shell that will be invoked.
The invoked shell is chosen from (highest priority first):
The shell specified with --shell.
If --preserve-environment is used, the shell specified by the $SHELL environment variable.
The shell indicated in the /etc/passwd entry for the target user.
/bin/sh if a shell could not be found by any above method.
If the target user has a restricted shell (i.e. the shell field of this user's entry in /etc/passwd
is not listed in /etc/shell), then the --shell option or the $SHELL environment variable won't be
taken into account, unless su is called by root.
|
-m, -p, --preserve-environment
Preserve the current environment, except for:
$PATH
reset according to the /etc/login.defs options ENV_PATH or ENV_SUPATH (see below);
$IFS
reset to “<space><tab><newline>”, if it was set.
If the target user has a restricted shell, this option has no effect (unless su is called by root).
Note that the default behavior for the environment is the following:
The $HOME, $SHELL, $USER, $LOGNAME, $PATH, and $IFS environment variables are reset.
If --login is not used, the environment is copied, except for the variables above.
If --login is used, the $TERM, $COLORTERM, $DISPLAY, and $XAUTHORITY environment variables are
copied if they were set.
Other environments might be set by PAM modules.
|