1

I'd like to edit code on a remote machine. The VSCode SSH extension offers this feature, but I can only get it to work for a single hop. Here's what I've tried so far:

  • Click on 'Remote Explorer' in VSCode sidebar
  • Click + for 'Add Target'
  • Enter the multiple-hop ssh command: ssh -A userA@hostA ssh userB@hostB
  • Select ~/.ssh/config as the SSH config file to update
  • When I do this, only the information from the first SSH hop is entered into the config file:
Host hostA
  HostName hostA
  ForwardAgent yes
  User userA

How can I get VSCode to correctly establish a multiple-hop ssh connection?

3

After reading this answer, I updated the ~/.ssh/config file as follows:

Host hostB
  HostName hostB
  User userB
  ProxyCommand ssh userA@hostA -W %h:%p

and I was able to connect.

| improve this answer | |

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.