使用 SFTP 将文件从本地机器传输到远程机器

Transfer file from local machine to remote machine using SFTP

我使用 MAC 作为我的本地机器,我的远程机器是 Ubuntu-AWS 机器。我使用以下命令将文件传输到远程 machine.I 希望将我的 python 文件 p1.py 传输到位置为 /usr/share/

的远程计算机
sftp -i test1.pem ubuntu@54.xx.xx.xx:/usr/share/  /tmp/p1.py

但是给了我以下错误

Connected to 54.xx.xx.xx
Fetching /usr/share/ to /tmp/p1.py
Cannot download non-regular file: /usr/share/

可能是什么问题?

您可以通过
sftp -i test1.pem ubuntu@54.xx.xx.xx:/usr/share/
使用交互式控制台,然后在控制台
> put /tmp/p1.py

您也可以使用
scp -i <identity_file> /tmp/p1.py ubuntu@54.xx.xx.xx:/usr/share/

确保您在执行 scp 时对 /usr/share 文件夹具有写入权限。