Hostmonster Subdomain redirected to home server IP: How to ssh into home server using subdomain

2

1

I setup a home server to play with. Instead of remembering the IP address, I created a subdomain on my hostmonster personal website (http://subdomain.domainname.com) and redirected it to point at my server at home.

On my router firewall at home, I forwarded port 80 and 22 to allow web and ssh to get through to that server.

It seems, however, that my webhost forwards the port 80 requests, but does not forward ssh requests. I came to that conclusion after noticing the following:

When I access http://subdomain.domain.com I successfully see the web pages hosted on my home server. However, when I ssh into homeusername@subdomain.domain.com I cannot authenticate. ssh'ing into homeusername@homeIP works fine.

I also found that ssh'ing into webloginusername@subdomain.domain.com will ssh successfully into my web account.

Does anyone know how I can setup that kind of 'ssh forwarding' ?

Thanks in advance,

neildaemond

Posted 2011-06-20T14:35:11.563

Reputation: 327

Are you saying that ssh webloginusername@subdomain.domain.com logs you into your hostmonster web account, or an account on your home server? – Chris Ting – 2011-06-20T15:08:59.327

into my Hostmonster web account :) – neildaemond – 2011-06-20T15:41:28.313

Answers

2

You need to go into your domain's name server, and create an A record for your subdomain that points at your home IP. If you don't have a static IP at home, then you'll need to setup a dynamic DNS. There are many Dynamic DNS providers on Google; find one you like.

The key part of your question is that you "redirected" your subdomain to point at your server at home. I assume that you used something like the HTTP refresh header. When you try to reach your home server through the redirect, this is how the flow works:

  1. You send a request on port 80
  2. The Hostmonster server receives the request on port 80
  3. The apache server sees the redirect, and forwards to the redirect's port 80
  4. Your request reaches your home router on port 80
  5. Your request reaches your home server on port 80

Now here's what happens when you try to ssh into your home server:

  1. You send a request on port 22
  2. The Hostmonster server recieves the request on port 22
  3. The Hostmonster sees that your user doesn't exist on the server; access denied

The difference is that on port 80, apache sees the redirect. On port 22, sshd doesn't know about a redirect and believes you're trying to ssh into the Hostmonster server.

Chris Ting

Posted 2011-06-20T14:35:11.563

Reputation: 1 529

Thank you, I changed hosts before I saw your reply and its been a long time since I posted this. But, I've since worked with DNS more and your solution of creating an A record would have been right on the money. – neildaemond – 2012-04-25T09:39:17.200