-
-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'wezterm ssh': Allow ssh options (like identity file) and reading .ssh/config #457
Comments
Note that the integrated ssh support is based on libssh2 which doesn't have command line options the same as openssh (it's a library, so there are no command line options!) so it's not quite as simple as passing a list of extra arguments; each of them needs proper config and/or argument definitions and those need to be hooked up to the ssh session construction. Until something like this is hooked up: If you're on a system with openssh installed, you can do: |
Argh, that's what I thought..
In my case I can't, I'm using Windows (I finally have a recent version so I can use Wezterm on it \o/), I know mouse support isn't great because of microsoft/terminal#376, and have found your commit (127b2a5) adding the builtin ssh command to solve this for remote systems (if I understood correctly?). |
re: windows + mouse, wezterm ships a special build of openconsole.exe and conpty.dll that allows mouse to work; I use it with |
If you (or someone else!) feels motivated to hook this up, here's the general approach: The I'd propose introducing a struct something like:
to replace the Then in You can use Session::userauth_pubkey_file to set the key path. Then on the other side of this, is teaching the rest of the code to set up that struct; these two places should be expanded to allow specifying the key file: Then it's just a matter of taking those values and setting them into the newly added |
Thanks a lot for the walk-through! I might try to do it next week Tiny note: I think it shouldn't be (I don't need this, but I'm speculating) |
If the mux server is on a different machine, then it will read a config on a remote machine. |
Something that could be interesting as well is to be able to read the file I've checked, libssh2 doesn't support this, but libssh does with the function Do you know about that other lib, did you tried it already? |
So, ssh is a complicated mess:
I still don't feel like the overall state of ssh clients in rust is great and that it would be good to do something to fix it :-/ |
I pushed the ssh config parser crate. If you wanted to apply it to this, then the steps are something like: let mut ssh_config = wezterm_ssh::config::Config::new();
ssh_config.add_default_config_files();
let ssh_config = ssh_config.for_host(hostname_or_alias);
// Look up "IdentityFile" option for that host. Note that you must use
// the option name in lowercase
let key_file = ssh_config.get("identityfile")?;
// Do something here to apply that to the libssh2 session |
I can't get this to succeed though; I suspect there may be a lingering bug from libssh2 and/or trailing support for newer openssh features. refs: #457
There are a few notable changes as a result: * A number of `.ssh/config` options are now respected; host matching and aliasing and identity file are the main things * The authentication prompt is inline in the window, rather than popping up a separate authentication window Refs: #457
Allow overriding ssh config options from the command line. I don't want to replicate the many options that `ssh(1)` has; this just exposes the `-oNAME=VALUE` syntax. The config names are those from `man ssh_config`; `IdentityFile` rather than `-i`. refs: #457
Hi. I bumped into (almost) the same issue except I'm authenticating via Kerberos/GSSAPI. The workaround (wezterm start -- ssh) doesn't work for new tabs. I don't mean to hijack this thread, but the issue is in effect similar. Are there plans for (optional) integration with openssh-client, so that GSSAPI works & $HOME/.ssh/config is used? |
@web-refinery: You can use return {
launch_menu = {
{
label = "ssh somewhere",
args = {"ssh", "somewhere"},
domain = {DomainName="local"},
},
}
} or make an explicit key binding: https://wezfurlong.org/wezterm/config/lua/keyassignment/SpawnTab.html |
Thanks, wezterm's full of options that keep surprising me. |
New ssh login works, the login in the same window is clearly a better UX! However I've noticed that after I'm connected to a machine, my first key input is eaten, so if I connect successfully and type |
I can't reproduce the input eating when connecting to localhost, both with agent auth (no need to type anything) and with pubkey auth (need to enter my key passphrase). Can you tell me more about the scenario where that triggers for you? |
I'm going to close this one; can you open a new issue for input eating that you saw? I feel like that may be a slightly different issue, but either way I think it will be easier for me to manage separately from this one! |
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. |
Hello @wez!
Is your feature request related to a problem? Please describe.
I need to connect to a remote server using an ssh key, with the builtin ssh client (I'm on windows now).
Describe the solution you'd like
Allow:
wezterm ssh -i /foo/bar user@host
What about passing arbitrary arguments? do you need to re-implement all the standard ssh options? or can you pass them (with something like
--extra-ssh-arg -i ...
or an env variable) to libssh2 for consumption?Describe alternatives you've considered
none?
The text was updated successfully, but these errors were encountered: