Any live Linux cd from standard Linux distros such a ubuntu , knoppix etc can be used.
Boot the system with the live CD
Open a terminal and use dmesg command to find out the hard disk.
The ide hard disk are generally named as hda, hdb etc. SATA and SCSI disks are named sda sdb etc. My SATA hard disk is detected as below.
[ 3.206832] sda: sda1 sda2 sda3 sda4 <>
[ 3.266679] sd 0:0:0:0: [sda] Attached SCSI disk
The above hard disk has several partitions. sda2 , sda2 ,sda3 are primary partitions , sda4 is divided into several logical partitions. You have to find out where your root partitions is mounted.
You can use cfdisk to find out the partitions.
$sudo cfdisk /dev/sda
I am getting the following screen .
You can examine the screen and find out the Linux partitions . If you have multiple installations , this can be tricky. You can quit from cfdisk and return to terminal. Now, try to mount the desired partition into some directory. ( Assuming that you Linux partition is /dev/sda2 , the following commands are described.)
Aquire root powers on the terminal with ( in the case of ubuntu live cd which I use)
$sudo su
# mount /dev/sda2 /mnt/Now, chroot to /mnt
# chroot /mnt
Change the password# passwd
Next unmount the partition and enjoy .
# umount /mnt
5 comments:
Nice post, but you don't need a live cd to recover lost root password. In ubuntu all you need to do is, go to the grub menu and select the option which says something like 'recovery partition'(not exactly, but something like it). Afterwards a menu will come up where you have the option to drop into a root shell. That's it, now simply type 'passwd username' and change the password. Hope it helps :-)
What if you don't know the username? How do you find that? long story short, an admin left and called wanting some files on the server. He thought the user was admin but it isn't. Root is disabled. Now what? How do I get in? Ubuntu server 10.
What if you don't know the root password or any other user on the system? On top of that root has been disabled. This is an Ubuntu 10 server. Any thoughts for a fairly intermediate user?
also, these posts are nice but if you are fairly new to linux like i am and run into ERRORS when trying commands - like most times when entering commands...they never go smooth like the posters think! EVER! or at least rarely...
The shadow file will have all the users listed in it. /etc/shadow
Post a Comment