Skip to content

Instantly share code, notes, and snippets.

@cloderic
Created June 1, 2015 09:45
Show Gist options
  • Select an option

  • Save cloderic/b1a8bf0fc2a27901a3ea to your computer and use it in GitHub Desktop.

Select an option

Save cloderic/b1a8bf0fc2a27901a3ea to your computer and use it in GitHub Desktop.
Add host to ssh `known_hosts` file
#!/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