Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
All solutions
    • All solutions for Compute Cloud
    • You are unable to add a committed volume of services (CVoS) for Compute Cloud
    • Resolving the `Permission denied` error when connecting to a VM created with Terraform
    • Nested virtualization is not supported
    • Fixing the "Not enough resources" error on launching a virtual machine
    • Recovering access to a VM with a lost SSH key
    • Resolving issues with creating disk snapshots
    • Boot disk size failed to increase
    • VM shuts down on the `Instance guest stop processing` operation
    • Resolving the `WARNING REMOTE HOST IDENTIFICATION HAS CHANGED` error
    • Fixing a non-replicated disk failure
    • Resolving connection issues with Kosmos VM
    • Resolving password reset issues for VMs based on a Kosmos image
    • Resolving the `The limit on maximum number of cores has exceeded` error
    • CUDA unavailable on GPU platform
    • Resolving issues with performance of disk and network input/output on a VM
    • Resolving the `FAILED_PRECONDITION Relocation to zone `ru-central1-a/b/c` is disabled` error
    • Options to migrate a VM image to Yandex Cloud
    • How to change a boot disk type for a VM
    • How to get details about RAM consumption for Compute Cloud VMs
    • How to create VMs with multiple network interfaces
    • How to reduce the VM disk size
    • How to export Compute Cloud VM disk images
    • How to move a VM across folders or clouds
    • How to set up GUI and graphical environment on VMs running Linux
    • How to use an ISO image for deploying VMs
    • How to view incoming or outgoing traffic logs for a VM
    • How to use WinSCP to connect to a Linux VM in Yandex Cloud with a key generated on VM creation
    • How to back up a VM with rollback support
    • How to connect over SSH as root with `-X` or key
    • How to monitor memory usage
    • How to change an internal IP address
    • How to read the `Connections quota utilization` chart
    • How to check the disk access speed for a VM
    • How to create a VM instance with password access
    • How to increase the number of network connections
    • How to secure RDP connections on Microsoft Windows®

In this article:

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

Restoring access to a VM with a lost SSH key

Written by
Yandex Cloud
Updated at December 17, 2025
  • Issue description
  • Solution

Issue descriptionIssue description

You lost the SSH key you used to connect to a VM.

SolutionSolution

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

If your Linux user has no password, you can create a disk snapshot from the VM in question, 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, follow these steps:

  1. Create a new disk from the snapshot of the VM in question.
  2. Attach it as a secondary disk to a different VM.
  3. Change the root directory using chroot.
  4. Modify the configuration files that affect VM accessibility, e.g., set a new password using the sudo passwd $USERNAME command, where $USERNAME is the name of the Linux user to set a password for.
  5. Detach the secondary 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 on your VM, you can use the serial console. For detailed information, follow this guide.

After enabling the serial console, connect to the VM in question. We recommend connecting through the CLI.

Was the article helpful?

Previous
Fixing the "Not enough resources" error on launching a virtual machine
Next
Resolving issues with creating disk snapshots
© 2025 Direct Cursus Technology L.L.C.