Search This Blog

Tuesday, November 14, 2017

Linux: Change your lost root password

Careful, this doesn't work on Centos 7

On startup, go to rescue mode. e to edit the line.

Add int=/bin/bash in the linux/kernel line (depending if you're using grub or grub2). Start it.
When on the command line, mount your file system and change your password:
# mount -o rw, remount /
# passwd
# touch / .autorelabel
# /sbin/reboot -f


Now, you have a new root password ;)

No comments:

Post a Comment