Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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,

share|improve this question

migrated from stackoverflow.com Jun 20 '11 at 14:48

This question came from our site for professional and enthusiast programmers.

    
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 Jun 20 '11 at 15:08
    
into my Hostmonster web account :) –  neildaemond Jun 20 '11 at 15:41

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
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 Apr 25 '12 at 9:39

Your Answer

 
discard

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.