[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Google
  Web www.spinics.net

SUMMARY: root passwd recovery



Hello:
The problem was I had to "recover" the root passwd of a Mandrake Linux box.
There were several suggestions along the lines of "try booting into single 
user mode from the Lilo prompt.

The 'winning' solution came from Josh Glover, and I have copied it into this 
email un-edited.

Thanks to Josh and everybody else,

Qv6


=========================================
You cannot "recover" the root password, but you can easily set it to
> whatever you want. Here's how:
>
> 1. Login to the box as a normal user, and run the 'mount' command to
>    determine which is your root partition:
>
>    $ mount
>    /dev/hdb3 on / type ext3 (rw)
>    proc on /proc type proc (rw)
>    [...]
>    /dev/hdb6 on /usr type ext3 (rw)
>    /dev/hdb7 on /var type ext3 (rw)
>
>    So, in this case, /dev/hdb3 is your root parition, and /dev/hdb6 is your
>    /usr partition. Write both of these down.
>
> 2. Grab a Linux distribution CD that contains a rescue disk. I know that
> Red Hat 7.1 and greater will work, and all the Gentoo Linux versions also.
> I would imagine that Mandrake sports a resue disk as well.
>
> 3. Boot up your system off that CD and select rescue mode. In Gentoo, you
>    don't have to select it--a Gentoo installation is a kind of rescue in
>    itself.
>
> 4. Once you are at a prompt, create a mount point for your root filesystem:
>
>    $ mkdir /sys_root
>
> 5. Now, mount your root filesystem:
>
>    $ mount -t reiserfs -o rw /dev/ROOT /sys_root
>
>    Where ROOT is the device name that you noted in step 1 (in my example,
>    ROOT would be hdb3).
>
> 6. Mount your /usr filesystem:
>
>    $ mount -t reiserfs -o rw /dev/USR /sys_root/usr
>
>    Where USR is the device name that you noted in step 1 (in my example,
>    USR  would be hdb6)
>
> 7. Bind /proc to your /sys_root/proc mountpoint:
>
>    $ mount -o bind /proc /sys_root/proc
>
> 8. Create a chroot jail:
>
>    $ cd /sys_root
>    $ chroot /sys_root /bin/bash
>
> 9. Set your root password:
>
>    $ passwd
>    New UNIX password:
>    Retype new UNIX password:
>
> 10. Escape from the jail, unmount your filesystems, and reboot:
>
>    $ exit
>    $ umount /sys_root/usr
>    $ umount /sys_root/usr
>    $ umount /sys_root
>    $ reboot
>
>
> There, you've done it.
>
>
> HTH,
> Josh
_______________________________________________
LinuxManagers mailing list - http://www.linuxmanagers.org
submissions: LinuxManagers@linuxmanagers.org
subscribe/unsubscribe: http://www.linuxmanagers.org/mailman/listinfo/linuxmanagers

[Home]     [Kernel List]     [Linux SCSI]     [Video 4 Linux]     [Linux Admin]     [Yosemite News]     [Motherboards]

Powered by Linux