How To: Recover the Linux root password

  • 3003803
  • 18-Jan-2007
  • 27-Apr-2012


SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Server 9
SUSE Linux Enterprise Server 8


Lost or forgot the root password on Linux server


  1. Boot server from the installation CD.
  2. Then select any installation method or Rescue System.
  3. At the first installation screen when selecting language, press ctrl-alt-f2 to open a virtual console.

    Note: If you selected Rescue System, select your keyboard language and then a Rescue Login prompt should appear. Login as root.

  4. Type
    fdisk -l
    to list the partitions. Locate the Linux root partition.
  5. Type
    mount /dev/sda4 /mnt
    (replace sda4 with the device name for the Linux root partition identified in the previous step).
  6. Run
    mount -o bind /dev /mnt/dev
    to make the device files available (this is needed for access to the urandom device which may be used by the passwd command below).
  7. Enter
    chroot /mnt
  8. Now enter
    passwd root
    and reset the root password.
  9. Type
    to leave the chroot environment.
  10. Reboot the system.

Change Log

2011-11-21 - Sascha Wehnert:
* added SLES11
* deleted former #10 to umount /mnt and reboot. The umount command would have failed because /dev was still mounted on /mnt/dev. Rebooting the system straight ahead will take care of this.

Feedback service temporarily unavailable. For content questions or problems, please contact Support.