执行以下代码时,我收到了追溯
#!/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()
追溯:
socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM):
socket.gaierror: [Errno -8] Servname not supported for ai_socktype
答案 0 :(得分:1)
ssh.connect("sbanlab1", username="user", password="passwd")
以下是paramiko.SSHClient.connect
方法的定义(来自Paramiko client.py source file)
def connect(self, hostname, port=SSH_PORT, username=None, password=None, [...])
您使用connect
方法的方式与以下相同
ssh.connect("sbanlab1", port="user", username="passwd")