파이썬 paramiko
-
[Python] paramiko를 이용한 리눅스 sftp 다운로드Python/Python for Linux 2018. 5. 13. 23:44
파이썬 paramiko 모듈를 이용한 sftp 다운로드 import paramiko transport = paramiko.Transport(host, 22) transport.connect(username = '', password = '') sftp = paramiko.SFTPClient.from_transport(transport) sourcefilepath = 'path+file' localpath = 'path+file' sftp.get(sourcefilepath, localpath) sftp.close() transport.close()
-
[Python] paramiko를 이용한 linux(리눅스) ssh 접속Python/Python for Linux 2018. 5. 13. 22:58
parkmiko : SSH2 연결 라이브러리 import paramiko ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('host', username='', password='') stdin, stdout, stderr = ssh.exec_command('echo this is paramiko') stdin.close() for line in stdout.read().splitlines(): print(line.decode()) ssh.close() this is paramiko