AutoRoot will scan for any logical volume containing the word root or for block devices starting from /dev/sda1…/dev/sda10, /dev/sdb1…/dev/sdb10, /dev/sdc1…/dev/sdc10, it will then try to mount the volume and check for the password file,if found, it will change the root password to: vNugget.com
This started as a simple exercise to get familiar with the python subprocess module, then things got interesting. I thought it ill be useful if I can automate the reset of the root password on various Linux distribution.
How it Work ?
The script is written in python and need to be added to the iso image of system rescue cd which can be found on http://www.system-rescue-cd.org.
To automate the script execution, an autorun file need also to be added to the iso image, this autorun file is used to run AutoRoot.py.
#!/bin/bash python /livemnt/boot/AutoRoot.py
After the machine reboot using the iso file, the AutoRoot script will take care of looking for the root file system, chroot to it and then change the password, after that all you need to do is reboot your machine without the cdrom attached.
On which Linux distribution it work ?
I have tested it, and it successfully/automatically reset the root password on the following distribution, using Logical Volume or block devices
- Debian 8.5.0
- Linux Mint 17.3 cinnamon 32bit
- Ubuntu 16.04 server
- Fedora 23
- CentOS 6.7
How to Use it ?
You have two options here:
- I have already prepared an iso image of system rescue cd which contain the required files (AutoRoot.py and autorun), I have also modified the isolinux.cfg file so the machine will reboot without needing your interaction. You can download the ready-to-use iso image.
- Download the iso image directly from http://www.system-rescue-cd.org and then put AutoRoot.py and autorun on the root directory of the iso image, for Windows users, you can use a tool like WinISO to do this, then reboot, auto-hack and enjoy.
If everything goes perfectly, you should see a screen like this
- The fun part: Adding Windows support 😀
- Rewrite the script
- Stripe down the system rescue CD size.
- Add more Linux distribution/configuration support