Every morning, and multiple times throughout the day, I need to open an ssh session to a VM that is behind a proxy-jump. Since putty doesn't have a native proxy-jump capability, I just log in to the jump server and ssh over. However, this is a bit cumbersome and prone to error if my attention slips between opening the jump-server and the ssh, which it will do in an office environment.
The most rated suggestions are to use Remote Commands, such as How to setup proxy jump with PuTTY and add the command I want to execute on connection. However, Remote Command does not work at all. It will not ssh (remote command = 'ssh {destination IP}'), nor will it even echo or cd or ls. The only thing that happens when I pass a Remote Command to the jump server is that it will not print the MoTD and leave me at prompt like normal. What can I do to troubleshoot this?
Attempting to use plink instead of Remote Command:
(Attempt #1)
- Created new session. Host Name (or IP address) = {ProxyJump IP} on port 22 (SSH).
- Connection -> Proxy. Proxy type = local. Proxy hostname = {ProxyJump IP}. Port = 22. Username = {username}. Password = {password}. Telnet command, or local proxy command = 'plink.exe %user@%proxyhost -nc %host:%port'
- Result: Blank screen where title = {ProxyJump IP}. No prompt. No Destination VM IP given, so wouldn't work in hindsight.
(Attempt #2)
- Created new session. Host Name (or IP address) = {Destination VM IP} on port 22 (SSH).
- Connection -> Proxy. Proxy type = local. Proxy hostname = {ProxyJump IP}. Port = 22. Username = {username}. Password = {password}. Telnet command, or local proxy command = 'plink.exe %user@%proxyhost -nc %host:%port'
- Result: Blank screen where title = {Destination VM IP}. No prompt.
(Attempt #3) After seeing Putnik's comment on https://stackoverflow.com/questions/28926612/putty-configuration-equivalent-to-openssh-proxycommand, I added my path to my ssh key.
- Created new session. Host Name (or IP address) = {Destination VM IP} on port 22 (SSH).
- Connection -> Proxy. Proxy type = local. Proxy hostname = {ProxyJump IP}. Port = 22. Username = {username}. Password = {password}. Telnet command, or local proxy command = 'plink.exe %user@%proxyhost -ssh -i {path/to/key} -nc %host:%port'
- Result: Prompts for username. Once entered, logs me in as I would expect it to!