Sunday, January 7, 2018

How to break centos 7 root password

Reboot the system and press any key to stop the auto-boot from the default kernel. Press “e” after selecting the kernel line.
grub menu rhel 7

When you are in edit mode, go to the line starting with linux16 and append rd.break to the end of this line.
add rd.break to grub menu rhel 7
Press CTLR+x after appending the rd.break to the kernel. This will reboot the system into emergency mode.
enter into emergency mode rhel 7

First we will remount the sysroot file system in read write mode and then use chroot to got into a chroot :
# mount -o remount,rw /sysroot
# chroot /sysroot
# passwd
changing the root password rhel 7

SElinux relabeling

Make sure that all unlabeled files ( including shadow file ) gets relabeled during booting. Touching the hidden file autorelabel instructs SElinux to relabel the files changed outside of its regular context, like the file /etc/shadow.

# touch /.autorelabel

To flush all cache to disk, type the command:
# sync

Then reboot
# reboot

No comments:

Post a Comment

TicTic v2.2 - Android media app for creating and sharing short videos

Facebook Twitter Tiktik – Android app for creating and sharing short videos. The customizable social video application to build ...

Popular Posts