Re: "ssh-keygen -R hostname" errors out with non-existent known_hosts

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



I'm inclined to agree with Damien. It doesn't totally make sense to exit 0. The command hasn't successfully completed in the case in which it can't find the known_host file.

It may be a success according to your semantics in this instance, but what about in cases where the known_host file *should* have been found, but wasn't?

On Wed, 24 Mar 2021 02:20:19 +0100 (CET)
Thorsten Glaser <t.glaser@xxxxxxxxx> wrote:

> On Wed, 24 Mar 2021, Damien Miller wrote:
> 
> > > Exit 0, please. An absent known_hosts file doesn't contain the entry
> > > the "ssh-keygen -R hostname" entry is expected to remove, and the
> > > result should be considered a success for the command.
> 
> Agreed.
> 
> > "grep foo /nonexistent" or "sed -i s/foo/bar /nonexistent" don't return
> > status 0 either for exactly the same reason.
> 
> This is more of a ,g/entry/d than a /entry/d in ed(1) parlance.
> 
> It’s a convenience command to remove an entry from the list of
> known hosts, whether it exists or not or the file doesn’t even
> exist; it should only fail when the job can’t be done (e.g. the
> file is write-protected).
> 
> Think of it as 'rm -f known_hosts/entry' which won’t fail if
> known_hosts/ doesn’t exist.
> 
> bye,
> //mirabilos
> -- 
> «MyISAM tables -will- get corrupted eventually. This is a fact of life. »
> “mysql is about as much database as ms access” – “MSSQL at least descends
> from a database” “it's a rebranded SyBase” “MySQL however was born from a
> flatfile and went downhill from there” – “at least jetDB doesn’t claim to
> be a database”	(#nosec)    ‣‣‣ Please let MySQL and MariaDB finally die!
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev@xxxxxxxxxxx
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


-- 
Noah Zalev <noah@xxxxxxxx>
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev




[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux