recover my root password
Posted 26 August 2004 - 09:38 AM
You basically have to gain access to your machine somehow to alter the respective files. A pretty convenient way is to use the bootable installation CDs of some Linux distro and launch some "recovery console". If you can't see some comand like that you might try the ALT+F1..Fx keystroke to maybe get a clear console.
Once you have managed to get into a shell you need to mount the partition that holds your /etc directory. To reset the root password open the file /etc/passwd and look for a line starting with ...
Delete the "x" in this line as it tells that the password is shadowed. Save the file.
Secondly open /etc/shadow and search for the entry for the user "root". This one usually looks like this ...
Delete all values (the stuff between the columns) so that you get a line like this ...
Save the file, unmount the partitions and reboot. The root-account should not have set a password now, which you should change immediately again.
hope that helps
Posted 26 August 2004 - 05:53 PM
So a little search on the net made me dig up the above procedure. Quite slick and precise. My thanx therefore goes out to the unknown author of this, from whom I shamelessly leeched the knowledge
Posted 27 August 2004 - 12:59 AM
here's another way for when you know the system is still OK but you didn't arrive
with boot/rescue disc in hand:
1. boot with parameter "init=/bin/bash"
2. the disks will be mounted read-only (ready for fsck), so remount the ones
you need to write to as read-write.
( for me, it's: "mount -o remount,rw /dev/sda2 /" )
3. change any account pwd you want: "passwd root" or "passwd user12"
4. "sync" ( for purists, it's: "sync;sync;sync" )