EX200 Exam QuestionsBrowse all questions from this exam

EX200 Exam - Question 61


SIMULATION -

You are new System Administrator and from now you are going to handle the system and your main task is Network monitoring, Backup and Restore. But you don't know the root password. Change the root password to redhat and login in default Runlevel.

Show Answer
Correct Answer:

To change the root password on a Linux system when you do not know the current root password and need to perform tasks like Network monitoring, Backup, and Restore, you will need to boot the system in single-user mode or via other methods such as the rescue shell. Here are the steps to do that, specifically tailored for systems like RHEL7 or similar distributions using GRUB2. The steps are as follows: 1. Restart the system. 2. At the GRUB boot menu, highlight the default boot entry and press 'e' to edit the boot parameters. 3. Locate the line that starts with 'linux' or 'linux16' and append 'rd.break' to the end of this line. 4. Press Ctrl+X or F10 to boot with these parameters. 5. The system will boot into a minimal rescue shell. At this shell, enter the following commands to mount the root filesystem and change the root password: a) mount -o remount,rw /sysroot b) chroot /sysroot c) passwd (and enter the new password 'redhat') d) touch /.autorelabel (this is necessary if SELinux is enabled to ensure proper labeling) e) exit (to exit the chroot environment) f) exit (to continue normal boot). 6. The system will reboot, and you can log in with the user 'root' using the new password 'redhat'. This method ensures that the root password is changed securely and the system is returned to its default runlevel.

Discussion

5 comments
Sign in to comment
adolfoale
Jan 17, 2021

In RHEL8 - reboot the system - press "e" letter - Add "rd.break" at the end of de line thet begening with "Linux" in grub menu - ctrl + x - # mount -o remount,rw /sysroot - # chroot /sysroot - # passwd - # touch /.autorelabel - # exit - # logout

urWaifu
Sep 29, 2022

Know this by heart, because you won't be able to log in on the second server during the exam.

Ares23
May 17, 2021

the "touch /.autorelabel" is needed if SELinux is enabled/enforced !! if you don't create it password not be update

syed2020
Jul 20, 2022

In RHEL 9 - Reboot the system - Press 'e' and modify line starting with Linux with rw and add init=/bin/bash - Press F10 - Enter passwd to reset root passwrod - touch /autorelable - exec /sbin/init

STFN2019
Sep 23, 2021

You can also do the following (slight variation to adolfoale's solution): - Reboot - At GRUB2 press e for the primary (default) kernel - Replace ro with rw init=/sysroot/bin/sh - Ctrl+X - chroot /sysroot - passwd root - Enter the password - touch /.autorelabel - Exit - Reboot

ly01
Jul 12, 2024

You can also do: interrupt boot and add init=/bin/bash as kernel argument mount -o remount,rw / whoami passwd touch /.autorelabel exec /lib/systemd/systemd