Created
October 1, 2015 23:17
-
-
Save yusufhm/cd956ed270b0393b9232 to your computer and use it in GitHub Desktop.
automatically add host key to known_hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
host=$1 | |
# first remove the host's key if it exists | |
ssh-keygen -R $host | |
# then add to the known_hosts file | |
ssh-keyscan -H $host >> ~/.ssh/known_hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment