1.1��飺
paramiko����python����д��һ��ģ�飬��ѭSSH2Э�飬֧���Լ��ܺ���֤�ķ�ʽ������Զ�̷����������ӡ�
����ʹ�õ���python������ܹ���ƽ̨���е����ԣ���������python֧�ֵ�ƽ̨����Linux, Solaris, BSD, MacOS X, Windows�ȣ�paramiko������֧�֣���ˣ������Ҫʹ��SSH��һ��ƽ̨���ӵ�����һ��ƽ̨������һϵ�еIJ���ʱ��paramiko�� ��ѹ���֮һ��
1.2��װ��
��װparamiko�������Ⱦ�������python������һ����ΪPyCrypto��ģ�顣
����ͨ����װ����pythonģ�飬ֻ��Ҫ��ģ��ĸ�Ŀ¼�����У�
python setup.py build
python setup.py install
��ע����װǰ�ȼ���Ƿ�װgcc��yum -y install gcc��
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
�������ԣ�
python>> import Crypto
����(����ʱ���?error: command 'gcc' failed with exit status 1��������Ϊȱ��python-dev���������yum -y install python-devel)
wget http://www.lag.net/paramiko/download/paramiko-1.7.7.1.tar.gz
tar xvzf paramiko-1.7.7.1.tar.gz
cd paramiko-1.7.7.1/
python setup.py build && python setup.py install
Crypto error: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
�������ԣ�
python>> import paramiko
(Crypto error: 'module' object has no attribute'HAVE_DECL_MPZ_POWM_SEC'
�����ҵ� /usr/lib/python2.7/site-packages/Crypto/Util/number.py
������if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
����ע����
����#if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
#!/usr/bin/python
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("ijIP��ַ",22,"�û���", "����")
stdin, stdout, stderr = ssh.exec_command("�������")
print stdout.readlines()
ssh.close()
#!/usr/bin/python
import paramiko
t = paramiko.Transport(("ijIP��ַ",22))
t.connect(username = "�û���", password = "����")
sftp = paramiko.SFTPClient.from_transport(t)
remotepath='/tmp/test.txt'
localpath='/tmp/test.txt'
sftp.put(localpath,remotepath)
t.close()
#!/usr/bin/python
import paramiko
t = paramiko.Transport(("ijIP��ַ",22))
t.connect(username = "�û���", password = "����")
sftp = paramiko.SFTPClient.from_transport(t)
remotepath='/tmp/test.txt'
localpath='/tmp/test.txt'
sftp.get(remotepath, localpath)
t.close()
���ij��� ����֮�������������� ���ͣ�����ر����˳���http://jwlin.blog.51cto.com/7560932/1787882