Search code examples
sshhpc

How to emulate an ssh command in .ssh/config


I'm currently attempting to connect to an HPC using ssh directly. This involves running a command to request resources upon login. With the cluster I'm using you can request an interactive pseudo shell after connecting to the login node as so

ssh -tt blow-login "bsub -Ip zsh"

The -tt is important as otherwise authentications seem to fail and generally the house of cards falls down.

Now, when I try to compress this into a set of config settings:

Host blow-node
    Hostname blow-login
    ProxyCommand ssh -t blow-login "bsub -Ip zsh"
    RequestTTY force

Bad packet length 218783296.

It fails. The reason why this would be useful is that VScode allows users to ssh into a remote machine but they do not allow any scripts to be run before it installs its listening server.

Any tips very welcome

Thanks


Solution

  • ProxyCommand is used to specify proxy for establishing SSH connections over. You are currently telling your SSH client to talk to zsh as if the latter was an SSH server, hence the bad packet length error. What you are most likely looking for is the RemoteCommand option:

    RemoteCommand

    Specifies a command to execute on the remote machine after successfully connecting to the server. The command string extends to the end of the line, and is executed with the user's shell. Arguments to RemoteCommand accept the tokens described in the TOKENS section.