May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

May 2024
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

rhel7 root user password cracking

Edit current kernel version into the grub menu bar, and finally add rd.break parameters linux6

linux16 /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet rd.break
Use ctrl + x to reboot the system to start

Remount the ‘root’ file system, and change into the / sysroot

mount -oremount,rw /sysroot
chroot /sysroot
Changing the root password

echo “RedHat” | passwd –stdin root
Create /.autorelabel file, skip selinux certification

touch /.autorelabel
grub configuration file encryption
Use grub2-mkpasswd-pbkdf2 command to add grub secret key authentication.

[root@rmohan ~]# grub2-mkpasswd-pbkdf2
Enter password:
Reenter password:
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.02A9678D83F863EFAEAAD08E9280D74B5D559577A4D3B6sad52C633053315266B5E883B626413664CAA835A7CDD2A5239ED6CB82D7AEA74127143685E9081E463C652C633053315266B5E883B626413664CAA835A7CDD2A5239ED6CB82D7AEA74127143685E9081E463C6.F49B8110AF0D29B0BE98322D5911824BC9F9DBB4204F71699519484FD288FDF92B58588A108AFE79479F1DB35EE60C144226DE3127F3CBBC68988786AAC69379
Edit /etc/grub.d/00_header the file add. Note that the user may not be present in the root system.

cat << EOF
set superusers=”root”
password_pbkdf2 rootgrub.pbkdf2.sha512.10000.02A9678D83F863EFAEAAD08E9280D74B5D559577A4D3B652C633053315266B5E883B626413664CAA835A7CDD2A5239ED6CB82D7AEA74127143685E9081E463C6.F49B8110AF0D29B0BE98322D5911824BC9F9DBB4204F71699519484FD288FDF92B58588A108AFE79479F1DB35EE60C144226DE3127F3CBBC68988786AAC69379
EOF
Update the grub configuration file to take effect

grub2-mkconfig >> /boot/grub2/grub.cfg

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>