scp的Python项目详细描述

实现示例代码

from paramiko import SSHClient 
from scp import SCPClient 
ssh=SSHClient()
ssh.load_system_host_keys()
ssh.connect('example.com')
# SCPCLient takes a paramiko transport as an argument
scp=SCPClient(ssh.get_transport())
scp.put('test.txt','test2.txt')
scp.get('test2.txt')
# Uploading the 'test' directory with its content in the
# '/home/user/dump' remote directory
scp.put('test',recursive=True,remote_path='/home/user/dump')scp.close()
posted @ 2021-12-22 16:38  Jurioo  阅读(116)  评论(0)    收藏  举报