Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1688566
  • 博文数量: 362
  • 博客积分: 10587
  • 博客等级: 上将
  • 技术积分: 4098
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-10 18:15
文章分类

全部博文(362)

文章存档

2014年(1)

2013年(58)

2011年(115)

2010年(112)

2009年(76)

分类: Python/Ruby

2011-09-08 15:23:08

#!/usr/bin/env python
import paramiko

if __name__=='__main__':
    paramiko.util.log_to_file('paramiko.log')
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh.connect('192.168.1.2', username='root', password='secret')
    stdin, stdout, stderr = ssh.exec_command('df -h')
    print stdout.readlines()
    ssh.close()
阅读(4113) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~