I got sick of every time this happened to have to go into known_hosts and delete that entry. ssh will always tell you the line number that contains the conflicting key, so all i have to do is delete that line from known_hosts and bam. i'm done. So i came up with this little function to make my life easier:
ssh-del-line() {
if [[ -z $1 ]]; then
echo 'Deletes the specified linenumber from ~/.ssh/known_hosts'
echo 'Usage: ssh-del-line linenumber'
else
sed -i "/$1/d" ~/.ssh/known_hosts
fi; }
No comments:
Post a Comment