RHCSA Rapid Track
In this lab, you will recover a lost root password.
| Resources: | |
|---|---|
| Machines: |
serverX
|
Outcomes
A recovered root password.
Reset your
serverXsystem.Log in and set up your
serverXsystem:[student@serverX ~]$lab rootpw setup
The lab rootpw setup script has just reset your root
password to a random string and rebooted your system. Without using
sudo, break into your own system and reset the
root password back to redhat.
Reboot your system, and interrupt the countdown in the boot loader menu.
Send a Ctrl+Alt+Del to your system using the relevant button or menu entry.
When the boot loader menu appears, press any key to interrupt the countdown.
Edit the default boot loader entry (in memory) to abort the boot process just after all file systems have been mounted, but before control is handed over to systemd, then boot.
Use the cursor keys to highlight the default boot loader entry.
Press e to edit the current entry.
Using the cursor keys, navigate to the line that starts with
linux16.Press End to move the cursor to the end of the line.
Append
rd.breakto the end of the line.Press Ctrl+x to boot using the modified config.
At the
switch_rootprompt, remount the/sysrootfile systemd read-write, then use chroot to go into a chroot jail at/sysroot.switch_root:/#mount -o remount,rw /sysrootswitch_root:/#chroot /sysroot
Change the
rootpassword back toredhat.sh-4.2#echo redhat | passwd --stdin root
Configure the system to automatically perform a full SELinux relabel after boot. This is necessary since the passwd tool re-created the
/etc/shadowfile without an SELinux context.sh-4.2#touch /.autorelabel
Type
exittwice to continue booting your system as normal. The system will run an SELinux relabel, then reboot again by itself.Verify your work by running the following command:
[student@serverX ~]$lab rootpw grade