root password

Holt Sorenson
Thu, 7 Oct 2004 23:01:20 +0000

On Thu, Oct 07, 2004 at 03:48:32PM -0700, Stephen Schroder wrote:
 > I have forgotten my root password, since it has been months since I 
 > needed to access root.  Is there a way for me to retrieve the password 
 > or bypass it, or define a new password.  Any help would help would be 
 > appreciated.

Option 1:

- Get a debian rescue disk or a livecd like knoppix and boot into it.
- mount hard drive containing /etc and edit the shadow file

Option 2 (naughty, ugly, and might mess up your system):

- use your boot loader to boot the kernel with its normal set of
  arguments and append the string 'init=/bin/bash'.

- back up etc shadow (cp -p /etc/shadow /etc/shadow.bak)

- drop the following into /etc/shadow using cat:

- run: sync;sync;sync;reboot -f