Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to log into machine A from machine B via SSH. Both machines are running Ubuntu, and both machines are on the same LAN. My method is to log into machine B via SSH from outside the LAN, then log into machine A from machine B.


Me --||--> SSH B --> SSH A

Where the || signifies the entrance to the LAN

I can't log in directly to machine A because my router is only setup to forward to machine B. I frequently SSH into machine A from within my LAN on other Windows computers - I do this all the time.

I am able to log into machine B via SSH successfully from OUTSIDE the LAN. I am then trying to SSH from the shell of machine B to machine A, but it is not working. This is what I do from machine B:

ssh login_name@machine.A.IP.addy

However, when I do this command it brings me to a login prompt that is for a completely different computer, outside the LAN, that I also manage. So, something like:

password for login_name@IP.of.machine.outside.the.LAN:

How on earth is this happening?!

Any thoughts?

share|improve this question
Did you cripple your ~/.ssh/config ? –  BatchyX Oct 7 '12 at 8:44
I presume that if you connect to "SSH B" directly (from the console) then the behavior is the same - you are presented with the wrong server. What happens when you connect to "SSH B" from "SSH A"? Also, can you provide more details about your network topology, subnets and routes. What is the IP address of the wrong box? –  Alastair McCormack Oct 7 '12 at 8:49
If you are on machine B - do the results of gethostip -d $A and host $A match to the same IP? –  Nils Oct 7 '12 at 20:23
add comment

Your Answer


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

Browse other questions tagged or ask your own question.