[LINUX] RHCSA exam preparation --how to reset root account password

RHCSA test preparation --How to reset password This section describes how to reset the root account password using CentOS8. The meaning of each command operation is described in the following page, so this time the main purpose is to post the actual screen state.
  • ROOT Password Change and Reset --Red Hat Enterprise Linux 8

    A use case for this procedure is, for example, if you don't know the root, or administrator password. Even in such a case, you can set a new administrator password by following the procedure introduced.

    Environmental information It is an environment where "CentOS 8.2" is installed in a virtual machine configured similar to "VMware Workstation Pro" running on Windows 10.

    Procedure introduction First, the figure below is the screen immediately after restarting CentOS after installation. This screen is only displayed for a few seconds after startup.

    If you look at the second line from the bottom of the screen, there is a place that says "Press'e' to edit ...". By performing this operation, you can start the OS in a mode other than normal startup. Use this option to reset your password. image.png

    This screen is launched using the above options. Here you can edit the displayed options and boot the OS in the special modes mentioned above. image.png

    This is after editing. image.png Looking at the 6th line from the top, you can see that the character string "rd.break" has been added. After that, you can start the OS in a password reset mode by pressing "Ctrl and x" at the same time. If there is a caveat, there is also an option called "ctrl + c", so be careful not to make a mistake.

    After pressing Ctrl + x, the OS was booted into "emergency mode". image.png It will be a little more if you come here. The password setting command in Linux is the "passwd" command, but it does some work to execute it.

    The figure below shows the necessary work being performed continuously. For the meaning of each command, please refer to the URL of Red Hat Co., Ltd. mentioned above. image.png After two exit operations, the system will automatically reboot. image.png After restarting, the administrator password will be changed and it will take some time for the settings to be reflected. image.png During the process of reflecting the above reset settings, the OS was restarted again, and finally the OS started. Try to log in with the password set above.

    image.png You have successfully logged in. image.png