Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
All solutions
    • All solutions for Compute Cloud
    • You are unable to add a Committed Volume of Services (CVoS) for Compute Cloud
    • You see a "Permission denied" error when connecting to a VM created in Terraform
    • No nested virtualization support
    • UEFI support and data import from GPT-formatted disks
    • Fixing the "Not enough resources" error on launching a virtual machine
    • Recovering access to a VM with a lost SSH key
    • Fixing issues with creating disk snapshots
    • Boot disk size failed to increase
    • VM instance shuts down on the "instance guest stop processing" operation
    • Fixing the "WARNING REMOTE HOST IDENTIFICATION HAS CHANGED" error
    • Fixing a non-replicable disk breakdown
    • Fixing connection issues with Kosmos VM
    • Fixing password reset issues for VMs based on a Kosmos image
    • Options to migrate a VM image to Yandex Cloud
    • Changing the boot disk for an instance to SSD
    • Getting details about RAM consumption for Compute Cloud instances
    • Creating VMs having multiple network interfaces
    • Decreasing VM disk size
    • Exporting disk images of Compute Cloud VM instances
    • Transferring VMs between folders or clouds
    • Setting up GUI and graphic environment on Linux VMs
    • Using an ISO image for deploying VM instances
    • Monitoring incoming or outgoing VM traffic
    • How to use WinSCP to connect to a Linux VM in Yandex Cloud with a key generated at VM creation
    • How to back up a VM with rollback support
    • How to connect via SSH as root with a password or key
    • How to track memory usage
    • How to save snapshots and images locally
    • How to change an internal IP address
    • How to read the "Connections quota utilization" chart
    • What is the disk access speed for a VM
    • How to create a VM with password access
    • What is the maximum number of network interfaces that can be connected to a VM

In this article:

  • Issue description
  • Solution
  1. Compute Cloud
  2. Recovering access to a VM with a lost SSH key

Recovering access to a VM with a lost SSH key

Written by
Yandex Cloud
Updated at November 27, 2023
  • Issue description
  • Solution

Issue descriptionIssue description

  • The SSH key used to connect to the VM instance is lost.

SolutionSolution

There are several options to recover a VM instance to which you have lost SSH keys.

If a password was not set for the Linux user, you can create a disk snapshot from the problematic VM instance and then create a new VM from this snapshot, selecting "+Add disk" - "Snapshot" on the VM creation page.

If the above method did not solve the issue, complete these steps:

  1. Create a new disk from the snapshot of the problematic VM.
  2. Connect it as an additional disk to another VM.
  3. Change the root directory using chroot.
  4. Modify configuration files that affect VM accessibility, for example, set a new password using the sudo passwd $USERNAME command, where $USERNAME is the name of the Linux user for whom you need to set a password.
  5. Detach the additional disk from the auxiliary VM and create a new VM from it using the modified disk as the boot disk.

If you previously set a password for the Linux user inside the VM, you can use the serial console.
Follow the guide in the documentation for setup.
After enabling the serial console, connect to the VM instance. We recommend connecting from the CLI.

Was the article helpful?

Previous
Fixing the "Not enough resources" error on launching a virtual machine
Next
Fixing issues with creating disk snapshots
Yandex project
© 2025 Yandex.Cloud LLC