Reputation: 87
While executing the following code, I am getting a traceback
#!/usr/bin/python
import os
import sys
import paramiko
command1= "cat /etc/fidelity-release"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("sbanlab1","user","passwd")
stdin,stdout,stderr = ssh.exex_command(command1)
ssh.close()
The traceback:
socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM):
socket.gaierror: [Errno -8] Servname not supported for ai_socktype
Upvotes: 0
Views: 450
Reputation: 8061
ssh.connect("sbanlab1", username="user", password="passwd")
Here is the definition of paramiko.SSHClient.connect
method (from Paramiko client.py source file)
def connect(self, hostname, port=SSH_PORT, username=None, password=None, [...])
The way you are using the connect
method is equivalent as following
ssh.connect("sbanlab1", port="user", username="passwd")
Upvotes: 1