Linux is a multi-user, multi-tasking, multi-threading and multi-CPU operating system based on POSIX and Unix. It supports multiple users to log in and operate at the same time, so in Linux Switching users is one of the very common operations. So how to switch users in Linux system? The following is an introduction to common commands.
1.su command
su command is a common command used to switch users. Through the su command, you can switch to other user accounts in the terminal and perform corresponding operations. When using the su command, you need to provide the credentials of the target user account, usually the password. For example, to switch to the root user, enter the su command in the terminal and enter the root user's password. The use of the su command helps to perform tasks as different users in the system and improve operation permissions.
”’shell
su – root
”’
This command will prompt you to enter the password of the root user. After entering the correct password, you can execute the command under the root user.
2. sudo command
The sudo command allows ordinary users to run specific commands with superuser privileges and is usually used for operations that require administrator privileges. When using sudo in the terminal, the user is asked to enter their own password to confirm authentication. For example, when executing commands that require root privileges, you can use the sudo command to elevate privileges.
”’shell
sudo command
”’
This command will prompt you to enter the password of the current user. After entering the correct password, you can execute the command with the permissions of the root user.
3. su -l command
The -l option of the su command can switch to the specified user account and switch the environment variables to the environment variables of the specified user. Enter the following command in the terminal to switch users:
”’shell
su -l username
”’
Where username is the user account to be switched to. This command will prompt for the password of the specified user. After entering the correct password, you can execute the command under that user.
4. Login command
The login command is used to switch users and log in to the system again. When using the login command, you need to enter the user account and password you want to switch to. For example, enter the following command in the terminal to switch users:
”’shell
login
”’
This command will prompt you to enter the user account and password to switch to. After entering the correct account and password, the system will log in as the user again.
The above is the detailed content of How to switch users in Linux system?. For more information, please follow other related articles on the PHP Chinese website!

Unable to type password at login screen Windows 7/8/10/11? Why does this issue occur? What should you do when you cannot type password on the login screen? This post from php.cn provides you with several feasible solutions to this matter.
![[Solved] macOS Cannot Verify That This App Is Free from Malware - MiniTool](https://img.php.cn/upload/article/001/242/473/174542694917149.png?x-oss-process=image/resize,p_40)
Have you encountered the “macOS cannot verify that this app is free from malware” notification when running apps on Mac? This post from php.cn shows you how to solve this problem.

Error code 2000-0415 is a small issue that is connected to some specific cables of your computer. It is pretty common in Dell devices. If you receive this error at the moment, the tips and tricks of this post on php.cn Website will be helpful to you.

Have you ever encountered a situation where the computer freezes but mouse still moves? Many people are troubled by this problem and they choose to forcefully shut down their computers. In fact, there are other methods that can help you solve this pr

Some users still use the Windows 7 edition and they want to download Windows 7 Ultimate SP1. However, they don’t know where to find the ISO file. Don’t worry! This post from php.cn tells you how to free download and install Windows 7 Ultimate SP1.

What will you do if there is a conflict between your favourite TV shows and work appointments? Spectrum DVR can help you out! It allows you to record your favourite games or TV shows and watch them whenever you want. If you are plagued by Spectrum DV

Do you have any idea how to show or remove checkboxes in File Explorer? If not, you’ve come to the right place. This paper on php.cn shows you a couple of feasible ways to enable selection checkboxes in File Explorer.

VSS error 0x800423F4 happens when creating a system image on Windows 11/10. If you are plagued by this annoying issue, follow the fixes collected by php.cn to root out it. Besides, professional Windows backup software like php.cn ShadowMaker is intro


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment