Created
June 1, 2015 09:45
-
-
Save cloderic/b1a8bf0fc2a27901a3ea to your computer and use it in GitHub Desktop.
Add host to ssh `known_hosts` file
This file contains hidden or 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 | |
| echo "Adding $host to the ssh known hosts..." | |
| ssh-keyscan -t rsa,dsa $host 2>&1 | sort -u - ~/.ssh/known_hosts > ~/.ssh/tmp_hosts | |
| cat ~/.ssh/tmp_hosts >> ~/.ssh/known_hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment