cancel
Showing results for 
Search instead for 
Did you mean: 
  • 122 Views

Recovery root password

Hi, i am trying to reset root password follwed this guide: https://docs.fedoraproject.org/en-US...root-password/ , on fedora VM (relase 41) for rescue mode the points mentioned in the guide are as follows:

  1. Select the boot entry you wish to edit with the arrow keys.
  2. Select the entry you wish to edit by pressing e .
  3. Use the arrow keys to go to select the line beginning with linux , linux16 , or linuxefi .
  4. Go the the end of that line and include a space and the following rw init=/bin/bash .
  5. Press Ctrl-x or F10 to boot the entry
  6. Run the command: passwd, You will be prompted to enter the new root password twice.
  7. Restore the SELinux context and permissions with: touch /.autorelabel
  8. Reboot the machine with: /sbin/reboot -f


i tried to do this points but its don’t work because after execute the VM reboot and i try to login with the root user, say to me password login incorrect. I specify that i follwed the guide step by step. Can someone help me figure out how to reset/recover the root password using the procedure from the bootloader menu? (I urgently need for the Red Hat RHCSA exam).

3 Replies
Maximus_el
Flight Engineer
Flight Engineer
  • 106 Views

Hi @samueleaudace ,

There might be something wrong with the link you posted, but let me try to help you with these steps to reset the root password anyway

  • Append the following directive to the kernel line (at the end of the 'linux' line), then ctrl+x or f1

 

rd.break

 

  • Once in the emergency shell you'll need read and write access to modify the root password

 

mount -o remount,rw /sysroot
chroot /sysroot

 

  • Now change the password:

 

passwd

 

  • To ensure SELinux context is correctly applied to the new password, touch the autorelabel file:

 

touch /.autorelabel

 

  • Exit now

 

exit
exit

 

 

Let me know if you run into any issues

regards,

 

________________________________________________________
Keep fighting, peacefully!
Maximus_el
Flight Engineer
Flight Engineer
  • 98 Views

Regarding your method using 'rw init=/bin/bash,' I suspect the issue might be with the use of '/sbin/reboot -f.' This command forces a reboot without gracefully shutting down services or properly unmounting file systems. In contrast, using 'exit' allows the system to proceed with normal boot or shutdown processes, including reinitializing SELinux contexts if /.autorelabel was touched. Just my two cents.

________________________________________________________
Keep fighting, peacefully!
BalajiMundhe1
Mission Specialist
Mission Specialist
  • 63 Views

did you try to nullify root password...after nully root password in /etc/passwd file in maintainace mode ...we should able to login servers without root password then you set root password.

Join the discussion
You must log in to join this conversation.