🛠️How to Change Root Files in Rescue Mode (OVH Public Cloud)

This guide explains how to mount the root disk, edit system files, or change the root password when using Rescue Mode on an OVH Public Cloud instance.


🔐 When to Use Rescue Mode

Rescue mode is useful when:

  • You’ve lost access to the server (SSH key or password issues).
  • A misconfiguration prevents the system from booting correctly.
  • You need to repair, back up, or recover system files.

🛠️ Step-by-Step Instructions

1. Reboot into Rescue Mode

  1. Log in to the OVH Control Panel.
  2. Go to your Public Cloud Instance.
  3. Click the ⋮ menu (three dots) at the top right.
  4. Select “Reboot in rescue mode”.
  5. Choose the “rescue-pro” image.
  6. You’ll be provided with a temporary root password in the console. If you’ve added an SSH key previously, you’ll be logged in automatically via key-based authentication.

2. Access the Instance in Rescue Mode

Login via SSH:

ssh [email protected]

If no SSH key is installed, use the root password provided in the console.


3. Check Mounted Filesystems

Run:

df -h

Example output:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       2.4G  1.5G  784M  66% /
...

/dev/sda1 is the temporary rescue systemnot your main system disk.


4. Identify Your Attached System Disk

Run:

lsblk

Example:

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  2.5G  0 disk
└─sda1   8:1    0  2.5G  0 part /
sdb      8:16   0   40G  0 disk
└─sdb1   8:17   0   40G  0 part

Here, /dev/sdb1 is the root partition of your actual system disk.


5. Mount the System Disk

mount /dev/sdb1 /mnt

Confirm it’s mounted:

df -h

You should see:

/dev/sdb1        40G  7.0G   31G  19% /mnt

6. Access System Files

Switch to the mounted disk:

cd /mnt

Check contents:

ls

You’ll see the standard root directory structure:

bin  boot  dev  etc  home  lib  media  mnt  opt  proc  root  sbin  tmp  usr  var

🔑 Example: View Authorized SSH Keys

cat /mnt/root/.ssh/authorized_keys

You can add your new key here if you’re locked out.


🔒 Change the Root Password

  1. Chroot into the mounted system:
chroot /mnt
  1. Change the root password:
passwd

Enter and confirm the new password.

  1. Exit chroot:
exit

🔁 Reboot Normally

Once you’ve finished your tasks:

  1. Go back to the OVH Control Panel.
  2. Click the menu and select “Exit rescue mode”.
  3. The instance will reboot normally using the updated configuration or password.

🖥️ Using OpenStack CLI (Optional)

If you prefer using OpenStack CLI tools:

  • Enter rescue mode:
nova rescue INSTANCE_ID
  • Exit rescue mode:
nova unrescue INSTANCE_ID

✅ Summary

TaskCommand/Action
Identify diskslsblk
Mount real system diskmount /dev/sdb1 /mnt
View root filesystemls /mnt/root/
Change root passwordchroot /mnt && passwd
Restore normal bootExit rescue mode via OVH panel

Scroll to Top