Home >Operation and Maintenance >Linux Operation and Maintenance >How to switch to root user in linux system
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.
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!