26

When using the ssh or ftp commands from the Bash shell, does the server that I am connecting to learn of the domain name used? I understand that the domain name is locally translated into an IP address via DNS. In HTTP, after that happens, the server is told the original domain name as well in order to serve the correct page, or to present the correct TLS cert (SNI).

host serverfault.com
GET /

Does a similar phenomenon happen when connecting to ssh or ftp?

I ask because I am trying to ssh into a server (GoDaddy webhosting) which expects a domain name, but is not letting me in when I try to connect via user@IPaddress as the DNS is not yet moved to the GoDaddy IP address.

0

2 Answers 2

27

No, the SSH clients do not pass the DNS name you connected to on to the server.
As you said correctly, the name is resolved locally to the IP address.

It looks like I was wrong about FTP.
See the other answer for details.

1
34
+50

The SSH/SFTP protocol does not have any mechanism to provide the host to the server.

There was a discussion about adding this functionality to OpenSSH, see "Virtual hosts" for ssh.


The FTP protocol does have HOST command, which is an equivalent to the HTTP Host header. It is specified by a relatively new RFC 7151. The RFC was published in March 2014 (though the first draft is from 2007). As such, it is not universally supported yet.

On a server-side, it's supported by IIS (the RFC is sponsored by Microsoft) and ProFTPD (since 1.3.6rc1). It's not supported by other common Unix FTP servers like Pure-FTPd or vsftpd.

On a client-side, it is supported by (my) WinSCP. It's not supported by FileZilla, as its author oppose the idea, nor by CyberDuck. I do not know about others.

1
  • Thank you, this will be an important consideration in the next few years when people come across this issue and google this question.
    – dotancohen
    Mar 2, 2015 at 9:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .