All Products
Search
Document Center

Elastic Compute Service:Transfer files to a Linux instance using WinSCP

Last Updated:Jun 04, 2026

If your on-premises computer runs Windows, you can install WinSCP to remotely connect to a Linux ECS instance and transfer files through a graphical interface.

What is WinSCP?

Unlike FTP, WinSCP lets you access the server directly with your server account, requiring no server-side configuration.

Scenarios

  • Upload files: Upload files from a Windows computer to a Linux instance.

  • Download files: Download files from a Linux instance to a Windows computer.

Limits

  • File size: No limit.

  • Transfer speed: No limit.

  • Number of files: No limit.

  • Network requirements: The instance must have a public IP address or an elastic IP address.

Important

WinSCP runs only on Windows. If you use Linux or macOS, you must use other file transfer methods. For more information, see Select a file transfer method.

Prerequisites

  • The instance must be in the Running state.

    Check the instance status

    On the Instances page of the ECS console, verify that the instance status is Running.

    For more information about how to view the instance status, see View instance information.
  • A public IP address is required to connect to the instance.

    Obtain the public IP address of the instance

    Find the instance's public IP address on the Instances page in the ECS console.

    For more information about how to view instance information, see View instance information. For more information about how to assign a public IP address, see Assign a public IP address.
  • Make sure the instance's security group allows inbound traffic on port 22, the default for SCP and SFTP.

    Security group settings required for this procedure

    This procedure uses WinSCP to transfer files to a Linux instance over SFTP. You must add an inbound rule to the security group of the instance to allow traffic on the SFTP port. The default port is 22. For more information about how to add a security group rule, see Add a security group rule.

    Action

    Priority

    Protocol type

    Port range

    Authorization object

    Allow

    1

    Custom TCP

    The port for your SFTP service. The default is 22.

    Your on-premises computer's public IP address or CIDR block.

    Warning

    Setting the authorization object to 0.0.0.0/0 allows access from all IP addresses, which is a security risk. Avoid this setting.

    To find your computer's IP address, visit https://cip.cc/.

    For example, the public IP address of your on-premises computer is 118.xxx.xxx.xx8.

Procedure

Important

To improve transfer efficiency for large or numerous files, compress them into a single package before uploading. For more information, see Compress and upload files.

Step 1: Connect to the instance with WinSCP

  1. On your Windows computer, download and install WinSCP.

    For more information, visit the official WinSCP website.

  2. Start WinSCP. The Login dialog box opens.

  3. In the Session section, configure the following parameters.

    The following list describes the parameters.

    • File protocol: Select SFTP or SCP.

    • Host name: The public IP address of the Linux ECS instance.

    • Port number: The default value is 22.

    • User name: The username for the instance. The default is root.

    • Password: The password for your instance.

      Note

      If you forget the password of your Linux ECS instance, you can reset the password. For more information, see Reset the logon password of an instance.

      Log on to an instance by using a key pair

      If you use a key pair as logon credentials, perform the following steps to configure the key pair:

      1. In the Session section, click Advanced....

      2. In the Advanced Site Settings dialog box, choose SSH > Authentication in the left-side navigation pane. In the private key file section, select the private key file that corresponds to your Linux instance, and then click OK.

      3. You can then log on to the instance without entering a password.

    Click Save to store this connection information for future use.

  4. Click Login.

    The WinSCP file transfer window opens.

Step 2: Upload or download files

On the WinSCP file transfer page, the left pane displays your local directories, and the right pane displays the instance's directories.

  • Upload files to an ECS instance

    Drag files from the left pane to the right pane to upload the files to the ECS instance.

    For example, the directory in the left pane is C:\Users\Administrator\Documents\ and contains the test.txt file to upload. The directory in the right pane is /home/ecs-user/.

  • Download files to your on-premises computer

    Drag files from the right pane to the left pane to download the files from the ECS instance to your on-premises computer.

FAQ

Transfer files with sudo

If you log on to an instance as a non-root user such as ecs-user, you need sudo permissions to access some directories. In this scenario, you must configure the following settings when you connect to the instance:

  1. Find the path of the sftp-server on the ECS instance.

    1. Log on to the instance.

      This example uses Workbench to log on to the instance. For more information, see Use Workbench to connect to a Linux instance.
    2. Run the following command to query the path of the sftp-server:

      sudo cat /etc/ssh/sshd_config |grep -i sftp-server

      The required path is returned in the command output.

      [ecs-user@ixxx xxx Z ~]$ sudo cat /etc/ssh/sshd_config |grep -i sftp-server
      Subsystem       sftp    /usr/libexec/openssh/sftp-server
      [ecs-user@ixxx xxx Z ~]$
  2. When you configure the logon information in WinSCP, configure the SFTP server in the Premium dialog box.

    1. Click Premium to open the Advanced Site Settings dialog box.

    2. In the SFTP section, configure the SFTP server.

      sudo su -c <Path of the sftp-server that you obtained in Step 1>

      For example, if the path of the sftp-server is /usr/libexec/openssh/sftp-server, enter the following content in the field:

      sudo su -c /usr/libexec/openssh/sftp-server
    3. Click OK and then log on to the instance.

Why are file transfers that use WinSCP slow or unstable?

WinSCP transfers data directly between your on-premises computer and the instance, so your network conditions affect transfer speed and stability. Try switching to a different network. Alternatively, use Object Storage Service (OSS) as an intermediary to transfer files. Data transfers over the internal network to or from OSS are free of charge. For more information, see Use OSS to transfer files to an instance.

Related topics

  • After uploading important files to an ECS instance, consider creating a snapshot to back them up. For more information, see Create a manual snapshot.

  • This guide covers file transfers between a Windows computer and a Linux instance. To transfer files to a Windows instance, you must use a different method. For more information, see Select a file transfer method.

  • You can also use OSS to store and manage files. For more information, see OSS Quick Start.