Skip to content

Instantly share code, notes, and snippets.

@fapestniegd
Created June 30, 2011 20:16
Show Gist options
  • Select an option

  • Save fapestniegd/1057117 to your computer and use it in GitHub Desktop.

Select an option

Save fapestniegd/1057117 to your computer and use it in GitHub Desktop.
#!/bin/bash
TARGET=$1
USER=$(echo ${TARGET}|sed -e 's/@.*//')
HOST=$(echo ${TARGET}|sed -e 's/.*@//')
KH=$(mktemp /tmp/known_hosts.XXXX);
ssh-keyscan -t dsa,rsa ${HOST} > ${KH} 2>/dev/null
ssh -oUserKnownHostsFile=${KH} $*
/bin/rm ${KH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment