How to use paramiko to transfer files between two remote servers?

狂风中的少年 提交于 2019-12-11 16:59:09

问题


Please let me know how do I use paramiko module to transfer files between two remote hosts.

I have seen that 'get' method will get the files from remote host to local host. 'put' method will put the local files to some remote host.

Is there any method that combines 'get' and 'put' methods i.e.get files from remote host and put it in remote host. This request will get initiated from localhost.


回答1:


Paramiko.sftp_client.SFTPClient provides SFTP (Secure File Transfer Protocol) features to move files between computers. After starting an sftp session via

ssh = client.open_sftp(),

you can access all of these methods.

If you just want to move files on the remote host, then you can use "local" file transfer methods with shutil. Hope that helped!



来源:https://stackoverflow.com/questions/47584192/how-to-use-paramiko-to-transfer-files-between-two-remote-servers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!