Switching between the root and user users in Ubuntu
Ubuntu is a very popular Linux system recently, because Ubuntu does not start the root user by default, and now describes how to enter the root method.
(1) switch from user to root
Whether you're logging in to Ubuntu in graphical mode or in command-line mode, we'll find the default user
However, when we need to perform some root-permission operations (such as repairing system files), it is often necessary to use sudo authorization, which is very troublesome
At this point we can switch to the root user and simply execute sudo su
Note: For security reasons, the default Ubuntu root user does not have a fixed password, its password is randomly generated and dynamically changed
, seems to change every 5 minutes, so using SU (switch user) is not possible, because we do not know the root password
(2) User user is cut back from root
To cut back from the root user, simply execute the command: SU User (User is the username of your own installation), or enter exit directly, or you can ctrl+d the key combination
(3) Set a password for root
The default root user is not a fixed password, and is locked, if you want to set a password for root
Simply execute the command: sudo passwd root and then follow the prompts step-by-step to
This can be referred to in (1) as the SU root, enter the root password to switch to the root user
Note: After setting the password for root, sudo su can still switch to the root user
Attached: Users and groups in the graphical mode system---system management can also set a password for root
(4) Disabling and enabling root login
Execute sudo passwd-l root (just disable root, but the root password is still saved), then perform SU root discovery authentication failed,
To start root login again, execute sudo passwd-u root
(5) Allow Ubuntu to log in automatically
Graphics mode, System Management, Login window authorization to unlock after the selection
Automatically login as user.
How to switch to root in the newly installed Ubuntu method