[NBLUG/talk] Lost Passwords

Andrew argonaut at softhome.net
Wed Mar 23 01:10:19 PST 2005


Ian Sutherland wrote on Tue, 22 Mar 2005 22:30:14 -0800:

> Whatever I did, none of the passwords, root, users, work at
> login of Debian sarge.
[snip]
> I tried accessing /etc/passwd from Knoppix to install a new
> user but it's read only.
[snip]

Remember, Knoppix bends over backwards to make sure you don't
accidentally screw up the data on your hard disk. This includes
mounting hard disk partitions read-only unless you specifically
choose to mount them read-write. So, boot up Knoppix, right-click
the icon representing your root partition and select "Mount".
Then right-click the icon again and select Actions -> Change
read/write mode. Now you're free to write changes to the
partition.

Next, fire up a terminal and use your favorite text editor to
edit the /etc/shadow file on your hard disk (that's where your
encrypted passwords should be). Keep in mind, though, that this
file is readable/writeable only to root, so you must use "sudo"
in Knoppix to temporarily be root. First, make a copy of the file
with this command (change the mount point as necessary):

sudo cp /mnt/hda1/etc/shadow /mnt/hda1/etc/shadow.bak

Now, you can edit the shadow file with your favorite editor, like
this (if vi is your thing):

sudo vi /mnt/hda1/etc/shadow

Go to the line beginning with "root" and delete the entire mess
of characters in the second colon-delimited field. Now the first
and second colons should be immediately adjacent to each other,
with no spaces between them at all. Write the file back to disk,
shut down Knoppix, and start up your Debian system. You should
now be able to log in as root without a password. Obviously, a
passwordless root is a Very Bad Thing, so your system should be
disconnected from the network for this entire procedure. Set a
new root password now. Then, still as root, set new passwords for
your other users.

And finally, stay away from olvwm. It may be a decent window
manager, but obviously something ain't right with that package.
Good luck!

A.



More information about the talk mailing list