Recovering root password from a drive by mounting the cdrom

Manolis Kiagias sonic2000gr at gmail.com
Mon Jul 7 07:12:23 UTC 2008


Mukarram Syed wrote:
> Thanks for this response and others.
> However, my problem does not look to be so simple.
>
> I boot off the install cd and get into the fixit prompt.
>
> I dmesg | less and get the device name that I think is my hard drive /dev/ad0.
> I fdisk /dev/ad0 and get information about 3 slices.  I am think /dev/ad0 slice 3 is the root file system because slice 3 has a greatest amount of disk space and that looks like my root partition
> Then I ls -l /dev |grep ad0 and it spits out a number for /dev/ad0 like ad0s0 ad0s1 ad0s3 etc.
> I am assuming /dev/ad0s3 is slice 3 which I believe it to be my root partition.
> So I mount it:
> mount /dev/ad0s3 /mnt
> I do a df -k and find that /mnt has 0 bytes available.  To check I cd /mnt and ls and don't find any data in it.
> I check/dev/ad0s2 /dev/ad0s1 in the same way.  None of it has any data.
>
> I guess there is something else that I am missing at this point.
>
> Can anyone advise.
>
> Thanks
>
> # mukarram
>
>
>  Mukarram Syed
> muksyed at yahoo.com
>
>
>   

There must be something wrong if  don't see any partitions in any of the 
slices. You should see something like

ad0s1a, ad0s1d, ad0s1f ...

Are you able to boot the server normally, from its own disk?
Are you able to boot into single user mode, by selecting it from the 
boot menu?

If you can boot into single user mode, you can change the password 
immediately by doing something like:

mount -o rw  /
mount -a
passwd
(then exit and boot will continue)

If you are asked for a root password when going into single user mode, 
your console has been marked as 'insecure' in /etc/ttys. You will need 
to boot with the live CD, mount the root partition and change /etc/ttys, 
then reboot in single user mode and change the password. This is the 
easiest way IMHO. If you are not asked for a password when getting into 
single user mode, you don't need the live CD at all.


More information about the freebsd-questions mailing list