commands

su — request a different user identity

Starts a shell or executes a command as another user, subject to authentication and account policy. - requests a login-style environment; -c specifies a command. Do not use su routinely to bypass least privilege. Example is help only. Example assumes a fresh account lab fixture; VM-only examples require explicit authorization.

Formal Syntax & Structure

linux syntaxlinux
su [OPTION] [USER [ARG...]]

Parameters & Attributes

NameTypeDescription
-optionRequest a login shell; equivalent to -l on util-linux.
-coptionTakes one command string interpreted by the selected shell.
USERoperandTarget account; defaults to root when omitted. Use an explicitly authorized VM identity.
ARGoperandOptional arguments passed to the selected shell.

Return Value

exit status and output

Starts a shell or executes a command as another user, subject to authentication and account policy. - requests a login-style environment; -c specifies a command. Do not use su routinely to bypass least privilege.

Working Example

Example Snippetlinux
su --help >/dev/null && printf "help available\n"
Linux Reference