All Products
Search
Document Center

:How do I upload files and folders to a Linux instance by using SSH?

Last Updated:Aug 06, 2021

Overview

This topic describes how to upload files and folders to a Linux instance by using SSH.

Background information

Take note of the following items:

  • Before you perform high-risk operations such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including Elastic Compute Service (ECS) and ApsaraDB RDS instances. We recommend that you create snapshots or enable RDS log backup before you modify instance configurations or data.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify the information in a timely manner.

Perform the following operations:

Upload a file to the Linux instance

Run the following command to upload the file to the specified directory:

scp [$File_name] [$Username]@[$IP]:[$File]

Note:

  • [$File_name] indicates the file name.
  • [$Username] indicates the username of the instance.
  • [$IP] indicates the IP address of the instance.
  • [$File] indicates the specified directory of the instance.

Upload a folder to the Linux instance

Run the following command to recursively upload the entire directory:

scp -r [$Folder] [$Username]@[$IP]:[$File]

Note: [$Folder] indicates the folder name. Add -r in front of [$Folder]. Otherwise, an error is prompted.

Applicable scope

  • ECS