I lost my CentOS 7root password, so I tried booting the OS in single user mode but it prompts me for the root password when the system boots,
Any ideas?
Regards
Bonnie
5 thoughts on - Reset CentOS-7 Lost Root Password
Should be do-able without the live CD:
At the GRUB menu, edit the kernel line, add init=/bin/sh to the end of it and boot from that.
You’ll end up at the shell prompt, where you can change the password with the normal passwd command.
You may need to:
– mount -o remount,rw on your root partition before you’ll be allowed to write any changes
– touch /.autorelabel to make sure SELinux doesn’t refuse the changes after you reboot (if you’re enforcing SELinux, obviously)
You should then be fine to reboot and log in using the fresh password.
Not as elegant as just sticking a 1 on the end of the kernel line to get to single-user mode, but whatever, it works.
Paul
Or `/usr/sbin/load_policy -i` before remounting rw
Didn’t realise that tool existed. That’s a useful one, thanks.
Also just realised the previous top-post. Sorry list.
5 thoughts on - Reset CentOS-7 Lost Root Password
Should be do-able without the live CD:
At the GRUB menu, edit the kernel line, add init=/bin/sh to the end of it and boot from that.
You’ll end up at the shell prompt, where you can change the password with the normal passwd command.
You may need to:
– mount -o remount,rw on your root partition before you’ll be allowed to write any changes
– touch /.autorelabel to make sure SELinux doesn’t refuse the changes after you reboot (if you’re enforcing SELinux, obviously)
You should then be fine to reboot and log in using the fresh password.
Not as elegant as just sticking a 1 on the end of the kernel line to get to single-user mode, but whatever, it works.
Paul
Or `/usr/sbin/load_policy -i` before remounting rw
Didn’t realise that tool existed. That’s a useful one, thanks.
Also just realised the previous top-post. Sorry list.
Paul
Thanks guys solved the issue using the LiveCD,
Regards
Bonnie
—–Original Message—
http://fedoraproject.org/wiki/How_to_reset_a_root_password#Using_GRUB2
I see the OP has solved their issue already.