python
2016-05-16 21:40
211 查看
import threading import paramiko import subprocess def ssh_command(ip,user,passwd,command): client = paramiko.SSHClient() #client.load_host_keys('/home/justin/.ssh/known_hosts') client.set_missiing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(ip,username=user,password=passwd) ssh_session = client.get_transport().open_session() if ssh_session.active: ssh_session.exec_command(command) print ssh_session.recv(1024) return ssh_command('192.168.111.121','justin','lovethepython','id')
本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1774084
相关文章推荐
- python学习笔记4-python文件操作
- Python数据处理相关小例编程
- python的web问题
- python的web问题
- 打包Python程序为exe文件
- python用箱型图进行异常值检测
- py 4000 thon 时间差 datetime strptime
- python冒泡排序
- Python 线程学习
- Python 脚本注册为Windows Service
- Python WSGI
- 在python中编写caffe的prototxt文件
- Python - 两圆相交求交点坐标
- 《python程序设计》第二章基本程序设计笔记
- 《python语言程序设计》第一章python概述 笔记
- Python With
- 远程访问jupyter notebook
- python遍历文件夹
- Python使用lxml模块和Requests模块抓取HTML页面的教程
- 登录知乎的爬虫