Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
codaz:python:commandes_ssh_avec_paramiko [2007/09/02 09:05]
imil created
codaz:python:commandes_ssh_avec_paramiko [2010/01/12 13:29] (current)
Line 1: Line 1:
 +Il est pratique et très facile d'​executer des commandes ssh sur un host distant grace au module //​paramiko//,​ voici un exemple rapide :
 +<​code>​
 +from paramiko import SSHClient, MissingHostKeyPolicy
  
 +client = SSHClient()
 +client.set_missing_host_key_policy(MissingHostKeyPolicy())
 +client.connect(host,​ 22, user, passwd)
 +(stdin, stdout, stderr) = client.exec_command('​df -h')
 +
 +for line in stdout.readlines():​
 +    print line
 +
 +client.close()
 +</​code>​
codaz/python/commandes_ssh_avec_paramiko.txt · Last modified: 2010/01/12 13:29 (external edit)