16 Jan

Change Root Password – Rescue Mode – VPS – Dedicated Servers

Change Root Password - Rescue Mode - VPS - Dedicated Servers

To

change the VPS or dedicated server root password via rescue mode, you have to reboot your vps/server in rescue mode. to do this please follow the instructions below.

Go to your client area > services > [your vps / dedicated server]

Then click to your related product / service. When your product form open. scroll down to see “Tabs
Here Please click on “Power” Then on “Net boot” then on “Rescue”

rescue mode

Here in left side image, you can see tabs, and in these tabs you can see Power tab is highlighted and you can see the Option “Net Boot” and also “Rescue” button.

You can see “Available Options” in image footer, Select “Rescue64 pro” and then press “Boot Now”.

In

right side image you can see a pop up asking for reboot confirmation. Please select yes to reboot your server / vps in rescue mode.

Note: After rescue operation, you can reboot your server in normal mode again from same screen by selecting “Hard Disk” button instead of “Rescue“.

Note: You can also boot your server from “Network” by providing your own details.

boot now

For VPS / Cloud VPS

After this you will receive an email having credentials to access your server /vps. So when you receive these details, please access your server / vps in rescue mode via ssh and then follow the instructions below.

Using received details you are able to connect to your server, but your files are still not accessible. You need to mount them to your file system.

Note

On a Cloud VPS, before going any further, you have to mount your partition by launching the following command:

[root@rescue ~]# mount /dev/vda1 /mnt

Here “vda1” is your / partition in your vps

Now launch following command to go to your directory.

[root@rescue~]# cd /mnt

Then chroot your disk / partition by launching following command.

[root@rescue~]# chroot /mnt

For Dedicated Server

Usually, /dev/xda1 is the root partition (/), and /dev/xda2 is /home. Replace x in xda1 and xda2 by the correct letter for your drive (s,h,…).

Devices are of the following type:

  • /dev/sd for SCSI, SATA, hardware RAID
  • /dev/hd for IDE drives
  • /dev/md for software RAID
  • /dev/rd/c0d0p for Mylex RAID
  • /dev/ad4s1 for FreeBSD systems

You could also use devfs nomenclature.
If you do not know what type of disks you have on your machine, nor what are their partition table, you can use the fdisk command. Here is an example of an output:

rescue:~# fdisk -l

Disk /dev/hda 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1305 10482381 83 Linux
/dev/hda2 1306 4800 28073587+ 83 Linux
/dev/hda3 4801 4865 522112+ 82 Linux swap / Solaris

Disk /dev/sda 8254 MB, 8254390272 bytes
16 heads, 32 sectors/track, 31488 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 31488 8060912 c W95 FAT32 (LBA)

You can see here that the server is equipped with 2 disk devices: /dev/hda and /dev/sda. There is 3 partitions on hda: hda1, hda2, hda3 and 1 partition on sda: sda1.

We can see that /dev/hda is shown with a star (*) which indicates that it is a bootable drive. The 2nd drive is an USB key (/dev/sda).

In the case of GPT partitions, use parted to be able to see the partitions of the drive.

To

mount the root partition (/), simply execute the mount command followed by the partitions where it is located (/dev/hda1) and the place where you wish to mount it (/mnt).

rescue:~# mount /dev/hda1 /mnt/

If your server is configured with software RAID, it is recommended to mount the /dev/md[x] partitions.

Then, do a chroot on the mount made:

rescue:~# chroot /mnt/

After mounting your partition in VPS / Dedicated Server

Now you had mounted your partition and chroot it in your VPS / Dedicated server.

It is time to change root password. Simply lanuch the following command in terminal.

rescue:~ passwd root

It will ask you for password. Give it your new password twice.

Changing password for root user.

New password:
Retype new password:

When you type new password,it will not show on screen as you are typing because of security reasons in linux/unix.

Congratulations – You have successfully updated / changed your password.

Share this

Leave a reply