#!/usr/bin/env python import paramiko import sys,os hostname='192.168.1.60' #sys,argv[1] username='root' password='password' cmd='free -m' #cmd=sys.argv[2] def findkdy(): paramiko.util.log_to_file('syslogin.log') ssh=paramiko.SSHClient() ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(hostname=hostname,port=22,username=username,password=password,timeout=5) stdin,stdout,stderr=ssh.exec_command(cmd) print stdout.read(),stderr.read() ssh.close()