How To Reset A Forgotten Root Password With Knoppix - Page 2
On this page
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
- Knoppix: http://www.knoppix.org