#!/usr/bin/env python # Non-Interactive ssh Connection # usage: sshservers.py host username password command # $Id: tsshbatch.py,v 1.101 2010/09/27 20:35:36 tundra Exp $ import paramiko import sys ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(host, username=user, password=pw) stdin, stdout, stderr = ssh.exec_command(command) print stdout.readlines()