Thursday, July 28, 2016

If you ever forget root password of your Dedicated Server while your Hosting provider doesnt have IPMI nor using VMware, there are simple ways to do this.

First you need to boot the server with Rescue Disk (sysrcd), in this case I'm reloading the server with sysrcd 4.3.1 (Rescue System)

Login to the server with the detail provided with sysrcd, root and password.

Once you're inside sysrcd, you have too see which one is root volume!
Type this command :

 fdisk -l  

it will results like this
 Disk /dev/sda: 232.9 GiB, 250000000000 bytes, 488281250 sectors  
 Units: sectors of 1 * 512 = 512 bytes  
 Sector size (logical/physical): 512 bytes / 512 bytes  
 I/O size (minimum/optimal): 512 bytes / 512 bytes  
 Disklabel type: dos  
 Disk identifier: 0x000cc4a7  
 Device  Boot   Start    End  Blocks Id System  
 /dev/sda1 *     2048  514047  256000 83 Linux  
 /dev/sda2     514048 488280063 243883008 8e Linux LVM  
 Disk /dev/mapper/vg-root: 227.7 GiB, 244511145984 bytes, 477560832 sectors  
 Units: sectors of 1 * 512 = 512 bytes  
 Sector size (logical/physical): 512 bytes / 512 bytes  
 I/O size (minimum/optimal): 512 bytes / 512 bytes  
 Disk /dev/mapper/vg-tmp: 1 GiB, 1073741824 bytes, 2097152 sectors  
 Units: sectors of 1 * 512 = 512 bytes  
 Sector size (logical/physical): 512 bytes / 512 bytes  
 I/O size (minimum/optimal): 512 bytes / 512 bytes  
 Disk /dev/mapper/vg-swap: 3.9 GiB, 4127195136 bytes, 8060928 sectors  
 Units: sectors of 1 * 512 = 512 bytes  
 Sector size (logical/physical): 512 bytes / 512 bytes  
 I/O size (minimum/optimal): 512 bytes / 512 bytes  
As you can see, it is: /dev/mapper/vg-root

Create a temp directory where we will mount the volume:
 mkdir /mnt/systmp  

Now we have to mount root volume in the directory we just made:
 mount /dev/mapper/vg-root /mnt/systmp  

Now you can see all directory of the server
 dir  

Continue with chroot
 chroot /mnt/systmp /bin/bash  

You can execute this command to change root password:
 passwd "your new password"  

Once done, you can reboot your server and login with the new root password. Enjoy..cD

0 comments :

Post a Comment