Paramiko模块使用

# python
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
>>> import Crypto
>>> ssh = paramiko.SSHClient()
>>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
>>> ssh.connect("10.72.16.93",22,"root", "密码")
>>> stdin, stdout, stderr = ssh.exec_command("/sbin/ifconfig")
>>> print stdout.readlines()

>>> ssh.close()
>>>

参考

python学习笔记--Paramiko模块安装和使用 - kangjie - 博客园
http://www.cnblogs.com/taiguyiba/p/6051022.html

paramiko的安装与使用 - 甘南 - 博客园
http://www.cnblogs.com/gannan/archive/2012/02/06/2339883.html

原文地址:https://www.cnblogs.com/paul8339/p/6286888.html