I'm writing a custom SSH server. Whenever I connect to it via ssh user@subdomain.example.com
, I need to know the value of the subdomain.
Right now I can only get remote and local IP addresses.
I'm writing a custom SSH server. Whenever I connect to it via ssh user@subdomain.example.com
, I need to know the value of the subdomain.
Right now I can only get remote and local IP addresses.
The SSH protocol knows nothing about the hostname that's used to connect to it. The client merely resolves it to an IP address and then uses that IP to connect.
It sounds like perhaps you've had experience with HTTP servers, and their ability to be made aware of the hostname used to access them. This functionality is possible only because the HTTP client sets a Host
header in the HTTP request, whose value is the hostname used to access the server. There is no equivalent functionality in SSH.