0

I have three machines A, B, C. The aim is to be able to transfer files from A to C. I have ssh access from A to B, and B to C; B and C are on a local network. This can be achieved with the scp -o ProxyCommand option and it works. But before I stumbled upon this solution I tried an ssh -L method which didn't work. The problem was identified but not the solution. First an ssh local redirect was setup from A to C (on A) via. B like so:

ssh -p 8888 -L 5022:userC@hostC:22 userB@hostB

Using ssh to verify/test on A:

ssh -p 5022 userC@localhost

This fails on A saying:

ssh_exchange_identification: Connection closed by remote host

/var/log/auth.log on B says:

sshd[9873]: error: connect_to userC@hostC: unknown host (Temporary failure in name resolution)

I have verified that that the colon symbol (:) after hostC is causing the fault but have not found a way to fix this. any ideas would be useful.

Thanks

0

-L is for port forwarding.

The format is -L port:host:hostport

Whatever you were trying by adding a user name to the hostname specification with -L 5022:userC@hostC:22 was incorrect.

————————————————————-

The easiest to do multi hop ssh from host A via host B to host C is with the ProxyJump command switch -J available in newer ssh versions

 ssh -J userB@hostB userC@hostC

Or with scp

 scp -o 'ProxyJump userB@hostB' file userC@hostC:/path/
  • HBruijn you're right. Using ssh -p 8888 -L 5022:hostC:22 userB@hostB instead of ssh -p 8888 -L 5022:userC@hostC:22 userB@hostB solved the problem. Thanks. – zoulzubazz Nov 24 '18 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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