Centos7 forgot password change user login password

Source: Internet
Author: User
Centos7 is an open-source Linux kernel-based free system. For more information, see the steps for resetting the password of centos7. Rhel7/centos7 uses grub2 to replace the previous grub boot, which is changed from init initialization to systemd initialization. The root password is different from the previous one. Details: 1. start the system and run centos 7 on the GRUB2 boot screen. centos 7 is an open-source Linux kernel-based free system. The following describes how to reset the password in centos 7, I hope this article will help you.

Rhel7/centos7 uses grub2 to replace the previous grub boot, which is changed from init initialization to systemd initialization. The root password is different from the previous one. The details are as follows: 1. start the system and press e to enter the editing mode when GRUB2 starts the screen display.

2. add the following content at the end of the parameter line of the kernel bootstrap line

 
  1. Init =/bin/sh
 

3. press Ctrl + x to start to shell and boot to single-user mode.

 

4. mount the root partition in read/write mode

Mount-o remount, rw/You can change the password through passwd, but pay attention to two points here:

A. If selinux is enabled on the host, you must create the autorelabel file in the root partition. Otherwise, the system cannot be started normally. the operation command is as follows:

Touch/. autorelabel B. after the modification is complete, the reboot command executed as in the previous version is invalid. you need to enter the full path command, as shown below:

Exec/sbin/init or exec/sbin/reboot


Related Article

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.