in centos

How to restore your linux server root password (OVH)

1 Star2 Stars3 Stars4 Stars5 Stars (12 votes, average: 4.33 out of 5)

Are you loss your linux server root password and you can not log on to your server, and your server in datacenter ovh or hetzner ?

Follow thoses steps :

I will tell you step by step how to restore your root password ,

1- log into your datacenter control panel and boot your server in rescue mode

2- after your server booted see if your HDD is mounted or not (you can use df command)

3- Mounting disk(s)

Usually, /dev/xda1 is your root partition (/) and /dev/xda2 corresponds to /home.

a- Devices are such as:

  • /dev/sd for SCSI, SATA, Raid Hard
  • /dev/hd for IDE disks
  • /dev/md for RAID Soft
  • /dev/rd/c0d0p for raid Mylex
  • /dev/ad4s1 for Freebsd systems

b- Mounting disk with an ESXi datastore
To mount an ESXi datastore, you have to use the vmfs-fuse tool.

vmfs-fuse /dev/sdX /mnt

3- if your HDD not mounted create new Directory and mount your / Partition

mkdir /root/myhdd

mount /dev/sda2 /root/myhdd

4- change you root directory

chroot /root/myhdd

5- Now You change your root Password :

passwd root

6- enter your new password and reboot server in normal mode

Exiting from the Rescue Mode

After the modifications, we must go back to the manager in order to restore in Boot our usual Boot method.

sudo reboot

Related Posts

Written By:

Blog for everything about hosting, website, server and technical support

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.