I've been trying to get this to work but keep getting the same errors. I've tried the fqdn and ip of the host. I've tried to pass it with credentials and without. I've looked at the lines indicated in the error message. Searched google, but cannot figure out why this is not working:
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('host', username='loginname')
stdin, stdout, stderr = ssh.exec_command("pwd")
stdout.readlines()
Error:
Traceback (most recent call last):
File "audit.py", line 7, in <module>
ssh.connect('host', username='loginname')
File "/usr/lib/python2.6/site-packages/paramiko/client.py", line 338, in connect
self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys)
File "/usr/lib/python2.6/site-packages/paramiko/client.py", line 520, in _auth
raise SSHException('No authentication methods available')
- I am able to connect to the host with no issue via ssh.
- ssh version: OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
- To note: I'm trying to create a way of running a series of commands on several remote servers. I'm using
sys import argv
to run the script such aspython audit.py host1 host2 host3
, and then the script will run through the audit for those particular hosts. I've already created a bash script that accomplishes this but I wanted a better way of doing it via Python.
password
keyword? – Uniparous