Notes dev python3 paramiko

import paramiko host = '192.168.1.33' port = 22 username = 'root' key_file = '/home/jean/.ssh/id_rsa' key_passphrase='plop' my_key = paramiko.RSAKey.from_private_key_file(key_file, password=key_passphrase) transport = paramiko.Transport((host, port)) transport.connect(username=username, pkey=my_key) sftp = paramiko.SFTPClient.from_transport(transport) print(sftp.listdir()) sftp.get('PLOP.txt', 'PLOP.txt') # Close connections sftp.close() transport.close()