October 5th, 2004, 06:18 AM
Forgot your root password?
Say you set up a box and installed your favorite linux distro on it. Say that you wanted to try a spiffy new password that you think you will remember forever. Say you don't see the box for a month and that password has slowly seeped out of your brain. What do you do?
Find you a bootable linux OS (knoppix comes to mind), burn it, and boot it.
When you have finished booting, mount your local drive:
mount /dev/hda1 /mnt/test/
Change the root filesystem to the local hard drive
chroot /mnt/test /bin/bash
Change yourself a password
Shutdown the OS, remove the disk, and reboot.
Welcome back to your system!
You shall no longer take things at second or third hand,
nor look through the eyes of the dead...You shall listen to all
sides and filter them for your self.
October 5th, 2004, 07:57 AM
If you use lilo there's another way..
This is a repost, the origional can be found here: http://jinx.etv.cx/tut/index.php?url=liloroot.bbc
You have found your old linux box..
you just can't remember that fucking root password..
you could boot from a bootdisk and eddit the /etc/shadow but that's not the nicest way..
on most computers you can give the kernel added options in the lilo bootscreen..
you can use the init= option to set an aplication to be started after boot
adding the line init=/bin/bash rw should boot the puter and drop you into a root console on the read-write (rw) mounted root filesystem..
so remember, if your normal kernel boot image's name is linux and the passwd executable is located in /usr/bin then:
linux init=/usr/bin/passwd rw
allows you to reset your root password in the neatest way !!
playing around with init might result in a Kernel Panic !
but after a reboot the password should be changed..
Now, what do we do about that..
We don't want anyone that read this doing it on my box..
You could swich to an alternative boot loader, but let's not do that just yet..
open /etc/lilo.conf in your favorite editor.
add these lines somewhere at the top (right after prompt would be appropriate),
and ehm.. insert your own password there
save and execute lilo
lilo might warn you and well it's advice is quite clear.. Warning: /etc/lilo.conf should be readable only for root if using PASSWORD
chmod 600 /etc/lilo.conf
be sure to man lilo.conf and find out more about lilo
ASCII stupid question, get a stupid ANSI.
When in Russia, pet a PETSCII.
Get your ass over to SLAYRadio
the best station for C64 Remixes !