标签:host author stdout ftp set ssi import stderr result
# -*- coding:utf-8 -*-
# Author: Dennis Huang
__Author__ = "Dennis"
import paramiko
# ssh = parammiko.SSHClient()
# ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
# ssh.connect(host="192.168.12.12",port = 22,username = "aaa",password = "aaa")
#
#
# ## stdout和stderr,只有一个有结果,另一个为空
# stdin,stdout,stderr = ssh.exec_command("df")
#
# result = stdout.read()
hostname = "192.168.12.12"
transport = paramiko.Transport((hostname,22))
transport.connect(username = "aa",password = "aa")
sftp = paramiko.SFTPClient.from_transport(transport)
sftp.put(‘/tmp/aaa.txt‘,‘/tmp/bbb.txt‘)
sftp.get(‘/tmp/aaa.txt‘,‘/tmp/bbb.txt‘)
transport.close()
标签:host author stdout ftp set ssi import stderr result
原文地址:http://www.cnblogs.com/dennnnnis/p/7455632.html