Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've asked this on another SE site, but I don't think I was clear enough. So, I will try it here. As an example - I have 2 domains (, Both resolve to my single static IP. Meanwhile, my router routes all port 22 traffic (SSH) to a Linux server ( What I would like to do (if this is possible) is to make THE url for SSH. I realize all of the traffic is routed to .21 (the router doesn't know about names), but is there some way to instruct Linux to reject port 22 requests when the name requested is In other words, is there any way to ask Linux to see the entire request?

Or perhaps the SSHd can do this? (shot in the dark)

Thanks in advance for any advice.

share|improve this question
Typically you are not supposed to re-post identical questions on SE, it violates the FAQ for SF and many of the other SE sites as well. Do you mind providing a link to the old question please? – Brent Pabst Aug 2 '12 at 22:55
Please do not cross-post. If a question should be on a different site we can migrate it. I've requested your other question be closed as this one has a better answer. – Chris S Aug 3 '12 at 0:20


When you ssh to, clients PC resolves it to an IP address, and ssh just connects to that IP. It never sends the domain name to the sshd on the server.

share|improve this answer
When traffic comes into the server on port 80, the daemon parses the request by name. You can have several domain names coming to the same IP address... Why can't SSH read this information? – aserwin Aug 2 '12 at 23:03
Yes, but webservers are not ssh. With webservers it's practical (economical) to have more then one page on one server, and to separate them with vhosts. With ssh you usually dont need separation.. there is no practical need for it (except security-through-obscurity). – mulaz Aug 2 '12 at 23:09
BTW, virtualhosts are not that old, and AFAIK virtualhosts with ssl are/were still unsupported with IE on WinXP. – mulaz Aug 2 '12 at 23:10
Your browser also sends the "Host" (the domain) in the request (starting from http 1.1 i think). SSH doesnt. Very old browsers dont. Ftp doesnt. VPN's dont. bittorrent doesnt. ping doesnt. .... – mulaz Aug 2 '12 at 23:27
@aserwin: In the HTTP case, it's handled by the HTTP protocol. DNS and the router have nothing to do with it. The SSH protocol has nothing comparable, so there's no way to do it with SSH. The information is just never sent. – David Schwartz Aug 2 '12 at 23:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.