Marc Haber
2010-Aug-20 10:26 UTC
[Feature Request] delete defined line in known_hosts file
Hi, for a test lab, I'm trying to write a small shell script that will eradicate all information regarding a special host from the known_hosts file. Unfortunately, it is quite non-trivial to find out what ssh doesn't like with a host. ssh says which line in known_hosts has the offending key, but ssh-keygen -R doesn't take a line number. Am I using an undocumented interface when I simply use sed to delete the appopriate line? If so, it would be good if ssh-keygen -R would also take a line number to delete from the known_hosts file. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190
Damien Miller
2010-Aug-20 14:48 UTC
[Feature Request] delete defined line in known_hosts file
On Fri, 20 Aug 2010, Marc Haber wrote:> Hi, > > for a test lab, I'm trying to write a small shell script that will > eradicate all information regarding a special host from the > known_hosts file. Unfortunately, it is quite non-trivial to find out > what ssh doesn't like with a host. > > ssh says which line in known_hosts has the offending key, but > ssh-keygen -R doesn't take a line number. Am I using an undocumented > interface when I simply use sed to delete the appopriate line?not at all, the known_hosts is defined to be a file containing one key per line.> If so, it would be good if ssh-keygen -R would also take a line number > to delete from the known_hosts file.There is no need, other tools exist that do this job file. -d