Password Forget Hell

Well. I guess from time to time everyone forgets somethings and I hope you will not forget passwords. But if you are like me wishing to pass through the hell of forgetting passwords, you are welcome.

The down-sides of system that hardly crashes or performs without any issues is that hardly visit it and hence you forget all the access credentials to that system. We run our issue tracking systems on one such machine and it performs so well that we hardly have to fix anything on that box. But the other day we figured out it too is a computer system and it crashed.

The hell broke loose and all those people connected to this dashboard filled my inbox with “Whats happening?” queries. There were two lessons learnt.

  • The need for proactive monitoring
  • The need to central key management for logins

I am working on those two currently which I will discuss in a seperate blog but first how did I manage to get off the forgetful hell. Here we go.

At the GRUB menu there is usually an option to Single user mode. Most distros have one, and I was using Debian 5.0 and it did have one. So first up, I will tell you what to if you do not have one.

When at the grub menu select the your favorite entry. Press the ‘E’ key(no ‘shift’ mind you). Then by moving, using the arrow keys, highlight the kernel line. Press the ‘E’ key gain to edit it. At the end of the line add the ‘single’.

Now do not esc or return yet. Lets tell grub to enter into the root shell other wise it will still prompt you for password. To do this, add the ”init=/bin/bash’ after you single so your kernel like looks something like this

kernel /boot/vmlinuz- ro root=/dev/sda1 single init=/bin/bash

Now press the return key to save you changes, and on the following screen press ‘B’ key on your key board to boot into the currently buffered kernel options. You will drop into root shell, here you might to run following precautionary command.

# mount -t proc proc /proc

You will need to convert you mount root filesystem to writable mode before you could make changes on it. This will need the following command to be run.

# mount -o remount,rw /

Now we are all set to change the passwd, so set it and remember it.

# passwd root

The changes you make here will be buffered and not yet written to the disks. So we need to sync the buffers to the disk, so to sychronize the changes execute the following command.

# sync

The commands above are very specific to my case on Debian 5.0 and they worked, there might be small distro specific changes that might need to be included or researched. So the next is natural progression to redemption; just need to reboot and login to an almost lost system.



One thought on “Password Forget Hell

  1. I just had to do it on ubuntu. But I didnt have to do any mount of proc or rw of the root. Debian might need them, I am not sure. sync is definitely not needed when you are rebooting.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s