Connecting to a VM's serial console via CLI

After enabling access, you can connect to the serial console to work with the VM. Serial console access is not secure, so enabling it might allow hackers to access your VM. Disable access after you finish working with the serial console.

Connecting to the serial console


How the serial console works depends on the operating system settings. Compute Cloud provides a communication channel between the user and COM port on the VM, but it doesn't guarantee that the console works properly on the operating system.

To connect to the serial console, use the CLI.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View the description of the CLI command for connecting to the serial console:

    $ yc compute connect-to-serial-port --help
  2. Get a list of VMs in the default folder:

    $ yc compute instance list
    |          ID          |       NAME      |    ZONE ID    | STATUS  |     DESCRIPTION      |
    | fhm0b28lgfp4tkoa3jl6 | first-instance  | ru-central1-a | RUNNING | my first vm via CLI  |
    | fhm9gk85nj7gcoji2f8s | second-instance | ru-central1-a | RUNNING | my second vm via CLI |
  3. Select the ID or NAME of the VM (for example, first-instance).

  4. Connect to the Linux serial console:

    $ yc compute connect-to-serial-port \
         --instance-name first-instance \
         --ssh-key ~/.ssh/id_rsa

    Or to Windows SAC:

    $ yc compute connect-to-serial-port \
         --instance-name first-instance \
         --port 2
    Parameter Value
    instance-name Required parameter. Name of the instance.
    user Optional parameter. User name. If this parameter is omitted, the default yc-user user will be used. The yc-user user is generated automatically when the VM is being created. Learn more in Creating a VM from a public Linux image.
    port Optional parameter. Port number to connect to the serial console. The default value is 1. You don't need to specify this parameter to connect to the Linux serial console. When connecting to the Windows serial console (SAC), pass the value 2.
    ssh-key Optional parameter. Path to the private key for SSH access to the Linux VM to be added to the metadata. If this parameter is omitted, the yc_serialssh_key SSH key is generated.


  • If you connect to the serial console and nothing appears on the screen:
    • Press Enter.
    • Restart the VM (for virtual machines created before February 22).
  • If the system requests user data to provide access to the VM, enter the login and password.

Disconnecting from the serial console

To disconnect from the serial console:

  1. Press Enter.
  2. Enter the following characters in order: ~..