Restart the system, enter the grub menu, add Rinit =/bin/bash carriage return at the end of the kernel line, press B to start entering the shell, switch to the /etc directory to edit the passwd file, save and restart.
What if Linux can't log in to the system with root account?
You mean, the root permission is disabled, and you are not allowed to log in directly outside the console with root. You can use the general administrator to log in, and you can execute the administrator's instructions after upgrading your permissions through sudo. If the root password is lost, you can enter single-user mode and change the password through root again.
How to set root permissions of linux?
When a Linux system needs a CD-ROM to the root directory on the console, if the root password is not set, it cannot be accessed, and you will be prompted that the permissions are insufficient. The following is a detailed description of how to turn on root privileges.
1. Open the Linux system console. When prompted that the permissions are insufficient, enter: sudopasswdroot and press Enter.
As shown below.
2. You will be prompted to enter your password. The password you need at this time is the login password of Linux system. There is no prompt when entering, just enter the key directly.
3. Please enter a new UNIX password. Now, enter the root password you want to set. The entered number will not be displayed on the screen. Enter.
Please re-enter the new UNIX password, re-enter the root password, and then press enter.
5. passwd appears: the password is updated successfully, indicating that the root password is set successfully.
6. Now, let's verify whether the root password is set successfully. Enter: Sue, enter. When the account number plus the current path # appears, it means that it has entered the root control state (it can be observed that the account name in the following figure is different from that in the above figure), and the ordinary account status is XX:~$.
Linux can't switch to root?
Linux cannot switch to ROOT for the following reasons: root password was not entered when installing Linux; Or create a new user and check Set as Administrator to set the password only for the new user. The ROOT password was not set, and the system detection failed. Solution: Run sudopasswdroot to exit and enter exit.
Why can't linux directly use root?
Root is the super administrator of Linux, and can do anything under the system, including deleting himself.
There is a famous saying in linux, using great power and creativity means that the greater the ability, the greater the responsibility.
Linux system trusts users unconditionally, and it assumes that users know what they are doing. Therefore, when running rm, linux generally does not need secondary confirmation, and generally does not have the function of recycling bin. The master asked me to delete the file, and the system must strictly follow the order. If you use the root account, you can manipulate all files.
Therefore, it is generally necessary to avoid using the root account directly. For example, ssh is not allowed to log in with the root account by default, and many tools will also check whether it is the root account at present when they are running, and if it is, they will voluntarily quit to prevent irreparable tragedies.
On the other hand, under linux, most functions can be completed with ordinary accounts, and root accounts are not needed at all. Then the question is coming, which functions need root account? For example, the hard disk is partitioned and formatted, the network card IP is set, the network routing configuration is updated, the system account is managed, and system-level software is installed. This operation needs to modify the files on the system partition, so it needs root permission. But this kind of operation frequency is also very low, so there is no need to take such a big risk for these things.
Therefore, it is a very safe habit to use an ordinary account every day and only use sudo to do some privileged operations when necessary.