Skip to content

Instantly share code, notes, and snippets.

@yusufhm
Created October 1, 2015 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusufhm/cd956ed270b0393b9232 to your computer and use it in GitHub Desktop.
Save yusufhm/cd956ed270b0393b9232 to your computer and use it in GitHub Desktop.
automatically add host key to known_hosts
#!/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