Home>Article>Operation and Maintenance> How to switch to root user in linux system

How to switch to root user in linux system

王林
王林 Original
2020-06-02 12:01:36 49176browse

How to switch to root user in linux system

There are many ways to switch to the root user in the Linux system, as follows:

1. sudo command

$ sudo

After executing the command, Enter the password of the current administrator user to briefly gain superuser privileges.

2. sudo -i command

$ sudo -i

Use this command to directly enter the password of the current administrator user to enter the root user.

3. If we want to always use root privileges, we can use the su command.

First execute the following command to reset the password of the root user.

$ sudo passwd root

Then you can freely switch to the root user.

Execute the command:

$ su

Then enter the password of the root user to switch to the root user.

If we want to return to normal user rights, just execute the command "su xxx" or "exit" directly.

Recommended tutorial:linux tutorial

The above is the detailed content of How to switch to root user in linux system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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