Synopsis

Normally resetting the root password is a simple task if you’re logged in already with root privileges, however if you forget the password and need to change it things become a little more difficult.

Procedure

This procedure will be completed in the console of the Linux system, either with KVM connected directly to the Host, or via the iDRAC console, so be sure that you have access to this prior to beginning.

  • If your system is currently running, reboot it. If it is not yet running, start it up. At the boot menu, press the ‘e’ key to edit the first boot entry.

 

  • It should not ask for username or password

         

  • From the grub options, find the line that starts with “linux16” and go to the end of it. Enter ‘rd.break’ without quotes at the end of this line, as shown below.

  • Press “Ctrl+x” to boot with these options. This will boot to the initramfs prompt with a root shell. 

  • At this stage, the root file system is mounted in read only mode to /sysroot and must be remounted with read/write (rw) permissions in order for us to actually make any changes. This is done with the ‘mount -o remount,rw /sysroot’ command.

  • Once the file system has been remounted, change into a chroot jail so that /sysroot is used as the root of the file system. This is required so that any further commands we run will be in regards to /sysroot. This is done by running ‘chroot /sysroot’.

  • From here the root password can be reset with the ‘passwd’ command.
  • You can now reboot, enter ‘exit’ command twice, the first one will exit the chroot jail environment while the second will exit the initramfs root shell and reboot the system.

  • Once the reboot has completed you will be able to use the root account with your newly set password.
Ha estat útil la resposta? 0 Els usuaris han Trobat Això Útil (0 Vots)