RHCSA Rapid Track
In this exercise, you will reset the root password on a system.
Outcomes
You should be able to reset a lost root password.
Log in as the student user on workstation using student as the password.
On workstation, run the lab boot-resetting start command.
This command runs a start script that determines if the servera machine is reachable on the network.
It also resets the root password to a random string and sets a higher timeout for the GRUB2 menu.
[student@workstation ~]$lab boot-resetting start
Reboot
servera, and interrupt the countdown in the boot-loader menu.Locate the icon for the
serveraconsole, as appropriate for your classroom environment. Open the console.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, except Enter.
Edit the default boot-loader entry, in memory, to abort the boot process just after the kernel mounts all the file systems, but before it hands over control to
systemd.Use the cursor keys to highlight the default boot-loader entry.
Press e to edit the current entry.
Use the cursor keys to navigate to the line that starts with
linux.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 configuration.
At the
switch_rootprompt, remount the/sysrootfile system read/write, then use chroot to go into a chroot jail at/sysroot.switch_root:/#mount -o remount,rw /sysrootswitch_root:/#chroot /sysrootChange the
rootpassword back toredhat.sh-4.4#passwd rootChanging password for user root. New password:redhatBAD PASSWORD: The password is shorter than 8 characters Retype new password:redhatpasswd: all authentication tokens updated successfully.Configure the system to automatically perform a full SELinux relabel after boot. This is necessary because the passwd command recreates the
/etc/shadowfile without an SELinux context.sh-4.4#touch /.autorelabelType exit twice to continue booting your system as usual. The system runs an SELinux relabel, then reboots again by itself. When the system is up, verify your work by logging in as
rootat the console. Useredhatas the password.