Instructions to reset password using Single mode on Linux
Introduction
In this article, We will reset password on Linux using Single mode. Sometimes you can forget your login password on Linux. You can use the following instructions to reset your VPS password
For CentOS
Access the Console screen (VNC), proceed to restart the VPS (depending on the system used, there are different ways to restart)
Step 1 : Reset the operating system and access GRUB mode by pressing any key while the machine is rebooting.
Press the “ e ” key to enter the edit with the following display:
Step 2 : Find the text rhgb quiet
and edit it to init=/bin/bash
.
After finishing editing ctrl + x , it will start to boot with the specified parameter. And will show bash prompt .
Step 3: Check the status of the root partition with the following command:
#mount | grep root
#mount -o remount, rw /
#passwd root
Enter the password you want to set for root.
Add command:
#touch /.autorelabel
Reboot the server with the following command:
# exec /sbin/init
Login with new Password to check again.
Wishing you success.
For CentOS Ubuntu/Debian
The implementation is entirely similar for versions of Ubuntu/Debian.
Order of steps
Step 1: Access the Console screen (VNC), proceed to restart the VPS (depending on the system used, there are different ways to restart)
Step 2: Access the system Grub boot menu . Usually the system will automatically display the Grub boot menu. If not, try restarting the VM and pressing the Shift key several times.
Step 3: On the Grub boot menu select the running Kernel and press the E key to edit
Step 4: Move to line linux /boot/vmlinuz..
Note: The interface and parameters between the Ubuntu versions outlined above may not be exactly the same. But completely similar.
Step 5: Edit the parameter part ro ...
to rw init=/bin/bash
Step 6: Press Ctrl + X or press F10 to enter Single Mode . Then execute the following commands:
# Change Password
passwd root
# Data synchronization
sync
# Reboot the system
reboot -f
Step 7: Login with new password and check
Good luck!