[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

forgot passwd, cannot login, [rd]init=/bin/sh don't work

From: jidanni
Subject: forgot passwd, cannot login, [rd]init=/bin/sh don't work
Date: Thu, 09 Oct 2008 05:40:32 +0800

Gentlemen, last time I forgot my password and couldn't log into my
machine here on my far away rural mountaintop, I ended up digging up an
old Debian "potato" CDROM and installing it into some free space on my
disk, from which I could edit /etc/passwd and zero out the password.
These days that would no longer necessarily work, see man mkfs.ext3 -I.
> Presuming Linux, you can add "init=/bin/sh" to the kernel command line.  This
> will give you a shell without asking for a password.  From this shell you can
> edit your password file.
Didn't work.
>Initrd scripts might change everything.
OK, I then tried linux-doc-2.6.26/Documentation/kernel-parameters.txt.gz:
  rdinit=  [KNL]
   Format: <full_path>
   Run specified binary instead of /init from the ramdisk,
   used for early userspace startup. See initrd.

So in grub2 I chose "e" to edit, and changed the lines to
 linux  /boot/vmlinuz-2.6.26-1-686 root=UUID=... rdinit=/bin/sh
 initrd /boot/initrd.img-2.6.26-1-686
hit ESC then RET, and alas it was like I didn't type anything at
all but just hit RET, booting proceeded as usual, and /proc/cmdline
shows that my changes to that command line were thrown away.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]