5

I connect to a server within Visual Studio Code using SSH ("Remote-SSH: Connect to Host..."). When working in the terminal within VS Code, the command code <file> results in opening the file in VS Code of the client (therefore on my screen). Now let's suppose I establish another SSH connection from the current session to a workstation within the network of the server using ssh <some workstation>. When I now try to open a file in VS Code using code <file>, nothing happens.

My questions are:

  • Since the last code <file> mentioned didn't open anything on my screen, is it possible that VS Code did open on any other screen connected to either the server or the workstation?
  • Is there any possibility to open the file within my VS Code?

1 Answer 1

16

As for your first question: There's is NO WAY your action could have opened a window on any other screen than yours. For that to happen you'd have to "link" your ssh session to that screen, which would require a bunch of intermediary steps.

Now for the second question: Yes its possible (and pretty easy). BUT you will have to open another session of VScode that will connect to the "workstation" through the server. Currently, to connect to the server, you probably had to add these lines to your ssh config file:

Host MyServer
    HostName adress.server
    User username

To open a session in the workstation, through the server, you should add these lines:

Host MyWorkstation
    HostName workstation.adress.within.network.of.the.server
    User usernameInWorkstation
    ProxyJump server.adress
Sign up to request clarification or add additional context in comments.

2 Comments

Perfect! Thank you very much for your detailed answer.
Excellent, it worked, for those who have pem file just pass the field as Identityfile:<path> under Host MyWorkstation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.