Linux-RedHat7/CentOS 7 forget the root password modification, redhat7centos

Source: Internet
Author: User

Linux-RedHat7/CentOS 7 forget the root password modification, redhat7centos

1. (a) when the grub boot loader boot option menu appears, click any keyboard restart and boot loader will be suspended.

(B) Press 'e' to edit the option menu.
(C) move upstream and downstream traffic to the Core Command Line of linux16

Linux/vmlinuz-3.10.0-123.el7.x86_64 root = UUID = 449d53d1-84c2-40c0-b05e-d1900591d71b ro rd. lvm. lv = vg_kvm7usb/swap crashkernel = auto

Vconsole. keymap = us crashkernel = auto vconsole. font = latarcyrheb-sun16 rd. lvm. lv = vg_kvm7usb/root rhgb quiet LANG = en_US.UTF-8 rd. break

(D) add rd. break at the end of the core command line.
(E) Press Ctrl + x to start the instance again.
● The interactive command environment after startup is not the system for normal boot. The system is mounted to/sysboo and read-only, and must be remounted to writable, to modify the secret, follow these steps:
(A) remount/sysroot to readable and writable.
Switch_root:/# mount-o remount, rw/sysroot
(B) run the chroot working directory to/sysroot.

Switch_root:/# chroot/sysroot
(C) Set a new root password.

Sh-4.2 # passwd root

(D) in this case, SELinux is not started, and changes to all files may cause incorrect context in the Document. To ensure SELinux context is re-set during startup

You must add the hidden file. autorelabel in the root directory.

Sh-4.2 # touch/. autorelabel

(E) Quit chroot

Sh-4.2 # exit

Switch_root :/#
(F) Exit the system and the system automatically restarts.

Switch_root:/# exit
After restart, use the modified root password to log on.

Reference

Http://dywang.csie.cyut.edu.tw/moodle23/dywang/download/pdf/rhel7.pdf

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.