Using chroot to Recover root Passwords
Once the LiveCD has loaded, my first order of business was to mount the system in question's filesystems. This includes mounting the root filesystem where passwords are stored, and mounting dev and proc to this filesystem.
livecd gentoo / # mount /dev/sda1 /mnt/gentoo livecd gentoo / # mount -t proc none /mnt/gentoo/proc livecd gentoo / # mount -o bind /dev /mnt/gentoo/dev
With that complete, I'm ready to chroot in to the filesystem and change the password. Keep in mind that with many distributions, you must specify what shell you wish to use. In my case, I use bash, which resides in /bin.
livecd gentoo / # chroot /mnt/gentoo /bin/bash
As I'm running Gentoo on the host system as well, I'll also need to update the environment and profile.
livecd / # env-update && source /etc/profile
Now that the chroot is complete, I'm free to change the password.
livecd / # passwd
And there it is. I've successfully changed the system's password so I'm once again able to log in to the machine. All that's left to do is exit the chroot environment and reboot the machine.
livecd / # exit livecd / # cd /mnt livecd mnt / # umount gentoo/proc/ gentoo/dev/ gentoo/ livecd mnt / # reboot
Utilizing a Linux LiveCD, it's simple to "rescue" a given Linux box that has had it's root password changed or forgotten. Of course, this also creates a security risk in business-critical machines. If an employee were to use this on a business server to gain root access, the business would be in some form of trouble (provided the IT Department doesn't know what they're doing).
Regardless of this, LiveCDs with chroot provide excellent personal tools for setting new root passwords when a password is forgotten. Some other options aside from Gentoo's are: Ubuntu, Knoppix, and openSUSE.
Jump to page:blog comments powered by Disqus
Open Source News
- Linux Mint Swap Banshee Affiliate Code, Take 100% of Profits
- Wayland Has Working Screensaver Support
- FreeBSD 9.0 May Just Be One Week Away
- Google Inc. Renews Firefox Search Deal
- Red Hat releases Red Hat Enterprise Linux 6.2
- KDE Widgets: Why They Matter
- Opera 11.60 Arrives
- Racing To Finish X.Org Multi-Touch Support
- Android 4.0 For x86 Is Now Available
- Ubuntu 12.04 LTS Alpha 1 Released
- Dungeons of Dredmor and Introversion source code added to Bundle!
- Open-source skills best hope for landing a good job
- Xen Virtualization Comes To ARM Cortex A15
- Linux Mint 12 Released
- Ubuntu On TVs
- Diablotek Legend Computer Case
- Patriot Pyro SE Solid State Drive
- EVGA Z68 FTW Motherboard
- Antec Eleven Hundred Mid Tower Gaming Case
- Raidmax Seiran Mid-Tower
- MSI R6950 Twin Frozr III 1G/OC Video Card
- Roccat Kova[+] Optical USB Gaming Mouse
- ASUS P8Z68 Deluxe Z68 LGA 1155 Motherboard
- Crucial Ballistix 6GB DDR3 2133 MHz RAM Triple Channel Kit
- OCZ Octane 512GB Indilinx SSD
- SteelSeries Desmo Digital Eyewear
- Cooler Master Storm Trooper Full Tower Case
- IOCELL NetDISK 351UNE Network Storage Device
- Corsair Vengeance 8GB DDR3 Low Voltage 1600MHz
- SilverStone SST-EC03 USB 3.0 PCI-E Card