Python通过paramiko连接Linux服务器

#!/usr/local/bin/python
#encoding:utf-8

import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('59.110.12.72', 22, username='niu', password='123456', timeout=4)
#stdin, stdout, stderr  = client.exec_command('cd /proc;cat meminfo')
stdin, stdout, stderr  = client.exec_command('cat /proc/meminfo')
print stdout.read()
client.close()

你可能感兴趣的:(Python)