This is an old revision of the document!
SSH Programming with Paramiko
References:
SSH Programming with Paramiko - Completely Different, by jesse
Paramiko on github
Installing Paramiko
Paramiko is a pure-Python module and can be easy_install'ed as other typical python modules can. However, PyCrypto is written largely in C, so you may need a compiler to install both depending on your platform.
Installing Paramiko
Possibly switch to your virtual environment, otherwise you'll get a system-wide installation.
You should obviously adapt the paths that are used here to your local situation
This operation will install the LATEST version of paramiko:
> source /var/python/virtenvs/myvirtspace/bin/activate > pip install paramiko
Known Hosts
When initiating an ssh connection through Paramiko, the “usual” known host check will be performed. You known that, in a shell, when you initiate an ssh connection for the first time you'll get a message of type:
The authenticity of host '172.20.20.3 (172.20.20.3)' can't be established. ECDSA key fingerprint is 9a:3c:cd:82:27:3e:6d:6d:1f:c5:d5:d7:bb:be:77:1c. Are you sure you want to continue connecting (yes/no)?
Typing “y” will add this (here ECDSA) key to the current user's ~/.ssh/known_hosts file, and you won't get asked anymore unless the target's fingerprint is changed. This security feature is also implemented into Paramiko.