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
| Name | Type | Description |
|---|---|---|
| - | option | Request a login shell; equivalent to -l on util-linux. |
| -c | option | Takes one command string interpreted by the selected shell. |
| USER | operand | Target account; defaults to root when omitted. Use an explicitly authorized VM identity. |
| ARG | operand | Optional 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"