Wednesday, 25 April 2018

Reset or Recover Root Password in Linux

How to Root Password in Linux

It happens sometime that you can't remember root password. On Linux, recovering root password can be done by booting Linux under a specific mode: single user mode.
To recover Root Password by following steps
Go to single user mode:
To use single user mode first thing is restart your system. Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:
  1. Use the arrows to select the boot entry you want to modify.
  2. Press “e” to edit the entry.
  3. Use the arrows to go to kernel line.
  4. Press “e” to edit the entry.
  5. At the end of the line add the word : Single ; S or 1
  6. Press “Enter” to go back to the parent menu.
  7. Press “b” to boot the kernel.
It gives you a shell access with password but there are some securities for that access to disable those securities Use following command:
# setenforce 0
For the change the Password
# passwd
Note: if your system requires you to enter your root password to log into Single User Mode then append “init=/bin/bash” after “Single” hit “Enter” to save the change.

No comments:

Post a Comment