chipsenkbeil / distant

🚧 (Alpha stage software) Library and tooling that supports remote filesystem and process operations. 🚧

Home Page:https://distant.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot connect through SSH: `[Session(-43)] Failed getting banner`

itaranto opened this issue · comments

Cannot connect through SSH neither via distant connect or distant launch.

The error I get is:

Failed to connect to server

Caused by:
    Fatal: ssh handshake with localhost:22: [Session(-43)] Failed getting banner

I see the follwing in the manager logs (journalctl --user -u distant-manager.service):

Started distant-manager.service - distant-manager.
Usage: sss_ssh_knownhostsproxy [-?k] [-?|--help] [--usage] [-p|--port=INT]
        [-d|--domain=STRING] [-k|--pubkey] HOST [PROXY_COMMAND]

It seems the parameters passed to sss_ssh_knownhostsproxy aren't quite right.

Unfortunately, running the manger with distant manager service start --user --log-level trace doesn't seem to show how sss_ssh_knownhostsproxy is being invoked.

Environment:
distant version: 0.20.0
OpenSSH version: 9.0p1
SSSD version: 2.9.4
OS: Fedora 38

This seems to happen with some ssh servers and our use of some C ssh libraries. Until #193 is implemented, you can try switching the ssh client library used as described in the options for ssh.

Specifically, change the ssh.backend to libssh. I have to do this when using distant at work:

distant connect ssh://example.com --options 'backend=libssh'

The default backend is ssh2 as a client library. Both have issues, which hopefully will be resolved by switching to a native Rust implementation in the future.

This seems to happen with some ssh servers and our use of some C ssh libraries. Until #193 is implemented, you can try switching the ssh client library used as described in the options for ssh.

Specifically, change the ssh.backend to libssh. I have to do this when using distant at work:

distant connect ssh://example.com --options 'backend=libssh'

The default backend is ssh2 as a client library. Both have issues, which hopefully will be resolved by switching to a native Rust implementation in the future.

Good to know then.

Regarding switching to backend=libssh, that made the error go away but it still doesn't work. All I get is a number being printed to stdout, for example:

$ distant connect ssh://foo@bar --options 'backend=libssh,verbose=true'
Password:
1941100921

Also, after checking, I realized I didn't have libssh2 installed in the first place. But after installing it the "banner" error remains the same. I guess that's because distant statically links libssh2.

The number is the ID of the connection after succeeding. Did you try distant fs read . or distant shell?

The number is the ID of the connection after succeeding. Did you try distant fs read . or distant shell?

Right 🤦‍♂️ I should have read the docs 😄

distant shell worked like a charm.

Glad it worked for you!

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.