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

known_hosts completion is useless with recent ssh



This is sort of informational, but I am looking for suggestions to
improve the situation.

I recently started using a new Ubuntu desktop so ssh has been version
8+ from the start.  The known_hosts file is now populated entirely
with hashes rather than hostnames or IPs.

This both makes it a waste of time to scan that file, and also means
that there's no "memory" of hosts where I've previously logged in, to
be referenced by completion later.

As a workaround for this, I've started pulling words out of previous
ssh commands in the history:

zstyle -e ':completion:*:(ssh|scp):*' hosts 'reply=(
    ${(Mu)${(M)=history:#ssh*}:#[^/]##.*} )'

The pattern needs to be improved to search scp commands as well, but
extract only the part to the left of the colon in remote paths. Still,
this is better than getting nothing.

Tangentially, does anyone recall why the default _hosts completion
looks at ~/.ssh/known_hosts but NOT ~/.ssh/known_hosts2 ?




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