In Linux, use the su command to switch user names: 1. Enter su, 2. Enter the target user name, 3. Enter the target user password.
How to use commands to switch user names in Linux
In Linux systems, switching user names is a common operate. You can do this using the following steps:
Step 1: Type thesucommand
Type the following command to startsuCommand:
su
Step 2: Enter the username you want to switch to
You will be prompted to enter the username you want to switch to. Enter your username and press Enter:
user_name
Step 3: Enter your password
You will be prompted to enter the password for the user you want to switch to. Enter the password and press Enter:
password
If you enter the correct password, you will successfully switch to the specified user's shell. You can see the username of the switched user in the command prompt.
For example, if you switch fromuserAtouserB, your command prompt will change from:
[userA@hostname]$
to:
[userB@hostname]$
The above is the detailed content of How to use command to switch username in linux. For more information, please follow other related articles on the PHP Chinese website!