[CentOS] reset CentOS-7 lost root password

Paul Jones paul.jones at atass-sports.co.uk
Tue Aug 5 11:21:35 UTC 2014


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

--



On 05/08/14 11:53, Bonnie B Mtengwa wrote:
> Hie
>
>  
>
> I lost my CentOS 7 root 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
>
>  
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>




More information about the CentOS mailing list