简体   繁体   English

使用python中的paramiko进行SSH所需的用户信息

[英]User Info needed to SSH using paramiko in python

I have written the code below: 我写了下面的代码:

    import os, sys
    import paramiko

    ssh = paramiko.SSHClient()
    ssh.connect(server_name, username = ?, password = ?)

I'm trying to connect to an ftp server that doesn't need an account (username and password) to get access. 我正在尝试连接到不需要帐户(用户名和密码)进行访问的ftp服务器。 However, when I try some of the following: 但是,当我尝试以下操作时:

ssh.connect(server_name, username = '', password = '')

or 要么

ssh.connect(server_name, username = 'anonymous', password = '')

or 要么

ssh.connect(server_name)

I get this error: 我收到此错误:

socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Could someone please explain why I get this error and how to fix it? 有人可以解释为什么我得到这个错误以及如何解决吗?

gai stands for getaddrinfo() , which relates to your server_name . gai代表与您的server_name相关的getaddrinfo() A common mistake is related to host declaration. 一个常见的错误与主机声明有关。 If you can give us details about the server_name may be helpful. 如果您可以提供有关server_name详细信息,则可能会有所帮助。

(Sorry for not answering as a comment, but I'm not able to comment). (对不起,我没有发表评论,但我无法发表评论)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM