zsh-users
 help / color / mirror / code / Atom feed
* known_hosts completion is useless with recent ssh
       [not found] <CAH+w=7bhvrBxhJW2-Zo7qVMJWVxFUm9oozHQ30f+g1g2N9S9fg@mail.gmail.com>
@ 2022-08-19  0:28 ` Bart Schaefer
  2022-08-19  0:40   ` Felipe Contreras
  2022-08-19  5:49   ` Grant Taylor
  0 siblings, 2 replies; 5+ messages in thread
From: Bart Schaefer @ 2022-08-19  0:28 UTC (permalink / raw)
  To: Zsh Users

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 ?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: known_hosts completion is useless with recent ssh
  2022-08-19  0:28 ` known_hosts completion is useless with recent ssh Bart Schaefer
@ 2022-08-19  0:40   ` Felipe Contreras
  2022-08-19  5:24     ` Bart Schaefer
  2022-08-19  5:49   ` Grant Taylor
  1 sibling, 1 reply; 5+ messages in thread
From: Felipe Contreras @ 2022-08-19  0:40 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users

On Thu, Aug 18, 2022 at 7:29 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> 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.

I'm using ssh 9.0 on Arch Linux and I don't have that. I believe
Ubuntu is enabling HashKnownHosts, which is disabled by default.

Maybe just change that?

-- 
Felipe Contreras


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: known_hosts completion is useless with recent ssh
  2022-08-19  0:40   ` Felipe Contreras
@ 2022-08-19  5:24     ` Bart Schaefer
  2022-08-19 12:52       ` Ray Andrews
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2022-08-19  5:24 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Zsh Users

On Thu, Aug 18, 2022 at 5:40 PM Felipe Contreras
<felipe.contreras@gmail.com> wrote:
>
> Ubuntu is enabling HashKnownHosts, which is disabled by default.

Well, dang.  Having used SSH with basically the same configuration for
about 30 years, it never occurred to me that an OS vendor would decide
to enable a non-default option I didn't know existed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: known_hosts completion is useless with recent ssh
  2022-08-19  0:28 ` known_hosts completion is useless with recent ssh Bart Schaefer
  2022-08-19  0:40   ` Felipe Contreras
@ 2022-08-19  5:49   ` Grant Taylor
  1 sibling, 0 replies; 5+ messages in thread
From: Grant Taylor @ 2022-08-19  5:49 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

On 8/18/22 6:28 PM, Bart Schaefer wrote:
> 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.

Last time I ran into this, I re-configured Zsh completion to look at my 
~/.ssh/config file for pre-configured hosts.  --  I had all of my hosts 
set up therein.



-- 
Grant. . . .
unix || die


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4017 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: known_hosts completion is useless with recent ssh
  2022-08-19  5:24     ` Bart Schaefer
@ 2022-08-19 12:52       ` Ray Andrews
  0 siblings, 0 replies; 5+ messages in thread
From: Ray Andrews @ 2022-08-19 12:52 UTC (permalink / raw)
  To: zsh-users

On 2022-08-18 22:24, Bart Schaefer wrote:
> On Thu, Aug 18, 2022 at 5:40 PM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>> Ubuntu is enabling HashKnownHosts, which is disabled by default.
> Well, dang.  Having used SSH with basically the same configuration for
> about 30 years, it never occurred to me that an OS vendor would decide
> to enable a non-default option I didn't know existed.
>
It it ain't broke, life is too boring.  Get that adrenaline flowing again.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-19 12:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAH+w=7bhvrBxhJW2-Zo7qVMJWVxFUm9oozHQ30f+g1g2N9S9fg@mail.gmail.com>
2022-08-19  0:28 ` known_hosts completion is useless with recent ssh Bart Schaefer
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

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).