Skip to content

Instantly share code, notes, and snippets.

@yusufhm
Created October 1, 2015 23:17
Show Gist options
  • Select an option

  • Save yusufhm/cd956ed270b0393b9232 to your computer and use it in GitHub Desktop.

Select an option

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