philippe::niquille | regular niche market thoughts

recover root password

Sep 10th 2005
2 Comments
respond
trackback

One thing I had to learn the hard way:

Don’t ever reboot a linux system with a corrupted filesystem and a forgotten root password. I had to start the single user mode with the following addition to the grub boot line:
selinux=0 init=/bin/bash (some systems also allow single instead of init)
This mounts your system read only (ro) and let’s you do a manual fsck /dev/hdax to fix the errors. After that you should be able to reboot normally or mount the filesystem writable (rw) to do a passwd to change your root password.

update (24.10.05): If binaries like fsck or find can’t be found in single user mode try to set the PATH variable to the designated location (ex. export PATH=/usr/bin).
Afterwards if neither init 0, nor reboot work correctly (some not found inittab ?!) try CTRL + ALT + DEL, the good old key shortcut..

2 Comments

  1. this is a great tip, I don’t know how many times I’ve used this with customers when their sysadmin leaves the company and they don’t know any of the passwords. gotta love those runlevels.

  2. physical access is (almost) everything!

Incoming Links

Leave a Reply