Home > Article > Operation and Maintenance > 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!