我使用 MAC 作为我的本地计算机,我的远程计算机是 Ubuntu-AWS 计算机。我使用以下命令将文件传输到远程计算机。我希望将我的 python 文件 p1.py 传输到远程计算机,位置为/usr/share/
sftp -i test1.pem <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="88fdeafde6fcfdc8bdbca6f0f0a6f0f0a6f0f0" rel="noreferrer noopener nofollow">[email protected]</a>:/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 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2c594e594258596c1918025454025454025454" rel="noreferrer noopener nofollow">[email protected]</a>:/usr/share/
使用交互式控制台
然后在控制台
> put /tmp/p1.py
您还可以使用
scp -i <identity_file> /tmp/p1.py <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8bfee9fee5fffecbbebfa5f3f3a5f3f3a5f3f3" rel="noreferrer noopener nofollow">[email protected]</a>:/usr/share/
。
确保您具有对/usr/share
的写入权限 执行 scp 时的文件夹。
关于ubuntu - 使用 SFTP 将文件从本地计算机传输到远程计算机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42390974/