root user password recovery / resetting on Debian/GNU based linux systems

August 5, 2010

I have had need for this more often than I would like of late, it is a nice and quick way to reset the root password if you can’t remember, or the person who had it isn’t around any more. You need access to the actual console of course, physical access or a remote KVM. I’ve used this on both Debian boxes and Ubuntu boxes recently.

  1. rebooot the machine
  2. interrupt the boot sequence at the GRUB bootloader / LILO screen (I haven’t seen LILO on Deban / Ubuntu in quite a while)
  3. edit the boot line with “kernel” information (select and press e to edit)
  4. add init=/bin/bash to the end of the line
  5. hit enter and then press ‘b’ to boot
  6. when the boot sequence has finished, type the following:

mount -o remount,rw /
passwd root
(enter the new password for the ‘root’ user)
shutdown -r now (to reboot and login as root with the new password)


Follow

Get every new post delivered to your Inbox.