Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
We can reset the root password using single user mode.
Hello Muhammad,
You can your Linux root password by booting your system in to single user mode. While booting your system keep on pressing "e" to edit the kernel. Add "1" at the end of the kernel line and boot again by pressing "b"
another method, is if you have any GNU/linux Bootable live CD, you boot from it and mount the partition that has the linux install say for example that you have it mounted on /mnt/sda1, from the command line you type 'chroot /mnt/sda1 bash' or 'chroot /mnt/sda1 sh', what this will do is make bash or sh run and treat the path /mnt/sda1 as the root '/' path, so now you simply type 'passwd' and it will re-write the root password on that mounted system, after you're done just reboot and try the new password.
Reboot the system, and when you are at the selection prompt , highlight the line for Linux and press 'e'. You may only have2 seconds to do this, so be quick.
This will take you to another screen where you should select the entry that begins with 'kernel' and press 'e' again.
Append ' single' to the end of that line (without the quotes). Make sure that there is a space between what's there and 'single'. 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 changes.
Press 'b' to boot into Single User Mode.
Once the system finishes booting, you will be logged in as root. Use passwd and choose a new password for root.
Type reboot to reboot the system, and you can login with the new password you just selected.
reboot the running system and select boot loader and edit and press1 to boot single user mode , execute passwd command to reset root password
Interrupt booting while system start up, then select the kernel using arrow keys and edit the kernel by pressing 'e'. Press enter after typing '1' in kernel, and after that 'b' for booting the saved settings. Now the system boots up to a single user mode. Note that if you had set a Grub password, then it is needed before editing the Grub.
While you are in single user mode type passwd root then type new password and reboot the system using shutdown -r now or reboot.
while booting break the boot process by:-
pressing e and using rd.break remount to /sysroot
change the password using passwd command
and if it is rhel7 dont forget to autorelabel(for selinux)
1- restart the machine
2- once the grub menu apear select the kernel that you want boot from and press "e" to edit
3- add digit "1" right after "rhgb quiet"
4- press Enter to boot the kernel, you will be enter to runlevel 1 (single user)
5- execute "passwd" and enter the new password twice
1. Edit grub boot menu options.
2. Press "e" to edit the first grub menu option and navigate to kernel line.
3. Press "e" key again to edit and remove:
quiet splash
and add:
init=/bin/bash
4. You may have some different boot options but the main part you need to change/add is init=/bin/bash.
5. Press enter.
6. Now, press "b" key to boot.
7. After successfully boot you will be presented with bash command prompt.
8. On some linux systems, you will need to completely mount / and /proc partitions. To do that, enter following commands:
mount -o remount,rw / mount -o remount,rw /proc
9. To reset a actual root password, simply type "passwd" and provide the desired password.
10. Reboot.