问题
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:
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
来源:https://stackoverflow.com/questions/59456119/ssh-session-within-ssh-session-vs-code