Centos forgot the root password and reset the new password

Source: Internet
Author: User

After Centos is installed on the Virtual Machine and the password is forgotten when the machine is started today, Baidu began to search for the resetting method. After experiment operations, the method is indeed valid. The record is as follows:

(1) Restart Centos. During the startup process, press the "ESC" Key To Go To The gnu grub interface.

(Gnu grub is a multi-operating system startup program from the GNU project. GRUB is the implementation of multi-boot specifications. It allows you to have multiple operating systems in a computer at the same time and select the operating system you want to allow when the computer starts, GRUB can be used to select different kernels on the operating system partition or to pass startup parameters to these kernels)


(2) Select the system to enter and press the "E" Key (edit the command before starting ).

(3) Select the kernel "kernel" of the second operating system and press the "E" Key (edit the selected command in the boot sequence ).

(4) After "rhgb quiet", Enter "1" or "single" and press Enter to save. (Pass the startup parameter to the kernel to enter the single-user mode)

Return to the GRUB interface.

(5) Press "B" to start the system.


(6) Enter "passwd root" in the command line to change the root password and press "Enter.

(7) enter a new password, press enter to save, and then re-enter the password.

(8) If the message "all authentication tokens updated successfully" appears, the password is successfully modified.

(9) enter the "shutdown-r now" command line and restart the system. Then, you can log on to the system using the root account.

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.