База знаний
How To Reset the Root User Password from Rescue Mode Распечатать статью
If you've forgotten the root password for your Linux system, resetting it in rescue mode is a valuable troubleshooting step.
Rescue mode allows you to access your system in a minimal environment, which enables you to reset the root password.
This step-by-step tutorial will guide you through the process.
First you need to enable rescue mode from VPS Control Panel.
Guide : How to enable Rescue Mode
After you have enable rescue mode for your VPS, access it using ssh/putty.
You need to first Mount the Root Filesystem. Then, execute the following commands:
To identify your root partition, run the fdisk -l command. Your root partition is typically named /dev/sda1, /dev/nvme0n1p1, or a similar designation.
Mount the root partition to /mntmount /dev/sdXY /mnt
Use the root partition you identified in the previous step to replace /dev/sdXY
Chroot into the Root Filesystem
Now you must modify the root environment to your actual system's root filesystem. This is done with the chroot command:
chroot /mnt
Reset the Root Password
Once the root filesystem is mounted and chrooted, you have the capability to reset the root password. This can be achieved by using the passwd command.
passwd
When prompted, you will be asked to enter a new root password. Once you have set the new password, you will likely receive some password-related messages confirming that the password has been updated successfully.
Unmount and Reboot
Exit the chroot environment:
exit
Now, unmount the root partition:
umount /mnt
Finally, reboot your system:
reboot
After that, disable rescue mode from VPS Control Panel.
Now you should be able to access your VPS using the new password which you have set.
Помог ли вам данный ответ?
Связанные статьи
Hi Thank you for choosing service from Host4Fun . Go to run > cmd > slmgr.vbs /rearm and...
By default Windows Server 2008 firewall blocks ping requests. To enable please follow the...
By default Windows Server 2012 firewall blocks ping requests. To enable please follow the below...
Hi , Thank you for choosing Service from Host4Fun.Com. When we run command "yum update" on our...
For Guide Visit :...