Difference between revisions of "Reset root password"

From ArchWiki
Jump to: navigation, search
m (Using wording instead of wiki page name for change-root.)
m (Moved note to end; changed note from some USB keyboards do not work, to some keyboards will not work; clean up.)
Line 8: Line 8:
 
# Reboot and don't lose your password again!
 
# Reboot and don't lose your password again!
  
==Method 2 - Using GRUB's Boot Menu==
+
== Method 2 - Using GRUB's Boot Menu ==
{{Note|If you have an USB keyboard, it will likely not work when you hit your (#) prompt.  PS/2 keyboard systems should be fine.}}
+
1. Select the appropriate entry in the GRUB menu and press {{Keypress|e}} to edit the line.
+
  
2. Select the kernel ... line and press {{Keypress|e}} again to edit it.
+
1. Select the appropriate boot entry in the GRUB menu and press {{Keypress|e}} to edit the line.
  
3. Append '''init=/bin/bash''' at the end of line.
+
2. Select the kernel line and press {{Keypress|e}} again to edit it.
  
4. Press {{Keypress|b}} to boot (don't worry, this change is only temporary and will not be saved to your menu.lst).  Once you boot you should be at a (#) prompt.
+
3. Append {{Codeline|init=/bin/bash}} at the end of line.
 +
 
 +
4. Press {{Keypress|b}} to boot (this change is only temporary and will not be saved to your menu.lst).  Once you boot you will be at the bash prompt.
  
 
5. Your root file system should be mounted as readonly so remount it as read/write:
 
5. Your root file system should be mounted as readonly so remount it as read/write:
 +
 
  # mount -n -o remount,rw /
 
  # mount -n -o remount,rw /
  
6. Use the <code>passwd</code> command to reset your root password.
+
6. Use the {{Codeline|passwd}} command to create a new root password.
  
 
7. Reboot and don't lose your password again!
 
7. Reboot and don't lose your password again!
 +
 +
{{Note|Some keyboards may not be loaded properly by the init system with this method and you will not be able to type anything at the bash prompt.  If this is the case, you will have to use Method 1}}
  
 
==Method 3 - Using Another Linux Distro on Your System==
 
==Method 3 - Using Another Linux Distro on Your System==
 
If you have another distro installed on another partition or hdd on the same system, you can simply chroot into your "broken" partition from a shell and reset the password from there.  See [http://www.howtoforge.com/how-to-reset-a-forgotten-root-password-with-knoppix-p2 this guide] for an example.
 
If you have another distro installed on another partition or hdd on the same system, you can simply chroot into your "broken" partition from a shell and reset the password from there.  See [http://www.howtoforge.com/how-to-reset-a-forgotten-root-password-with-knoppix-p2 this guide] for an example.

Revision as of 17:14, 10 December 2009

Resetting Root Passwords

Below are several methods one can use to reset the system's root password should it be forgotten or corrupted. The methods are the same in principal but differ in what is required to access them. There are more ways to do this you can find in a google search too.

Method 1 - Using the Arch Live CD

  1. Boot the Arch Live CD, and change root.
  2. Use the Template:Codeline command to reset your root password.
  3. Reboot and don't lose your password again!

Method 2 - Using GRUB's Boot Menu

1. Select the appropriate boot entry in the GRUB menu and press Template:Keypress to edit the line.

2. Select the kernel line and press Template:Keypress again to edit it.

3. Append Template:Codeline at the end of line.

4. Press Template:Keypress to boot (this change is only temporary and will not be saved to your menu.lst). Once you boot you will be at the bash prompt.

5. Your root file system should be mounted as readonly so remount it as read/write:

# mount -n -o remount,rw /

6. Use the Template:Codeline command to create a new root password.

7. Reboot and don't lose your password again!

Note: Some keyboards may not be loaded properly by the init system with this method and you will not be able to type anything at the bash prompt. If this is the case, you will have to use Method 1

Method 3 - Using Another Linux Distro on Your System

If you have another distro installed on another partition or hdd on the same system, you can simply chroot into your "broken" partition from a shell and reset the password from there. See this guide for an example.