Skip to content

Instantly share code, notes, and snippets.

@slumos
Created September 21, 2017 21:12
Show Gist options
  • Save slumos/1c37c91c4fe49a43ab472bac848eb4b9 to your computer and use it in GitHub Desktop.
Save slumos/1c37c91c4fe49a43ab472bac848eb4b9 to your computer and use it in GitHub Desktop.
21Sep 14:10:47 ~ 0% which fssh
fssh () {
hosts="$1 $(getent hosts $1)"
if [ -x /usr/bin/dscl ]
then
hosts="$hosts $(dscl . read /Hosts/$1 | awk '/^IPAddress/ { print $2 }')"
fi
for h in ${=hosts}
do
ssh-keygen -R $h >&/dev/null
done
ssh-keyscan -tdsa,rsa ${=hosts} >> $HOME/.ssh/known_hosts 2> /dev/null
ssh $*
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment