0

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. 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?

PhoenixRising
  • 95
  • 2
  • 13
  • I am guessing this has to do with the `server_name`. – Nicolai S Jul 09 '15 at 02:14
  • maybe related to http://stackoverflow.com/questions/20252294/ssh-could-not-resolve-hostname-hostname-nodename-nor-servname-provided-or-n – Mithril Jul 09 '15 at 02:20
  • Just curious that connecting to a ftp server over ssh but with anonymous account and no password? That's kinda strange for me, or maybe you are talking about `sftp`? – Jkm Jul 09 '15 at 03:09

1 Answers1

1

gai stands for getaddrinfo(), which relates to your server_name. A common mistake is related to host declaration. If you can give us details about the server_name may be helpful.

(Sorry for not answering as a comment, but I'm not able to comment).

antonioduarte
  • 655
  • 7
  • 19