Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

bug: _ssh_hosts ignores ~/.ssh/config in favor of ~/.ssh/known_hosts



Hello, all!

It appears that in zsh 5.0.2 that the _ssh completion rule it is ignoring ~/.ssh/config in favor of hosts in ~/.ssh/known_hosts.

How to recreate the problem:

1. With a clean ~/.ssh/ directory.
2. Create an entry in ~/.ssh/config like so:
  Host foobar
  HostName foobar.example.com
3. Now try: ssh f<tab>
4. Note it completes as "ssh foobar"
5. Connect to host.
6. Say 'yes' to ssh prompt to add the host-key to known_hosts
7. Restart your zsh: exec zsh -l
8. Type: ssh f<tab>
9. Notice it completes to: "ssh foobar.example.com" and additional <tab>s won't show the entry from ~/.ssh/config at all.

I expected step 9 to be "ssh foobar" instead.

Some other bugs in _ssh_hosts:

It includes (multiple) '#' as completion targets. Presumably from ~/.ssh/config?
It doesn't understand known_hosts entries that look like: [foobar.example.com]:1234

Workaround:  Set 'HashKnownHosts yes' in your ~/.ssh/config -- then nothing will match from ~/.ssh/known_hosts.


Messages sorted by: Reverse Date, Date, Thread, Author