Ubuntu is a popular Linux system recently. Because Ubuntu does not start the root user by default, we will introduce how to enter the root user. (1) switching from a user to a root user, whether logging on to Ubuntu in graphic mode or logging on in command line mode, we will find that the default user is user, but when we need to perform some operations with root permissions (such as repairing and returning system files), we often need to use sudo authorization, we can switch to the root user.
Ubuntu is a popular Linux system recently. Because Ubuntu does not start the root user by default, we will introduce how to enter the root user.
(1) switch from user to root user
Whether logging on to Ubuntu in graphical mode or logging on in command line mode, we will find that the default user is user
However, when we need to perform operations with root permissions (such as repairing and returning system files), we often need to use sudo authorization, which is very troublesome.
In this case, we can switch to the root user and simply executeSudo suYou can.
Note: For security reasons, by default, the root user of Ubuntu does not have a fixed password. The password is randomly generated and dynamically changed.
Is changed every five minutes.Su (switch user)No, because we don't know the root password.
(2) switch from root user to user
To switch from the root user to the user, you only need to execute the following command:Su user(User is the user name for your own installation), or directly enterExit, or press Ctrl + D.
(3) set a password for the root user.
By default, the root user has no fixed password and is locked. If you want to set a password for the root user
Run the following command:Sudo passwd rootThen follow the prompts to proceed step by step
As mentioned in (1 ),Su root, Enter the root password to switch to the root user
Note: After setting the password for the root user, you can stillSudo suSwitch to the root user
Appendix: in graphic modeSystem> System Management> users and groupsYou can also set a password for the root user.
(4) Disable and enable root logon
RunSudo passwd-l rootYou can (only disable root, but the root password is still saved), and then execute su root to find that authentication fails,
Start root login again and runSudo passwd-u rootYou can.
(5) Enable Ubuntu to log on automatically
In graphic modeSystem> System Management> logon windowSelect
Automatically log on as a user.
Note: My Ubuntu is of the 10.04 server version.