Skip to content

Instantly share code, notes, and snippets.

@takenoko-str
Last active January 22, 2018 11:58
Show Gist options
  • Save takenoko-str/e8375dbcc8b0adaef57eb2ed0d6942ff to your computer and use it in GitHub Desktop.
Save takenoko-str/e8375dbcc8b0adaef57eb2ed0d6942ff to your computer and use it in GitHub Desktop.
know_hosts on development environment
#!/bin/sh
# escape know_hosts problem
# if you can not connect remote-server with ssh because of changing dns record frequestly,
# you can use this script. set error message "Offending key for IP in /home/takenoko/.ssh/known_hosts:688"
argv=$1
known_hosts=$(echo $argv | awk -F':' '{print $1}')
if [ -z $konw_hosts ]; then
exit 1
fi
line=$(echo $argv | awk -F':' '{print $2}')
if [ -z $line ]; then
exit 1
fi
sed -i.bak -e "${line}d" $known_hosts
@takenoko-str
Copy link
Author

ssh -o 'StrictHostKeyChecking no' -i ~/.ssh/mykey.pem ubuntu@x.x.x.xでよかった。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment