Home > System Tutorial > LINUX > body text

How to use command to switch user login in Linux

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

In Linux, use the "su - [username]" command to switch users. 1. Open a terminal and type "su - [username]" (replace with the target username). 2. Enter the target user password and press Enter. 3. Complete the switch. Note: Use "su -" to switch to any user, including root, but requires entering the target user's password, not the current user's password. Use caution when using root privileges.

How to use command to switch user login in Linux

Switch Linux user login command

In a Linux system, you can use the command line to easily switch between different users. switch between.

Command:

<code>su - [用户名]</code>
Copy after login
Copy after login

Steps:

  1. Open a terminal window.
  2. Enter the following command:

    <code>su - [用户名]</code>
    Copy after login
    Copy after login

    where [username] is the user you want to switch to.

  3. Enter the password of the target user.
  4. Press the Enter key.

For example:

To switch from the current user to a user named "bob", execute the following command:

<code>su - bob</code>
Copy after login

Note:

  • Use the "su -" command to switch to any user, including the root user.
  • When using the "su -" command, you need to enter the password of the target user, not the password of the current user.
  • Please exercise caution when switching to the root user, as the root user has permission to make significant changes to the system.

The above is the detailed content of How to use command to switch user login 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