How to reset password of centos 7 Print

  • 0

Follow below steps to reset the password of centos 7

1.You have to edit grub , for entering in grub you need to interupt boot process then press "e" check below screenshot

2. Find kernel line starting with linux16 and end of the line after the word UTF-8 write rd.break and then press ctrl + x to entering in the console

check below screenshot

3.After you got console type below command in same order

a) #mount -o remount rw /sysroot   ( by default /sysroot in read only mode "ro" to change the root password you must need to change the permission "ro" to "rw read write.)

b) #chroot /sysroot   ( to treat /sysroot directory as /root directory and it will take you to shell prompt.)

c) #passwd root   (you can reset your password with this command.)

d) #touch /.autorelabel     ( Recommended to relabel the file system to make all the applications start with proper label. )

e) # exit   (exit from shell prompt)

f) # exit    ( exit from console )

check below screenshot for steps.

after reboot the server you can use the new password which you had reset .

 


Was this answer helpful?

« Back