CentOS 7 To modify the user login password

Source: Internet
Author: User
Rhel7/centos7 used GRUB2 instead of the previous grub boot, initialized by Init and replaced with SYSTEMD initialization. The resulting root password is also different from the previous operation when it is retrieved. Specifically as follows:
1. Start the system, and when the GRUB2 start screen, press e key to enter edit mode

2. Add the following at the end of the parameter line at the kernel boot line

 
 
 
  1. Init=/bin/sh

3. Press Ctrl+x to boot to shell boot into single-user mode

4. Mount the root partition as read-write mode

Mount-o REMOUNT,RW/
At this point you can modify the password by passwd, but here are two points to note:

A, the host if have SELinux, need to create the Autorelabel file in the root partition, otherwise cannot start the system normally, the operation order is as follows:

Touch/.autorelabel
b, after the modification, as in the previous version of the implementation of the reboot command has been invalid, you need to enter the full path command, as follows

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.