I'm writing a custom SSH server. Whenever I connect to it via
ssh firstname.lastname@example.org, I need to know the value of the subdomain.
Right now I can only get remote and local IP addresses.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
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.