Difference between revisions of "Lost Password"

From FreekiWiki
Jump to navigation Jump to search
Line 4: Line 4:
 
Edit the grub boot commands.
 
Edit the grub boot commands.
  
#start the computer booting up
+
#start the computer booting up, and hold down the right shift key.
#After a few (or 10 or 20) seconds you will see a screen that says... '''Grub Loading...3..2..1'''.
+
#After a few (or 10 or 20) seconds you will see the grub menu, which is characterized by a lines that will say '''...kernel 2.6...'''
#During this screen, quickly press Esc, or hold down the shift key to go to the grub menu
+
#Hit the down arrow once to get to a line that ends with '''recovery mode''' and press enter.
#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".
+
#This will bring up a menu with many options.  The two that you're looking for are '''netroot''' and '''root'''.  Netroot will set up networking on the machine, and then drop you to a root shell.  root will just drop you to a root shell without any further setup.
#Make sure that the recovery mode option is highlighted and press enter.
+
#select either '''netroot''' or '''root''' from this menu.  If you get a message that says "Give root password for maintenance (or type Control-D to continue):" then you have a root password set.  Enter the root password here or if you don't know the root password follow the instructions under [[Lost_Password#Reset root password|here]]
#This will bring up a menu with 4 options: resume, dpkg, root, and xfix
+
#You will be given a line at the bottom of the screen that should say '''root@freekbox:~#'''
#select "root" from this menu.  If you get a message that says "Give root password for maintenance (or type Control-D to continue):" then you have a root password set.  Enter the root password here or if you don't know the root password follow the instructions under [[Lost_Password#Reset root password|here]]
+
#at this prompt, enter '''passwd yourusername''' (replace yourusername with the username you're trying to reset, or "oem" if it has not been changed).
#You will be given a line at the bottom of the screen that should say root@freekbox:~#
+
#:If you don't know the accounts username you can type '''ls /home''' for a list of all accounts on the computer.
#at this prompt, enter "passwd yourusername" (replace yourusername with the username you're trying to reset, or "oem" if it has not been changed).
 
#:If you don't know the accounts username you can type "ls /home" for a list of all accounts on the computer.
 
 
#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.
 
#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.
 
#once you enter your new password it should tell you "passwd: password updated successfully"
 
#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.
+
#type reboot to restart the computer.
  
 
==live CD method==
 
==live CD method==

Revision as of 15:17, 20 July 2011

The following applies to most linux boxen. It can be used to recover a lost password and is also called "rooting" the box.

GRUB method

Edit the grub boot commands.

  1. start the computer booting up, and hold down the right shift key.
  2. After a few (or 10 or 20) seconds you will see the grub menu, which is characterized by a lines that will say ...kernel 2.6...
  3. Hit the down arrow once to get to a line that ends with recovery mode and press enter.
  4. This will bring up a menu with many options. The two that you're looking for are netroot and root. Netroot will set up networking on the machine, and then drop you to a root shell. root will just drop you to a root shell without any further setup.
  5. select either netroot or root from this menu. If you get a message that says "Give root password for maintenance (or type Control-D to continue):" then you have a root password set. Enter the root password here or if you don't know the root password follow the instructions under here
  6. You will be given a line at the bottom of the screen that should say root@freekbox:~#
  7. at this prompt, enter passwd yourusername (replace yourusername with the username you're trying to reset, or "oem" if it has not been changed).
    If you don't know the accounts username you can type ls /home for a list of all accounts on the computer.
  8. 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.
  9. once you enter your new password it should tell you "passwd: password updated successfully"
  10. type reboot to restart the computer.

live CD method

If the box does not use grub to boot, one can boot the box using a live cd or a System Rescue CD (download one here), then login as root (not necessary with System rescue CD) and proceed by entering the following commands one by one (hit enter after each line).

mount /dev/sda1 /mnt
chroot /mnt
passwd username    (replace username with the username you're trying to reset, or "oem" if it has not been changed.
sync
reboot

To find your username you can use ls /home

For Macs

For Mac computers at the yaboot prompt enter:

Linux rw init=/bin/bash

Once you get to the # prompt you will need to reset the terminal

reset

Now check the username

ls /home

and reset the users password

passwd usernamehere

Reset root password

  1. start the computer booting up
  2. After a few (or 10 or 20) seconds you will see a screen that says... Grub Loading...3..2..1.
  3. During this screen, quickly press Esc, to go to the grub menu
  4. Next you will see several lines that start with Ubuntu, kernel 2.6..., this is the GRUB menu.
  5. Select the first line in the list and press 'e'
  6. You should see something along the lines of
root   (hd0,0)
kernel /boot/vmlinuz-2.6.24-27-generic root=UUID=3deb56... ro quiet splash
initrd /boot/initrd.imb-2.6.24-27-generic
quiet
  1. Select the second line and press 'e' again.
  2. Remove 'ro quiet splash' from the end of the line and add 'rw init=/bin/bash'. Hit enter.
  3. Press 'b'. The box will now boot up and you will get a prompt that says 'root@(none):/#'
  4. At the prompt enter
/usr/sbin/usermod -p '!' root

Restart the computer.