Document navigation

Access a VM

You can access a VM through the console to install or configure the operating system, view the boot process, or troubleshoot issues when the VM is unreachable over the network. For a Linux VM with network connectivity and the SSH service enabled, you can use SSH for routine command-line administration.

You can also configure console access methods and operating system login authentication to meet your access needs.

Access a VM by Using the Console

Use the console to quickly access a VM and perform operations such as installing the operating system, configuring the operating system, running commands, and starting applications.

Before you begin

  • The VM must be running.
  • (Optional) Configure the console mode and console password as needed. For more information, see Configure Remote Access.
  • (Optional) Set a proxy address to access the VM console through the proxy address. For more information, see Console Proxy Management.

Procedure

  1. In the navigation pane, choose Inventory > VM and Host.
  2. Select the target VM and click Launch Console.
    The console opens in a new browser tab.
  3. Click anywhere inside the console window to start using your mouse, keyboard, and other input devices in the console.
  4. Quick-access buttons are available in the left sidebar of the console window.
    • Local Command Paster: Click this button to open the paste command dialog. Paste the command to run into the dialog, and then click OK to run it in the console.
    • Tools: Provides hotkeys, including Ctrl, Alt, Win, Tab, Esc, and Ctrl+Alt+Del.
    • Power Management: Allows you to manage VM power status directly in the console. Actions include Shut Down, Reboot, Resume, Pause, and Power Off.
    • Settings: Allows you to enable or disable read-only mode. When read-only mode is enabled, you cannot run commands or perform other operations in the console window.

Access a VM by Using SSH

Use SSH to access a VM.

Before you begin

  • Your local computer, as the login client, has network connectivity and root access to the target VM.
  • (Optional) Configure SSH key-based password-free login and the VM password as needed. For more information, see Configure Login Authentication.

Procedure

  1. On your local computer, use remote login software to log in to the VM directly.
    # ssh root@192.0.2.1
    root@192.0.2.1's password:
    Last login: Mon Sep 24 12:05:36 2021
    root~#
  2. To log in to the VM by using an SSH private key, first add the SSH public key to the target VM, and then run the following command from the login client:
    # ssh -i ${private_key.pem} ${UserName}@${IpAddress}
    Here, ${private_key.pem} is the private key file path, ${UserName} is the login user name, and ${IpAddress} is the IP address of the target VM.

Configure Remote Access

Before you begin

To configure remote access, make sure the VM is stopped.

Procedure

  1. On the target VM page, click Advanced Settings.
  2. On the Advanced Settings tab, select Remote Access.
  3. Click Edit and configure the console mode and console password as needed.

    Remote access includes the following settings:

    Option Description
    Console Mode Select the protocol type used to connect to the VM console:
    • VNC: Supports both Linux and Windows. It is mainly used for Linux server management, with typical network traffic of about 100 KB.
    • SPICE: Supports Linux and provides better color, audio, video, and USB capabilities. It is mainly used for virtual desktop applications, with typical network traffic of about 10 MB to 20 MB. In this mode, you can configure the number of connected displays and the video streaming mode, including off, all, and filter.
    • VNC+SPICE: Supports both VNC and SPICE protocols. In this mode, you can configure the number of connected displays and the video streaming mode, including off, all, and filter.
    Console Password Sets the console password.
    • Character requirements: Only letters, numbers, and the following special characters are supported: -`=[];',./~!@#$%^&*()_+|{}:"<>?
    • Length requirements: 6 to 8 characters.

    The VNC console supports password strength settings.

Configure Login Authentication

Before you begin

  • Before setting an SSH public key, install VMTools (cloud-init). Recommended versions are 0.7.9, 17.1, 19.4, or later.
  • Before changing a VM password, make sure the VM is running and QEMU Guest Agent (QGA) is installed and running properly.

Procedure

  1. On the target VM page, click Advanced Settings.
  2. On the Advanced Settings tab, select Login Authentication.
  3. Click Set SSH Key or Change VM Password.

    Login authentication includes the following settings:

    Option Description
    Set SSH Key
    1. After cloud-init is installed, SSH password authentication is disabled by default. Set ssh_pwauth to 1 in /etc/cloud/cloud.cfg to enable SSH password authentication.
    2. Run the ssh-keygen command to generate an SSH key. The public key is stored in /root/.ssh/id_rsa.pub by default.
    3. Copy and paste the file content into the SSH Key input field.
    Note:
    • When an SSH key is injected during VM creation, it takes effect after the first boot.
    • When an SSH key is injected into an existing VM for the first time, restart the VM for the key to take effect.
    • To reinject an SSH key into an existing VM that already has an injected SSH key, run rm -rf /var/lib/cloud/instances to clear previous configuration, inject the new SSH key, and restart the VM for the key to take effect.
    • Deleting an SSH key only deletes the SSH key record from the system. It does not delete SSH key information already injected into the VM configuration. To completely delete the SSH key information, manually clean up /root/.ssh/authorized_keys.
    Change VM Password
    Note:
    If you select the option to prevent the platform from changing passwords through QGA in the Windows VMTools installation wizard, you cannot change this VM's password through QGA on the platform.
    1. Modify the login name option, including system default and custom login name.

      The default login name is root for Linux and Administrator for Windows.

    2. Set a new password.
      • Character requirements: Only letters, numbers, and the following special characters are supported: -`=[];',./~!@#$%^&*()_+|{}:"<>?

        VM password strength settings are supported.

Console Proxy Management

The console proxy is used to access VM consoles through a proxy address. By default, the proxy address is the management node IP address. When the management node is deployed in a NAT, public network access, or domain-name access scenario, modify the console proxy address and port according to the actual access path.

If a VM console fails to open, reconnect the console proxy first. After the status changes back to Connected, open the VM console again.

Common Entry

In the navigation pane, choose System Management > Console Proxy to go to the Console Proxy page.

Common Operations

Operation Description
View Proxy Address View the console proxy address. The default proxy address is the IP address of the management node.
Reconnect Console Proxy If a VM console fails to open, click Reconnect on the Console Proxy page. After the status changes to Connected, you can open the console normally.
Modify Proxy Address Click Modify Proxy Address to modify the address and port as needed. You can enter the public IP address of the management node, a NAT address, or a domain name as the console proxy address. The change takes effect immediately and does not require a management node restart.