Difference between revisions of "Reset root password"

From ArchWiki
Jump to: navigation, search
Line 1: Line 1:
I came back from vacation after doing an Arch64 install and like the genius I forgot my root password. To recover the password, do the following:
+
If you have been locked out of your root account for whatever reason, you can use these processes to reset your root password and regain access to your system.
* Boot your install CD and enter the bash shell.
+
* <code># mount [your root partition -- e.g. /dev/sda3] /mnt</code>
+
* <code># chroot /mnt</code>
+
* <code># passwd root</code>
+
* (Set a new password.)
+
* Reboot.
+
  
==References==
+
== Method 1 - LiveCD ==
http://bugs.archlinux.org/task/8832
+
 
 +
1. Boot the Arch ISO LiveCD and mount your partitions to /mnt
 +
 
 +
2. Bind mount the dev, proc and sys special mount points into your /mnt:
 +
 
 +
mount -t bind /dev /mnt/dev
 +
mount -t bind /sys /mnt/sys
 +
mount -t bind /proc /mnt/proc
 +
 
 +
3. chroot into your installation
 +
 
 +
chroot /mnt /bin/bash
 +
 
 +
4. Use the passwd command to reset your root password
 +
 
 +
5. Reboot and don't loose your password again!
 +
 
 +
== Method 2 - Single User Mode ==
 +
 
 +
# At the Grub menu, highlight the entry for your system and press 'e' to edit.
 +
# Highlight the 'kernel' line and press 'e' again to edit.
 +
# Append a space and the number '1' to the end of your kernel line. This tells the kernel to boot to init level 1, or Single User Mode.
 +
# Press enter to save, and 'b' to boot.
 +
# The system should boot as normal, except instead of booting to a login prompt, it should drop you to a basic shell with a '#' prompt.
 +
# You can use the passwd command from here to reset your password.

Revision as of 01:46, 16 July 2009

If you have been locked out of your root account for whatever reason, you can use these processes to reset your root password and regain access to your system.

Method 1 - LiveCD

1. Boot the Arch ISO LiveCD and mount your partitions to /mnt

2. Bind mount the dev, proc and sys special mount points into your /mnt:

mount -t bind /dev /mnt/dev
mount -t bind /sys /mnt/sys
mount -t bind /proc /mnt/proc

3. chroot into your installation

chroot /mnt /bin/bash

4. Use the passwd command to reset your root password

5. Reboot and don't loose your password again!

Method 2 - Single User Mode

  1. At the Grub menu, highlight the entry for your system and press 'e' to edit.
  2. Highlight the 'kernel' line and press 'e' again to edit.
  3. Append a space and the number '1' to the end of your kernel line. This tells the kernel to boot to init level 1, or Single User Mode.
  4. Press enter to save, and 'b' to boot.
  5. The system should boot as normal, except instead of booting to a login prompt, it should drop you to a basic shell with a '#' prompt.
  6. You can use the passwd command from here to reset your password.