Home > System Tutorial > LINUX > How to use command to switch username in linux

How to use command to switch username in linux

下次还敢
Release: 2024-04-11 17:48:15
Original
846 people have browsed it

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 command to switch username in linux

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 the su command

Type the following command to start su Command:

<code class="shell">su</code>
Copy after login

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:

<code class="shell">user_name</code>
Copy after login

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:

<code class="shell">password</code>
Copy after login

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 from userA to userB, your command prompt will change from:

<code class="shell">[userA@hostname]$</code>
Copy after login

to:

<code class="shell">[userB@hostname]$</code>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template