Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • 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:

  • Case description
  • Solution
  1. Compute Cloud
  2. How to connect over SSH as root with `-X` or key

How to connect via SSH as root with a password or key

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

Case descriptionCase description

You need to connect via SSH as root with a password or key.

SolutionSolution

Connecting with a key
Connecting with a password

When connecting with a key, the /root/.ssh/authorized_keys file must contain only the key. Delete everything preceding the key, if any.

To connect via SSH with a password:

  1. Create a password for root using the sudo passwd root command.

  2. The /root/.ssh/authorized_keys file must be empty or contain only the key. If the key does not match, the file will prompt you to enter a password.

  3. The /etc/ssh/sshd_config.d/50-cloud-init.conf file must contain:

    PasswordAuthentication yes
    PermitRootLogin yes
    

Was the article helpful?

Previous
How to back up a VM with rollback support
Next
How to monitor memory usage
© 2025 Direct Cursus Technology L.L.C.