Saturday, February 24, 2007

Ubuntu - recovering lost password for first account

I have an Ubuntu server, an old machine with only 128MB of RAM. I installed it last summer and stuck it behind the chair in my living room. I log into it from ssh, I use it for my website and my Java/Hibernate applications, and it works beautifully. Ubuntu typically hides the root account, so instead, the first user account created becomes the sudoers account, the one that can be used for all admin work.

All was going well until one day, I changed my user password in a rush, and forgot to write it down. The next time I tried to ssh in, I couldn't remember the password.

A google search for "Ubuntu recover password" provided a lot of responses, but a number of them were quite confusing. So here, for both my future reference and your edification, are some (hopefully clearer) instructions for resetting your user password. Of course, these instructions only apply to physically working from the hardware, this is not something that can be done remotely.

RESETTING YOUR USER PASSWORD FOR UBUNTU
1. Restart your Ubuntu machine.
2. During startup, you will see a reference to Grub boot loader, and a comment that to edit these settings, you should press 'esc'.
3. Therefore, at that point, press 'esc'.
4. The Grub boot loader screen will show you 2-3 options. The first option is the default. The SECOND option, at the end, should say "recover mode". This is the mode you want. Select it, and press enter.
5. Wait for the boot to finish. This will bring you to command line.
6. For the example below, let's pretend that your username is "gcluney".
7. At command line, type:
passwd gcluney
8. You will be asked to provide a new password, and then to retype it.
9. Do this, then restart your machine.

No comments: