Wed, 23/Aug/2017 11:42

Password recovery

I acquired two surplus computers about four years ago. One is 1.2 GHz with 764 MB of RAM and a 20GB hdd, Not much but sufficient to run sshd, sambad, and apached. It was my host for backups of my main system. I had  intended it to serve webpages for this site but I am using Hostmonster instead for hosting. I installed ZenWalk GNU/Linux on it long ago. The other computer is a 2.1 GHz procressor, four 40GB scsi hdds in a raid5 (striped and mirrored) setup and a 35 GB hdd to host the OS. This one is a minimal install of Debian.

Since I have not used these two in over three years, I have forgotten root passwords plus any user info. I recall having issues setting up the scsi raid and getting all the os just the way I wanted it with ssh, samba etc all running as damons in the background. I do not want to go to the trouble of setting this all up again, Thus I wanted to find a method to reset the root passwords (respectively)

Ok it is surprisingly simple and a little scary at the ease. I simply put init=/bin/bash on the kernel line of grub (or the linux line of lilo for Debian). This booted me to a console with root access without logging in. So I did not have read/write permissions on the drives but that was fixed by issuing:

mount -o remount, -rw /dev/hdx /

remounting root as root but read/write. note that the "-" before "rw" may or may not be needed and the "x" in "hdx" must be replaced by your drive.

Then I simply edited the /etc/shadow file with nano. rebooted and re-entered the init=/bin/bash part so I could enter a new root passwword with "passwd". I wrote it down this time in a secret place (inside the computer case... if you have physical access to my computer, you can reset the password anyway). The root password for my main machine is not written but I type that every day.

Anyway, now I will connect them to my router, power them up and ssh to them so I can install updates. mmm ssh. I will save that for another day.





Please add a comment

Leave a Reply



(Your email will not be publicly displayed.)


Captcha Code

Click the image to see another captcha.


Comments

Leave a Reply



(Your email will not be publicly displayed.)


Captcha Code

Click the image to see another captcha.