zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: known_hosts completion is useless with recent ssh
Date: Thu, 18 Aug 2022 17:28:59 -0700	[thread overview]
Message-ID: <CAH+w=7Z+Q6EZ8nTAwb78oCw-32v+TP03crva6p_w7K4xQosK9Q@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7bhvrBxhJW2-Zo7qVMJWVxFUm9oozHQ30f+g1g2N9S9fg@mail.gmail.com>

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 ?


       reply	other threads:[~2022-08-19  0:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAH+w=7bhvrBxhJW2-Zo7qVMJWVxFUm9oozHQ30f+g1g2N9S9fg@mail.gmail.com>
2022-08-19  0:28 ` Bart Schaefer [this message]
2022-08-19  0:40   ` Felipe Contreras
2022-08-19  5:24     ` Bart Schaefer
2022-08-19 12:52       ` Ray Andrews
2022-08-19  5:49   ` Grant Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Z+Q6EZ8nTAwb78oCw-32v+TP03crva6p_w7K4xQosK9Q@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).