How To Reset A Forgotten Root Password With Knoppix - Page 2

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Mon, 2008-03-10 18:39. ::

To see if /dev/sda1 is already mounted, run

mount

As you see from the mount output, it's not mounted, but (as you can find out by running

ls -l /mnt

and

ls -l /media/sda1

) Knoppix has already prepared the directory /media/sda1 into which we can mount /dev/sda1. We do this now by running:

mount /dev/sda1 /media/sda1

(You might have to adjust this command to your system, e.g. if you have to mount multiple partitions, or if your partitions have different names.)

Type

mount

again, and you should now find /dev/sda1 in the mount output, mounted on /media/sda1:

Run

ls -l /media/sda1

and you should see the files and directories from your root partition.

Now comes the crucial part: we jail ourselves into the /media/sda1 directory so that we cannot see anymore what's outside; we are pretending to be on the regular Linux system instead of on the Live-CD system; this is called chrooting, so the command is:

chroot /media/sda1/

So now that it feels as if we were running the regular Linux system instead of the Knoppix Live-CD, we can use the normal commands from the regular system; to modify or reset a password, this is the passwd command which we use like this:

passwd root

Type in a new password and confirm it - and please try to not forget it again!

Now we can leave our chroot jail:

exit

...and reboot the system:

reboot

Remove the Knoppix CD, press ENTER, and boot into your regular Linux system:

If all goes well, you should now be able to log in with your new root password:

 

3 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.