Python Paramiko Module installation and use of the detailed
Http://www.111cn.net/phper/python/67973.htm
wget http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz
TAR-ZXVF pycrypto-2.6.tar.gz
CD pycrypto-2.6/
python setup.py build
python setup.py Install
go to Python
Import Crypto See if there are any errors
apt-get install-y Python-paramiko
you can then enter Python
Import Paramiko See if there are any errors
Troubleshooting solution for installation process
http://blog.csdn.net/wang1144/article/details/42277179
#!/usr/bin/env python
#-*-Coding:utf-8-*-
Import Paramiko
Import Sys,os
Host = ' 10.74.85.167 '
user = ' Liqian '
Password = ' 123456 '
cmd = ' ls-l '
#绑定实例
s = Paramiko. Sshclient ()
#加载本机. ssh/knows_hosts file
S.load_system_host_keys ()
#第一次登陆机器需要输入yes, you don't have to enter it after you add it
S.set_missing_host_key_policy (Paramiko. Autoaddpolicy ())
S.connect (host,22,user,password,timeout=5)
#执行命令
Stdin,stdout,stderr = S.exec_command (cmd)
#错误输出和正确输出, there is only one output, either the correct output or the error output
Cmd_result = Stdout.read (), Stderr.read ()
#输出的结果逐行打印
For line in Cmd_result:
Print Line
S.close ()
Python Paramiko analog SSH Login