Resetinng root password Linux

Resetting Root Password for Major Linux Distributions #

Resetting the root password on Linux may become necessary if the password is lost or forgotten. The reset process may differ among different distributions, but it generally involves booting the system into recovery mode and changing the password. Below are instructions for resetting the root password for several major Linux distributions.

Debian and Ubuntu #

  1. Restart the computer and during boot, press the “Shift” or “Esc” key to bring up the boot menu.
  2. Select the kernel you want to use and press “e” to edit the boot parameters.
  3. Add the “init=/bin/bash” parameter to the line starting with “linux” and press “Ctrl+X” to continue booting.
  4. Enter the command “mount -o remount,rw /” to mount the file system in read/write mode.
  5. Enter the command “passwd root” and follow the instructions to change the password.
  6. Restart the computer.

CentOS and Red Hat #

  1. Restart the computer and enter the boot menu (GRUB).
  2. Select the kernel you want to boot and press “e”.
  3. Add the “init=/bin/sh” parameter at the end of the line starting with “linux”.
  4. Press F10 to boot the system into single-user mode.
  5. Execute the command “passwd root” to change the root password.

Arch Linux #

  1. Restart the computer and during boot, press the “Shift” key to bring up the boot menu.
  2. Select the kernel you want to use and press “e” to edit the boot parameters.
  3. Add the “init=/bin/bash” parameter at the end of the line starting with “linux” and press “Enter” to continue booting.
  4. Enter the command “mount -o remount,rw /” to mount the file system in read/write mode.
  5. Enter the command “passwd root” and follow the instructions to change the password.
  6. Restart the computer.

Fedora #

  1. Restart the computer and enter the boot menu (GRUB).
  2. Select the kernel you want to boot and press “e”.
  3. Add the “rd.break” parameter at the end of the line starting with “linux”.
  4. Press Ctrl+X to boot the system into emergency mode.
  5. Execute the command “mount -o remount,rw /sysroot”.
  6. Execute the command “chroot /sysroot”.
  7. Execute the command “passwd root” to change the root password.