su

Name

su -- change user ID

Synopsis

su [options] [-] [username [ARGS]]

Description

The su command shall start a shell running with the real and effective user and group IDs of the user username. If username is not specified, su shall default to an unspecified user with all appropriate privileges. If the -s or --shell is not specified, the shell to be invoked shall be that specified for username in the user database (see getpwnam()), or /bin/sh if there is no shell specified in the user database.

If the - option is specified, or if the first operand is -, the environment for the shell shall be initialized as if the new shell was a login shell (see Shell Invocation).

If the invoking user does not have appropriate privileges, the su command shall prompt for a password and validate this before continuing. Invalid passwords shall produce an error message. The su command shall log in an unspecified manner all invokations, whether successful or unsuccessful.

Any operands specified after the username shall be passed to the invoked shell.

If the option - is not specified, and if the first operand is not -, the environemnt for the new shell shall be intialized from the current environment. If none of the -m, -p, or --preserve-environment options are specified, the environment may be modified in unspecified ways before invoking the shell. If any of the -m, -p, or --preserve-environment options are specified, the environment shall not be altered.

Note: Although the su command shall not alter the environment, the invoked shell may still alter it before it is ready to intepret any commands.

Standard Options

-

the invoked shell shall be a login shell.

-c command, --command=command

Invoke the shell with the option -c command.

-m, -p, --preserve-environment

The current environment shall be passed to the invoked shell. If the environment variable SHELL is set, it shall specify the shell to invoke, if it matches an entry in /etc/shells. If there is no matching entry in /etc/shells, this option shall be ignored if the - option is also specified, or if the first operand is -.

-s shell, --shell=shell

Invoke shell as the comamnd interpreter. The shell specified shall be present in /etc/shells.