Monday, January 28, 2013

Reset linux root password

This post will show you how to reset a linux root password. I assume that you are using GRUB 2 as the bootloader.
  1. Select the linux boot option from the grub menu for which you want to reset the password.
  2. Press e to edit your boot option entry. Note that the editing is not persistent, the next time you boot all these changes will be lost so you don't have to worry about reverting them.
  3. In the line starting with something like this: linux /boot/vmlinux-3.5.0-22-generic ... ro quiet slpash replace ro with wr. This will give you write access instead of read only.
  4. Also add init=/bin/bash at the end of the line. This will start a bash process instead of your desktop environment.
  5. When the line looks like this: linux /boot/vmlinux-3.5.0-22-generic ... rw quiet slpash init=/bin/boot press Ctrl+X to boot.
  6. The system will boot and will give a terminal with root access. You can use this terminal to change the password of any users or run any command you want with root access.
  7. To change the password for user gulyan type: passwd gulyan
  8. After you type the new password 2 times, you need to reboot.
Done :)

No comments:

Post a Comment