python run scp command

Solutions on MaxInterview for python run scp command by the best coders in the world

showing results for - "python run scp command"
Nicolás
17 Jan 2016
1import paramiko
2from scp import SCPClient
3
4def createSSHClient(server, port, user, password):
5    client = paramiko.SSHClient()
6    client.load_system_host_keys()
7    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
8    client.connect(server, port, user, password)
9    return client
10
11ssh = createSSHClient(server, port, user, password)
12scp = SCPClient(ssh.get_transport())