Nebius Israel
Contact usConsole
  • GPU
  • Docs
© 2023 Nebius Israel Ltd
Compute Cloud
  • Container Solution
  • Access management
  • Pricing policy
  1. Step-by-step guides
  2. Working on VMs
  3. Restoring access to a VM

Restoring access to a VM

  • VM user credentials are lost
  • An SSH key's public part was changed
  • Unable to connect to a VM via SSH or RDP
  • An SSH key is lost
  • A VM fails to start

You may need to restore access to a VM in the following cases:

  • VM user credentials are lost.
  • An SSH key's public part was changed.
  • Unable to connect to a VM via SSH or RDP.
  • A VM fails to start.

VM user credentials are lostVM user credentials are lost

If you lost your private SSH key for Linux or your Windows user password:

  1. Create a snapshot of the disk of the VM that you want to restore access to.
  2. Create a VM with the disk from the snapshot specifying it as the boot disk. When creating a VM, enter your new credentials under Access.
  3. Connect to the VM via SSH or RDP using the new credentials.

If the 'cloud-init' or network configuration was changed for the VM, the described method may not work. In this case, see A VM fails to start.

An SSH key's public part was changedAn SSH key's public part was changed

You may have problems accessing a Linux-based VM over SSH if the public part of your SSH key was changed or deleted on the side of the VM.

You can restore access to a Linux-based VM over SSH using the serial console if you have a valid pair of SSH keys.

If you can't access the serial console, do the following to recover the public part of your SSH key:

  1. Stop the VM.

  2. Take a snaphost of the VM's boot disk.

  3. Create an auxiliary Linux-based VM. Under Image/boot disk selection, choose the OS for the boot disk. To attach a data disk to an auxiliary VM, select the previously created snapshot in the Disks section.

  4. Connect over SSH to the auxiliary VM and mount the disk you created from the snapshot.

  5. Replace the SSH key that is stored on this disk with a valid key:

    1. Go to the folder that stores the public part of the SSH key in the mounted partition. For example:

      cd /mnt/home/<username>/.ssh
      

      By default, a user's SSH keys are stored in the ~/.ssh directory of this user.

    2. Open the authorized_keys file, for example, using the nano text editor:

      nano authorized_keys
      

      If the file is missing, this command will create it.

    3. Replace the contents of the file with the public part of the valid SSH key pair.

  6. Unmount the disk with the fixed SSH key from the VM:

    sudo umount /mnt
    
  7. Stop the auxiliary VM and detach the disk with the fixed SSH key from it.

  8. Create a new VM. Under Image/boot disk selection, go to the Custom tab and select the disk with the fixed SSH key as the boot disk.

    Note

    Make sure the new VM and the disk with the fixed SSH key are in the same availability zone.

  9. Connect to the new VM over SSH.

  10. Delete the disk snapshot and delete the auxiliary and old VMs.

Unable to connect to a VM via SSH or RDPUnable to connect to a VM via SSH or RDP

The problem may occur due to an error in the SSH, RDP, security group, or network settings. To restore access, connect to the VM using the serial console and adjust the settings.

Linux
Windows

Note

You may use the serial console only if the user password is set. Otherwise, see A VM fails to start.

  1. Enable access to the VM serial console.
  2. Connect to the VM serial console.
  3. Change the SSH or network settings. If you have security groups set up, make sure that their rules allow incoming TCP traffic to port 22.
  4. Connect to the VM via SSH.
  1. Enable access to the VM serial console.
  2. Connect to the VM serial console.
  3. Change the RDP or network settings. If you have security groups set up, make sure that their rules allow incoming TCP traffic to port 3389.
  4. Connect to the VM through RDP.

An SSH key is lostAn SSH key is lost

If you set a user password, configure the VM serial console and connect to it. We recommend connecting through the CLI.

If no user password is set, take a snapshot of the VM's disk and create a new VM from the snapshot.

If the problem persists:

  1. Create a new disk from the VM snapshot.
  2. Attach it as a secondary disk to a different VM.
  3. Change the root directory with chroot.
  4. Edit the configuration files that make the VM unavailable.
  5. Detach the disk from the VM.
  6. Create a new VM. Under Image/boot disk selection, go to the Custom tab and select your disk as the boot disk.

A VM fails to startA VM fails to start

If you cannot start a VM, get access to data on the disk as follows:

  1. Create a snapshot of the disk of the VM that you want to restore access to.
  2. Create a disk from the snapshot. When creating a disk, choose Snapshot in the Contents field and specify the created snapshot.
  3. Attach the disk as secondary to the auxiliary VM.
  4. Change the configuration files that affect the VM startup or copy important data.
  5. Detach the disk from the auxiliary VM.
  6. If you found and fixed the startup issue, create a new VM. When creating a VM, go to the Custom tab under Image/boot disk selection and select the fixed disk as the boot disk.
© 2023 Nebius Israel Ltd
In this article:
  • VM user credentials are lost
  • An SSH key's public part was changed
  • Unable to connect to a VM via SSH or RDP
  • An SSH key is lost
  • A VM fails to start