Solution after CentOS forgets the root password

Source: Internet
Author: User

Solution after CentOS forgets the root password

When CentOS forgets the root password, we can reset the root password locally by entering the single-user mode as follows:

After the instance is started, the grub Startup menu is automatically displayed,

Method 1: Press "a" to enter the single-user mode.

This is the quickest way to enter the single-user mode. Use the "a" operation button in the GRUB Startup menu to edit the kernel Parameter, enter a space at the end of the line, enter single or 1, and press Enter.

Method 2: Press "e" to enter the single-user mode.

Use the "e" operation button in the GRUB Startup menu to go to The CentOS Startup menu interface, move the cursor to a line of "kernel" configuration items, and then press "e" to edit the "kernel" menu items, enter a space at the end of the line, enter single, and press enter to return to the Start menu selection page. Then, press "B" based on the screen prompts to start the system with the menu options you just edited.

When you enter the single-user mode, the system does not require password verification and directly obtains the root permission.

There is a key piece of information during the startup process:

Remountingroot filesystem in read-write mode: [OK]

This means that the root directory of the system has the read and modify permissions, so that we can use commands to perform some operations, such as resetting the root password, managing partitions and backing up data.

The following describes how to reset the root password:

Enter the passwd command and press Enter. At this time, the system will prompt you to enter a new password. Enter the new password and press Enter. Then you need to enter the new password again. Then press enter to change the password.

Then enter the reboot command to restart the system. After the system starts up, you can log on with the password you just modified.

Getting started with Linux: How to reset the root password of CentOS 7

Reset root Password in CentOS (Linux)

CentOS root Password forgot Solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.