Modifying ssh
connection command when running code --remote
#2780
Unanswered
kamurani
asked this question in
Extension Development QnA
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a tool that programmatically calls an instance of
code
to open a new window, and logs into a remote server over SSH.The command looks something like this:
code --remote ssh-remote+mainserver-t5 "/path/to/remote/dir"
Dissecting that a bit,
ssh-remote+mainserver-t5
is parsed andmainserver-t5
is treated as theHostName
. However, I need to use an SSH jump host in order to get to the target node. So, I am usingProxyJump
and using a login node (calledmainserver
) in order to reach the target node,t5
.As there are many target nodes that I could be assigned (
t0
..t99
) and I don't wish to add a separateProxyJump
entry in my~/.ssh/config
file; I have generalised all of these with a single wildcard match.~/.ssh/config
looks like:Therefore, when VScode runs the SSH connection, it treats
mainserver-t5
as any oldhostname
; but under the hood, SSH parses outmainserver
andt5
(as per the wildcard-matching entry in the config file) and provides the connection via aProxyJump
.I would prefer users of my program to not need to add this placeholder to their
~/.ssh/config
, and therefore I'm looking for a way to directly modify thessh
command that is used under the hood by VScode.Upon viewing some verbose debug output, I can see the actual command that is run after doing
code --remote
:Is there an easy way to directly modify this command? In which case, I could simply append the
-J
option and provide the two hostnames as required; rather than relying on this argument being given by theProxyJump
entry in the config file.Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions