All Products
Search
Document Center

Elastic Compute Service:Connect to a Windows instance by using a username and password from a third-party client

Last Updated:May 14, 2024

You can connect to a Windows Elastic Compute Service (ECS) instance by using a username and password from an on-premises client that runs a Windows, Linux, or macOS operating system. This topic describes how to connect to a Windows instance from an on-premises client.

Prerequisites

  • The instance to which you want to connect is in the Running state. If the instance is not in the Running state, start the instance. For more information, see Start an instance.

  • A logon password is specified for the instance. If you did not specify a password or if you forgot your password, you must reset the password for the instance. For more information, see Reset the logon password of an instance.

  • The instance can access the Internet:

  • The rules described in the following table are added to the security group to which the instance belongs. For more information, see Add a security group rule.

    Network type

    Rule direction

    Action

    Port range

    Priority

    Authorization object

    VPC

    Inbound

    Allow

    • To open the default port 3389 on the Windows instance, select RDP (3389).

    • To open other ports on the Windows instance, enter a port range.

    1

    The public IP address of your on-premises client, not the public IP address of the instance.

    Important

    You can specify 0.0.0.0/0 as the authorization object to allow inbound access from all IP addresses. However, this exposes your instance to security risks. Proceed with caution.

    Classic network

    Internet ingress

Connect to a Windows instance

Use one of the following methods based on the operating system of your on-premises client to connect to a Windows instance.

Connect from an on-premises client that runs a Windows operating system

If your on-premises client runs a Windows operating system, you can use Windows built-in Microsoft Terminal Services Client (MSTSC) to connect to a Windows instance from the client.

  1. Use one of the following methods to start Remote Desktop Connection (MSTSC):

    • Choose Start > Windows Accessories > Remote Desktop Connection.

    • Click the Start icon, enter mstsc in the search box, and then press the Enter key.

    • Press Win (Windows logo key)+R to open the Run dialog box, enter mstsc, and then press the Enter key.

  2. In the Remote Desktop Connection dialog box, perform the following steps:

    1. Click Show Options.

    2. In the Computer field, enter the public IP address or EIP of the instance.

    3. In the User name field, enter a username. The default username is Administrator.

      If you do not want to manually enter your username and password the next time you connect to the instance, you can select Allow me to save credentials.

    4. (Optional) If you want to copy files from your on-premises client to the instance, click the Local Resources tab to view the options for sharing on-premises computer resources.

      • If you want to copy only text, select Clipboard.

      • If you want to copy files, click More..., select Drives, and then select the letters of the drives from which you want to copy files.

    5. (Optional) If you have specific requirements on the size of the remote desktop window, click the Display tab to resize the remote desktop window. We recommend that you use Full Screen.

    6. Click Connect.

    7. In the Remote Desktop Connection dialog box that displays the "Do you trust this remote connection?" message, click Connect.

Connect from an on-premises client that runs a Linux operating system

If your on-premises client runs a Linux operating system, you can use a remote connection tool to connect to a Windows instance from the client. In this example, rdesktop and an instance that runs a CentOS 7.9 operating system are used.

Important

You must install a GUI on your Linux client. For information about how to install a GUI on your Linux client, see Installing a graphical desktop environment for a Linux instance.

  1. Run the following commands to download and install rdesktop:

    sudo yum -y install epel-release
    sudo wget http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
    sudo rpm -Uvh nux-dextop-release*rpm
    sudo yum install rdesktop -y
  2. Run the following command to connect to the Windows instance.

    Important

    The command must be run in a GUI.

    The sample command is only for reference. Configure the parameters in the command based on your business requirements.

    rdesktop -u administrator -p password -f -g 1024*720 192.168.1.1 -r clipboard:PRIMARYCLIPBOARD -r disk:sunray=/home/yz16184

    The following table describes the parameters.

    Parameter

    Description

    -u

    The username to use to log on to the Windows instance. The default username is Administrator.

    -p

    The password to use to log on to the Windows instance.

    -f

    The full-screen mode. You can press Ctrl+Alt+Enter to switch the mode.

    -g

    The screen resolution. An asterisk (*) is used between the pixel width and height. This parameter can be left empty. If this parameter is not specified, the full-screen mode is used.

    192.168.1.1

    The IP address of the instance to which you want to connect. Set this parameter to the public IP address or EIP of your Windows instance.

    -d

    The domain name. For example, if the domain name is INC, set this parameter to -d inc.

    -r

    Multimedia redirection. Examples:

    • -r sound: turns on sound.

    • -r sound : local: uses a local sound card.

    • -r disk:usb=/mnt/usbdevice: enables the USB flash drive.

    -r clipboard:PRIMARYCLIPBOARD

    Allows text, including Chinese characters, to be copied between the on-premises client that runs a Linux operating system and the Windows instance.

    -r disk:sunray=/home/yz16184

    Maps a directory on the on-premises client that runs a Linux operating system to a disk on the Windows instance. This eliminates the need for Samba and FTP to transfer files.

Connect from an on-premises client that runs a macOS operating system

For information about how to connect to a Windows instance from an on-premises client that runs a macOS operating system, see Get started with the macOS client in the Microsoft official documentation.

References

If you do not want to connect to a Windows instance by using a username and password from an on-premises client, you can log on to the ECS console and then log on to the Windows instance by using Workbench. For more information, see Connect to a Windows instance by using a password or key.