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