Difference between revisions of "Lost Password"

From FreekiWiki
Jump to navigation Jump to search
(merged from "How to Root a Box")
(Updated for Hardy.)
Line 7: Line 7:
  
 
#start the computer booting up
 
#start the computer booting up
#:After 10 or 20 seconds you will see After a few (or 10 or 20) seconds you will see a screen that says... '''Grub Loading...3..2..1'''. (If the box was installed from a CD, rather than our system, you may need to press ESC here in order to see the GRUB menu in the step below)
+
#:After a few (or 10 or 20) seconds you will see a screen that says... '''Grub Loading...3..2..1'''.  
#Next you will see several lines that start with '''Ubuntu, kernel 2.6...''', this is the GRUB menu.  hit the down arrow key very quickly when you see this or it will disappear in 2 seconds.
+
#During this screen, quickly press Esc, to go to the grub menu
#at the top line of the GRUB menu enter "e"
+
#Next you will see several lines that start with '''Ubuntu, kernel 2.6...''', this is the GRUB menu.  hit the down arrow key as soon as you see this menu, it should select an option that ends with "recovery mode".  
#edit the line starting with "kernel" by selecting that line and entering "e"
+
#Make sure that the recovery mode option is highlighted and press enter.
##delete "quiet" and "splash" at the end of the line (if there)
+
#This will bring up a menu with 4 options: resume, dpkg, root, and xfix
##change "ro" to "rw"
+
#select "root" from this menu
##add "init=/bin/bash" to the end
+
#You will be given a line at the bottom of the screen that should say root@freekbox:~#
##enter to make the changes
+
#at this promt, enter "passwd yourusername" (replace yourusername with the username your trying to reset, or "oem" if it has not been changed.
#enter "b" to continue the boot process
+
#It will request that you enter a new password, and then once more to confirm. The screen will not show input as you are typing.
#the boot will go to a root prompt. which will look something like '''"root@(none)"'''
+
#once you enter your new password it should tell you "passwd: password updated successfully"
 +
#type exit to go back to the recovery menu, then select resume to continue booting.
  
 +
#additionally if you dont know the accounts username you can type "ls /home" for a list of all accounts on the computer.
  
The '''passwd''' command can be used to change the root password most linux boxes
 
 
If this is an Ubuntu box, you will need to change the password of the first user instead.  Type passwd and then hit Tab twice to get a list of users on the system. or use "ls /home" to find out the names of the users.
 
 
The password for a user account can be changed at this point.
 
 
passwd <username>
 
 
*It will say enter new UNIX password enter a new password. Hit enter.
 
*Retype it to confirm. Hit enter.
 
*type "sync" and Hit enter. (this ensures that the files are written to disk)
 
*Remember Both the username and password and restart the computer.
 
*login with the old name and new password. If it works, Yay! if not, Repeat!
 
 
 
See how insecure the box is if you have physical access to it?
 
  
 
==live CD method==
 
==live CD method==

Revision as of 16:54, 31 January 2009

The following applies to most linux boxen. It can be used to recover a lost root password and is also called "rooting" the box. It can be used on an Ubuntu box (which has no root password) to recover the user password.

Generally it is easiest if the adopter brings the box in, but alternatively you can walk the adopter through the following:

GRUB method

Edit the grub boot commands.

  1. start the computer booting up
    After a few (or 10 or 20) seconds you will see a screen that says... Grub Loading...3..2..1.
  2. During this screen, quickly press Esc, to go to the grub menu
  3. Next you will see several lines that start with Ubuntu, kernel 2.6..., this is the GRUB menu. hit the down arrow key as soon as you see this menu, it should select an option that ends with "recovery mode".
  4. Make sure that the recovery mode option is highlighted and press enter.
  5. This will bring up a menu with 4 options: resume, dpkg, root, and xfix
  6. select "root" from this menu
  7. You will be given a line at the bottom of the screen that should say root@freekbox:~#
  8. at this promt, enter "passwd yourusername" (replace yourusername with the username your trying to reset, or "oem" if it has not been changed.
  9. It will request that you enter a new password, and then once more to confirm. The screen will not show input as you are typing.
  10. once you enter your new password it should tell you "passwd: password updated successfully"
  11. type exit to go back to the recovery menu, then select resume to continue booting.
  1. additionally if you dont know the accounts username you can type "ls /home" for a list of all accounts on the computer.


live CD method

If the box does not use grub to boot, one can boot the box using a live cd, a rescue floppy, or a Toms Root Boot disk, then login as root and proceed as above.

  1. "mount /dev/hda3 /mnt"
  2. "chroot /mnt"
  3. "passwd"
  4. change password
  5. "sync"
  6. reboot

The procedure can be used for distributions other than the freekbox2 or 3, but you first need to determine the name of the root partition for the mount command.