Transfer files to your Linux instance using the PuTTY secure replication client
The PuTTY Secure replication client (PSCP) is a command-line tool that you can use to transfer files between a Windows computer and a Linux instance. If you prefer a graphical user interface (GUI), you can use an open-source GUI tool called "WinSCP". For more information, see Transfer files to your Linux instance using WinSCP.
To use PSCP, you will need to convert the private key generated in your private key using PuTTYgen. You also need a public DNS address for your Linux instance.
The following example Sample_file.txt
transfers a file from a Windows computer to a directory in a Linux instance /usr/local
:
c:\> pscp-i C:\KEYS\MY-KEY-PAIR.PPK C:\Sample_file.txt [email protected]_dns:/usr/local/sample_file.txt
In practice, the example uploads all content under the e:/class/weimi/ folder to /home/wwwroot/weimi .
Pscp-i C:\Users\Administrator\Desktop\amazon\my-key-pair.ppk-r "e:/class/weimi/" [Email protected]:/home/wwwroot/ Weimi
PSCP detailed
http://ihuangweiwei.iteye.com/blog/1181062
Transfer files to your Linux instance using WinSCP
WinSCP is a GUI-based file manager for Windows that allows you to upload and transfer files to a remote computer using the SFTP, SCP, FTP, and FTPS protocols. With WinSCP, you can drag and drop files from a Windows computer onto a Linux instance or synchronize all directory structures between the two systems.
To use WinSCP, you will need to convert the private key generated in your private key using PuTTYgen. You also need a public DNS address for your Linux instance.
Download and install WinSCP from http://winscp.net/eng/download.php. For most users, the default installation option is available.
Start WinSCP.
In the WinSCP login (WinSCP login) screen, for host name (hostname), enter the public DNS address of the instance.
For user name (username), enter the default AMI user name. For Amazon Linux Amis, the user name is ec2-user
. For Red Hat Amis, the username is root
, and for Ubuntu Ami, the user name is ubuntu
.
Specify a private key for your instance. For private key, enter the path to your private key or click... button to browse for the file. For the WinSCP version of the update, you need to click Advanced to open the premium site settings, and then under SSH , click Authentication (authentication) to find the Private The key file (private key files) setting.
Note
WinSCP requires PuTTY private key file ( .ppk
). You can use PuTTYgen to .pem
convert the security key file into a .ppk
format. For more information, see Convert your private key using PuTTYgen.
Optionally, in the left panel, click Remote directory (directory), and for directories (remote directory), enter the directory path where you want to add the file. For an updated version of WinSCP, you need to click Advanced to open the premium site settings, and then under Environment (Environment) , click Directories (directory) Look for remote directory settings.
Click login to connect, and then click Yes to add the host thumbprint to the host cache.
650) this.width=650; "Src=" https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/images/ Winscp-connection.png "alt=" Winscp-connection.png "/>
After the connection is established, in the Connection window, your Linux instance appears on the right and the local computer appears on the left. You can drag and drop files directly from the local computer to the remote file system. For more information on WinSCP, see the project documentation in Http://winscp.net/eng/docs/start.
Note
If you receive an " Cannot execute SCP to starttransfer
" error, you must first install the SCPon your Linux instance. For some operating systems, this command is in the openssh-clients
package. For Amazon Linux variants (such as Amazon ECS-optimized Amis), install the SCPusing the following command.
[Ec2-user ~]$ sudo yum install-y openssh-clients
Transfer files to your Linux instance using the PuTTY secure replication client