Home >System Tutorial >LINUX >What is the password for the linux switch user command?
To use the su command to switch user identities in a Linux system, you need to provide the password of the target user, which is set when the user is created.
Linux switch user command and password
In Linux system, you can use su Command to switch user identity. This command requires the target user password to be executed.
The following is the syntax of the su command:
<code>su [选项] [用户]</code>
Options:
User:
Specify the target user to switch to. If not specified, switches to the root user.
Password:
When executing the su command, the system will prompt you to enter the password of the target user. This password is the password set when the target user is created.
Example:
Switch to user "john":
<code>su john</code>
Switch to root user:
<code>su</code>
Switch to user" john" and execute the "ls" command:
<code>su -c "ls" john</code>
Switch to user "john" and retain the environment variables before switching:
<code>su -m john</code>
Switch to user "john" and log in using Z shell:
<code>su -s /bin/zsh john</code>
Note:
The above is the detailed content of What is the password for the linux switch user command?. For more information, please follow other related articles on the PHP Chinese website!