Python 模块paramiko简单使用方法
2013-06-20 18:18
831 查看
Python模块paramiko可以实现用SSH登录服务器,并执行shell
#!/usr/bin/python
import
sys
import
paramiko
def
pycmd(server,port,username,password,shellcmd):
ssh
=
paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()
ssh.connect(server,port,username,password)
stdin,stdout,stderr
=
ssh.exec_command(shellcmd)
stdout.readlines()
ssh.close()
if
_name__
=
=
"__main__"
:
pycmd(
"xxx.xxx.xxx.xxx"
,
22
,
"root"
,
"password"
,sys.argv[
1
])
相关文章推荐
- Python 模块paramiko简单使用方法
- python处理图片之PIL模块简单使用方法
- python处理图片之PIL模块简单使用方法
- python paramiko 模块使用方法
- [Python监控]psutil模块简单使用
- cocos2d-x使用python脚本创建项目的简单方法
- Python optionParser模块的使用方法
- Python模块安装: pip常见的使用方法
- python使用easyinstall安装xlrd、xlwt、pandas等功能模块的方法
- sigar模块之python api简单的使用--获取cpu信息
- python模块paramiko的上传下载和远程执行命令方法
- python 模块,模块名和包 最最简单的使用 入门级 不够详细 不建议参考- - 扫一眼就好
- python使用PIL模块实现给图片打水印的方法
- ##########(python 解析参数方法 可用) Python optionParser模块的使用方法 #######
- Python中使用gzip模块压缩文件的简单教程
- Python optionParser模块的使用方法
- Python random模块(获取随机数)常用方法和使用例子
- python simplejson模块的使用方法
- 初学python:calendar和time模块的简单使用
- Python set模块使用方法