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.

dotancohen
  • 2,410
  • 2
  • 24
  • 38
  • Do you have `.ssh/config` specific to the host name (or the IP address)? What error do you get? (Hmm, this is support, but not to the goal of answering the question...) – Andreas Krey Mar 02 '15 at 07:18
  • Just the generic `Login authentication failed` for FTP and `Permission denied` for SSH. The actual connection is fine, and I've quadruple-checked the login credentials. – dotancohen Mar 02 '15 at 07:22

2 Answers2

34

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.

Martin Prikryl
  • 7,327
  • 2
  • 36
  • 71
  • 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 02 '15 at 09:22
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.

faker
  • 17,326
  • 2
  • 60
  • 69