STS Host and Tech Knowledge base
Search
Close this search box.

How to Reset/Recover a Forgotten root Password On Linux OS

In the following steps will demonstrate you how to go through to reset root password via rescue mode on dedicated server for both Soft raid and Hard raid partitions.

Reset/Recover root password on LINUX

Reboot Your Server In Rescue Mode

If you want to reboot your server in rescue mode:

  1. Login to your client area.
  2. Choose your server from the Services list.
  3. Click the Power button and select Netboot tab, then Choose Rescue and from Rescue Available select rescue64-pro.
  4. Click Boot Now, then use SSH to connect to your server on rescue mode.
  5. The reboot will generate temporary access codes (password) for the Rescue Mode session. It will be sent to your email.

Change Root Password In Rescue Mode

  • Execute the following commands after you login to your server in rescue mode via SSH. In the command line, run the command:
				
					parted -l
				
			
  • If you are using Softraid, your root partition will be /dev/mdX . Or if you are using Hardraid, your root partition will be /dev/sdX
  • Then Mount this partition by typing the following command:
				
					mount /dev/partitionname /mnt
				
			
  • Now run chroot command which will allow you to run your change password command
				
					chroot /mnt
				
			
  • When you chroot the command, response puts you in the server. Now run the commands on your system. After you finish, enter the following command to recover and change your root account password:
				
					passwd root
				
			
  • Then You will be asked to change the password ( then retype it to confirm it) for the root account. After that’s done, you’ll have to change back the “Netboot” option in the Control Panel to “Boot on hard disk” and restart your server to function from hard disk.

Share Article

Related Articles