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

How to switch to root user in linux system

王林
王林Original
2020-07-09 12:28:2629225browse

The method to switch to the root user under the Linux system is: 1. Execute the [sudo passwd root] command; 2. Set the password of the root user; 3. Execute the [su root] command so that you can switch freely The root user is here.

How to switch to root user in linux system

Specific command:

(Recommended tutorial: linux tutorial)

(1) Use sudo command

xzm@ubuntu:~$  sudo

Then enter the current administrator user password to obtain super user privileges. But by default, root permissions expire after 5 minutes.

(2) You can use the sudo -i command

xzm@ubuntu:~$  sudo -i

Then, enter the password of the current administrator user to enter the root user.

(3) If you want to always use root privileges, you must switch to the root user through the su command

First, set the password of the root user:

xzm@ubuntu:~$  sudo passwd root

This way you can set The root user's password.

After that, you can freely switch to the root user

xzm@ubuntu:~$  su

Enter the password of the root user.

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