Difference between revisions of "CentOS 8.x reset root password using grub and single user mode"

From Notes_Wiki
(Created page with "<yambe:breadcrumb self="reset root password using grub and single user mode">CentOS 8.x System Administration|System Administration</yambe:breadcrumb> =CentOS 8.x reset root p...")
 
m
 
Line 1: Line 1:
<yambe:breadcrumb self="reset root password using grub and single user mode">CentOS 8.x System Administration|System Administration</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 8.x]] > [[CentOS 8.x System Administration|System Administration]] > [[CentOS 8.x reset root password using grub and single user mode]]
=CentOS 8.x reset root password using grub and single user mode=


To reset root password in CentOS 8.x machine use:
To reset root password in CentOS 8.x machine use:
Line 29: Line 28:




<yambe:breadcrumb self="reset root password using grub and single user mode">CentOS 8.x System Administration|System Administration</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 8.x]] > [[CentOS 8.x System Administration|System Administration]] > [[CentOS 8.x reset root password using grub and single user mode]]

Latest revision as of 03:28, 19 April 2022

Home > CentOS > CentOS 8.x > System Administration > CentOS 8.x reset root password using grub and single user mode

To reset root password in CentOS 8.x machine use:

  1. Press 'up' or 'down' arrow key to stop booting at grub. Note that right arrow, space bar, enter etc. will cause grub to boot using selected menu item.
  2. Edit the line starting with linux and replace 'ro' with 'rw init=/sysroot/bin/sh'
  3. Boot into single mode using 'Ctrl + X ' shortcut
  4. Use following command to mount root filesystem at /
    chroot /sysroot/
  5. Change the password using:
    passwd root
  6. If SELinux is enabled then use
    touch /.autorelabel
  7. Restart the machine
    shutdown -r now


Refer:


Home > CentOS > CentOS 8.x > System Administration > CentOS 8.x reset root password using grub and single user mode