VK Cloud logo
Updated at December 20, 2023   05:58 AM

Connecting to a Linux VM

The recommended way to connect to a Linux VM is via SSH using a key pair.

1. Check the ability to connect via SSH

To connect via SSH, an SSH server must be running on the virtual machine. On Linux virtual machines created in VK Cloud, the OpenSSH server is installed and started by default.

Before connecting, make sure that the following conditions are met:

  • the virtual machine is running and the OS boot process has finished;

  • remote access via SSH protocol (TCP port 22) is allowed in the VM network settings — add ssh security group;

  • the VM has an external (“floating”) IP address available for connection.

Instead of an external IP address, you can use the fully qualified domain name of the virtual machine (FQDN). Properly configured DNS records are required to connect using a fully qualified domain name.

The virtual machines that were created from the FreeBSD and Bitrix images offered by the VK Cloud platform do not support working with an external ext-net network. To connect via SSH to such a VM, it is necessary that it is on a private network with DHCP enabled.

If SSH connection to the VM is not possible or unavailable, use the VNC console.

2. Select the user name

Determine the user name (login) of the operating system that is deployed on the target VM.

In VK Cloud images (except Bitrix), the root account is blocked for security reasons and a default account has been added:

Operating system
Username
AlmaLinux
almalinux
ALT Linux
altlinux
Astra Linux
astra
Bitrix
root
CentOS
centos
Debian
debian
Fedora
fedora
FreeBSD
freebsd
openSUSE
opensuse
Ubuntu
ubuntu
RED OS
redos

3. Check for a key pair

To connect to a VM over SSH using a key pair, it is necessary that the public key is stored on the virtual machine in the file ~/.ssh/authorized_keys, and the file with the private key is located on the computer from which the connection is being made.

If the VM was created on the VK Cloud platform:

  • the public key was saved on the VM automatically;
  • when selecting the option Create a new key, the private key in the file with the extension .pem was downloaded to the computer from which the VM was created.

If one or both of the keys from the pair are lost, follow the recovery instructions.

4. Connect to the VM

  1. (Optional) Configure access rights to the key file:

    chmod 400 <key path>
  2. Run the command in the terminal.

    • To connect by IP address:

      ssh -i <key path> <username>@<external IP address of the virtual machine>
    • To connect by a fully qualified domain name:

      ssh -i <key path> <username>@<FQDN of the virtual machine>
  3. If this is the first connection to the VM, a confirmation request will appear:

    The authenticity of host '213.219.212.130 (213.219.212.130)' can't be established.ECDSA key fingerprint is SHA256:aYZIWs9N6KRtfFOuic6eoWcluhSp6+jha/DSBgd9McI.Are you sure you want to continue connecting (yes/no)?

    Type yes in the terminal and press Enter.