3

In a setup that I have inherited, using the command ssh user2@host2:user1@host1, I can connect to user2@host2 through user1@host1 but I don't understand how it works (where is this ssh behaviour documented?)

Furthermore, I'd like to be able to setup my .ssh/config so that I can do ssh user2@host2 and it goes directly through the host1 and I believe it can be achieved using ProxyCommand but the following is a failure:

ssh -o ProxyCommand='ssh -W %h:%p user1@host1' user2@host2
user1's password:
Received disconnect from REDACTED_IP: 11: Bye Bye
Disconnected from REDACTED_IP
ssh_exchange_identification: Connection closed by remote host

2 Answers 2

2

You should check your $HOME/.ssh/config for record like Host *:*. If you want to know more how it works there is good article at wikibooks about that. And for command line you use you should remove equal sign = from ProxyCommand:

ssh -o "ProxyCommand ssh -W %h:%p user1@host1" user2@host2
1
  • There is nothing wrong with using = between option name and value. Your version of the command will do exactly the same as the original version, but I find the original version to be a bit more readable than yours.
    – kasperd
    Nov 20, 2016 at 22:25
0

Well, after experimenting for some time, it appears that the software of host1 (which I did not have direct access to) is configured so that user2@host2:user1 is actually a username.

Hence ssh user2@host2:user1@host1 works.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .