Python-paramiko First Experience

Source: Internet
Author: User

What Pexpect, Pxshll in front of Paramiko are clouds, the important is Paramiko support Windows.

Small trial Sledgehammer

ImportParamikoparamiko.util.log_to_file ('Ssh.log')#sets up loggingUsername ='Root'Password='123456'Command='ls-l'Client=Paramiko. Sshclient ()#Client.load_system_host_keys ()Client.set_missing_host_key_policy (Paramiko. Autoaddpolicy ()) Client.connect (hostname='192.168.3.100', port=22, Username=username, Password=password,pkey=none,key_filename=none,timeout=none,allow_agent=false,look_ for_keys=false,compress=False) stdin, stdout, stderr=client.exec_command (command)PrintStdout.read ()

client.close ()

Output Result:

C:\Python27\python.exe e:/python/dabao/study/0244-rw-------. 1 root root  1106 Jul 05:26 anaconda-ks.cfg-rw-r--r--. 1 root root 23089 Jul 05:26 install.log- Rw-r--r--. 1 root root  6240 Jul 05:24 install.log.syslogdrwxr-xr-x. 2 root root  4096 Jul03:24in< /c8> thread Thread-1 (most likely raised during interpreter shutdown):P Rocess finished with exit code 0

I really want to be.

Below is a description of his installation method:

To install the relevant support library:

Installation Pycrypto:http://www.voidspace.org.uk/python/modules.shtml#pycrypto

Because my client is windows, I download the. exe file and run the installation directly
Installing paramiko,https://pypi.python.org/pypi/paramiko/1.7.7.1
CMD switch to corresponding directory execution: Python setup.py install

The import module proves that the installation was successful.

Python-paramiko First Experience

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.