For When You Can't Have The Real Thing
[ start | index | login ]
start > CentOS > 6 > ssh > Remove Host ID

Remove Host ID

Created by dave. Last edited by dave, 4 years and 20 days ago. Viewed 4,031 times. #3
[diff] [history] [edit] [rdf]


Host-ID has changed and ssh is complaining about it.


Shell alias:

# edit the ~/.ssh/known_hosts file to remove the passed line number.
#  source: >>
trim-ssh () {
  cp ~/.ssh/known_hosts ~/.ssh/known_hosts_$(date +%Y%m%d-%H%M%S) ;
  sed -e "$1d" ~/.ssh/known_hosts > ~/.ssh/known_hosts_new ;
  mv -f ~/.ssh/known_hosts_new ~/.ssh/known_hosts ;
  chmod 644 ~/.ssh/known_hosts


Remove line 12 in the ~/.ssh/known_hosts file?

> trim-ssh 12
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful: | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt