chipsenkbeil / distant.nvim

🚧 (Alpha stage software) Edit files, run programs, and work with LSP on a remote machine from the comfort of your local environment 🚧
https://distant.dev
Apache License 2.0
1.17k stars 10 forks source link

ssh proxy command #50

Open argapost opened 2 years ago

argapost commented 2 years ago

Hello and thanks for this plugin!

Is it possible to pass a proxy command to DistantLaunch in order to connect first to a different server and then to the final destination?

similar to this: ssh -o ProxyCommand="ssh proxyserver -W %h:%p" username@finalserver

Thank you in advance!

chipsenkbeil commented 2 years ago

@argapost there is under the name ssh.proxy_command for :DistantLaunch or ssh = { proxy_command = "..." } for host settings. I haven't tested it, which is why it isn't documented.

You can try DistantLaunch finalserver ssh.user=username ssh.proxy_command="ssh proxyserver -W somehost:someport" and see what happens.

argapost commented 2 years ago

Thanks for the answer. I run the command you proposed and I get this error:

caused by: ssh handshake with finalserver:22: [Session(-43)] Failed getting banner

Any ideas?

chipsenkbeil commented 2 years ago

You're getting into the depths of libssh2. I've never used the proxy command and it's only available because wezterm-ssh exposes it from libssh2.

Stackoverflow seems to provide a good explanation: https://stackoverflow.com/questions/61257397/ssh2-connect-error-starting-up-ssh-connection-43-failed-getting-banner.

Check the logs on your intermediate host. See if there's any failure described. Same with the ssh client being run on the local machine.