Home >System Tutorial >LINUX >What is the command to switch users in Linux?
To switch users in Linux, you can use the su command. This command supports the following options: -: Specify the identity of the user to run a single command. -c: Run the specified command as the specified user. -l: Run as the login shell of the specified user. -s: Specifies the shell to use.
Linux user switching command: su
The command used to switch users in Linux is su.
su command syntax:
<code>su [选项] [用户]</code>
Options:
-
: with Run a single command as a specified user. -c
: Run the specified command as the specified user. -l
: Runs as the login shell of the specified user. -s
: Specifies the shell to use. Usage:
To switch to another user, you can enter the following command:
<code>su 用户名</code>
You will be prompted to enter the password of the target user . After entering the password, you will switch to that user's shell.
Example:
To switch to a user named "john", you can enter the following command:
<code>su john</code>
You will be prompted to enter "john" " password. After entering the password, you will switch to "john"'s shell.
Tip:
The above is the detailed content of What is the command to switch users in Linux?. For more information, please follow other related articles on the PHP Chinese website!