pythonparamikoplumbum

Plumbum - Nested SSH Remoting / Jump Host


Is there a good built-in way to connect through a 'jump host' with Plumbum.

I've thought about subclassing ParamikoMachine to provide my own SSHClient object.

Any other ideas?


Solution

  • Try using ssh_opts of SshMachine: (see https://github.com/tomerfiliba/plumbum/blob/4e4a35394c1385721cc0e07eb6e9414f3466c5b3/plumbum/machines/ssh_machine.py#L60)

    with SshMachine("finalhost", ssh_opts=["-o ProxyCommand='ssh -W finalhost:22 user@jumphost'"]) as rem:
        r_ls = rem["ls"]