How To Reset Root Password On CentOS 7

How To Reset Root Password

To reset the root password on CentOS 7, you have to gain console access to the server. This operation can not be performed via SSH. After gaining access to the server via console, you will follow the below steps to reset the root password.

1 – In the boot grub menu select option to edit.

2- Select Option to edit (e)

3 – Go to the line of ‘linux 16’ and change ‘rhgb quiet’ with rd.break

Now press Control+x to start on single user mode

5 – Now mount the /sysroot with rw options using this command.

mount -o remount,rw /sysroot

6 – Now access the system with this command.

chroot /sysroot

7 – Reset the root password.

passwd root

8 – Update SELinux information to autorelabel the contexts

touch /.autorelabel

9 – Exit chroot with Control+d or exit


10 – Reboot the system


Root password reset completed – Enjoy!