I am trying to do SSH where target server is accessible through jump server only.
+-------+ +----------+ +--------------+
| Laptop| <---> | Jumphost | <--> | TargetServer |
+-------+ +----------+ +--------------+
To access the server, I have to use my private key.
I recently shifted to MAC from Windows machine.
In windows I was using WINSCP tool and through tunnel option in WINSCP and Allowing agent forwarding I was able to access the target servers.
Authentication/Agent forwarding setting
I have placed same private key in both the settings.
Now I am looking for direct SSH command (to execute on MAC) so that I can access servers.
I have tried the following command
ssh -i privatekey.pem -Ao ProxyCommand="ssh -i privatekey.pem user@jumpserver" user@targethostname
but getting an error:
-bash: line 1: $'SSH-2.0-OpenSSH_7.6\r': command not found
Best Answer
Following command worked for me