#!/usr/bin/env python
import paramiko
import sys,os
hostname='192.168.1.62'
username='root'
password='password'
cmd='free -m'
pkey_file='/root/.ssh/id_rsa'
paramiko.util.log_to_file('syslogin.log')
t = paramiko.Transport((hostname,22))
key = paramiko.RSAKey.from_private_key_file(pkey_file)
t.connect(username=username,pkey=key)
sftp = paramiko.SFTPClient.from_transport(t)
sftp.get('/tmp/aaa','abc')
sftp.put('/tmp/bbb','/tmp/bbb')
t.close()