Sign in with
Sign up | Sign in
Your question
Closed

Password recovery in Ubuntu 10 04 LTS

Last response: in Linux/Free BSD
Share
February 8, 2012 11:08:36 PM

I purchased a used Linux Computer last year (I am a snowbird and had access to it only in winter). It did not come with recovery CDs and it had a strange admin password that I didn't like. So, being new to Linux, I took it to the person that sold it to me and asked him if he would change the password to one I had written down on a piece of paper (one that I use a lot for low security situations). But he misread what I wrote and made a substitution for one of the characters. I decided to just go along with it instead of having him redo it figuring that I could change it myself later when I become more familiar with Linux. But I didn't write the password down figureing I coudl remember what that error was. I also had him change the system so that it didn't require the password at boot time but just when administrative priviledges are needed. Now it is a year later and I cannot remember what error he made and have tried a number of guesses but with no luck. So I cannot install any new applications.

Is there anyway that I can recover the password or override it with another password? If there is please let me know pronto.

-Richard

Note: Please don't post your personal details on the site.
a b 5 Linux
February 9, 2012 5:10:26 AM

So long as the root filesystem isn't protected with something like volume encryption, you can do the following:

-Get a LiveCD/LiveUSB of your favorite distro (e.g. the latest Ubuntu)

-Once it's booted, it should have mounted your old installation's harddisk, verify that it has (check the "Places" menu, issue a "df" on the terminal, open a Nautilus file manager window, etc.), just make sure that it's the disk you were expecting (e.g. if it's a SATA drive, the device file should be /dev/sdLETTERNUMBER, PATA should be /dev/hdLETTERNUMBER)

-Navigate to /PATH/TO/ROOTFS/DISK/etc/ (likely something like /media/$SOME_COLLECTION_OF_LETTERS_AND_NUMBERS/etc/) in a terminal (check online to figure out how to get to a terminal for the livecd distro you chose)

-Issue a gksudo gedit shadow, this will open the shadow file, the location that all user account details (including a password hash) are stored, with root privileges.

-There should be a line that looks like
  1. root:SOME_RANDOM_CHARACTERS:14984:0:99999:7:::
, basically remove all of the stuff between the first and second colon such that it now looks like
  1. root::14984:0:99999:7:::


-Save and close the file

-Reboot, making sure to remove the liveCD when safe such that you boot to the old system.

-Your root password is now just a blank, so you should go ahead, open a terminal, and issue the following command to set the root account's password: sudo passwd

Let us know if you run into any issues
Score
0
February 16, 2012 11:09:30 AM

Thank you. All this makes sense. I just need to be careful not to install from the live one.
I am a tyro with Linux, but I have an extensive computer background having spent 15 years as a system analyst on mainframe and almost 20 years with various windows systems and Java programming. I know how to get to the terminal in Unity (which it appears that all the most recent distros of Ubuntu are using for the desktop. z) You just go to the dashboard and enter a "ter" and one of the items that appear is the terminal.
There is no "places" menu in the Unity desktop. I knod of like Gnome better -- but I do see some advantages to Unity. Thanks again, and I will let you know how I make out with your solution.
Score
0
Related resources
a b 5 Linux
February 17, 2012 1:19:41 AM

So long as you avoid clicking the "Install Ubuntu" icon on the desktop of the livecd (and don't proceed to somehow accidentally proceed through the entire installation process that requires interaction from you), you should be solid.
Score
0
February 18, 2012 11:27:33 PM

bmouring said:
So long as you avoid clicking the "Install Ubuntu" icon on the desktop of the livecd (and don't proceed to somehow accidentally proceed through the entire installation process that requires interaction from you), you should be solid.


This is third time I have written this. The first two times there was no submit or preview button.

I want to thank you again for your assistance. I am sure that it would have solved my problem had I not found another simpler solution.

The solution that I used that worked did not require me to boot from a live Ubuntu. I had to find out what key or key combination should be applied immeadiately after the BIOS posted in order to enter the recover mode of Linux. In the covery mode I went to the root shell and I reset the root password. Then entered "shutdown -r now"
After rebooting I found that the root password was NOT the password requested after "sudo apt-get install foo". I needed a password for the account that was logged in automatically.
I issued "whoami" in the terminal application and it told me the user name was "owner".

Then I entered "su root"

Then I entered "password owner"
When requested twice to enter the new password for "owner' I put in a password twice as requested.

Then I closed that terminal and opened another and entered "sudo apt-get install rosegarden" and my password was accepted.

("rosegarden" is the name of a music program that I wanted to install.)

I want to thank you for taking the time to answer my question -- I suspect that it would have worked and would have been what I needed to use, in the event that I could not get into the recovery mode.
Score
0
a b 5 Linux
February 19, 2012 5:16:08 AM

No problem, glad you actually found a simpler solution to the problem, I can never keep straight which distros will ask for the root password when booting to single user mode (called "recovery mode" under Ubuntu) and which don't (as it's clearly a security issue for publicly-used computers if there is no root password required when booting into single user mode, including if editing of grub(2) boot entries is not password-protected).

There's a fun story where, when I was at a programming competition at a university that shall remain nameless where they neglected to put either of those measures in place, needless to say I had remote root access to a few machines in that computer lab for about a semester ;) 
Score
0
a b 5 Linux
February 21, 2012 1:27:30 AM

This topic has been closed by Amdfangirl
Score
0
!