root password

Adam McKenna adam@flounder.net
Thu, 7 Oct 2004 16:43:53 -0700


On Thu, Oct 07, 2004 at 11:01:20PM +0000, Holt Sorenson wrote:
> 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:
> root::::::::

I don't think this will even work.  Nonetheless, messing with the shadow file
here is not advisable or necessary.  If you booted with init=/bin/bash, you
can simply run 'passwd' once your shell prompt comes up.

If you boot with external media, it's the passwd file you want to edit, not
the shadow file as someone else said.

--Adam

-- 
Adam McKenna  <adam@debian.org>  <adam@flounder.net>