how to correct two host names in known_hosts

1

I'm trying to use ssh-keygen -R to remove a host line. However, each time I attempt this I get a zsh: no matches found:. When I look at the known_hosts file the line I want to modify starts like this [slsapp.com]:1234,[108.163.203.146]:1234 ssh-dss. I've tried to modify with both host names, with no luck. I even tried ssh-keygen -R [slsapp.com]:1234,[108.163.203.146]:1234

I'd rather not vim in or modify directly. Any suggestions?

icicleking

Posted 2015-10-13T13:27:43.627

Reputation: 113

Answers

0

The shell interprets characters inside [...] as alternatives for one character. See this example:

$ touch afoo bfoo cfoo dfoo
$ print -l [ac]foo
afoo
cfoo

So, quote the hostname with single quotes to prevent the shell to interpret any special characters:

$ ssh-keygen -R '[slsapp.com]:1234'

mpy

Posted 2015-10-13T13:27:43.627

Reputation: 20 866

Thanks! When I re-push through ssh I regenerate the known_host line, which is what was expected. Thanks again. – icicleking – 2015-10-13T17:18:57.667