Skip to content

Instantly share code, notes, and snippets.

@lyndell
Last active December 16, 2015 07:43
Show Gist options
  • Save lyndell/c2f53d0c3e3c0e37af70 to your computer and use it in GitHub Desktop.
Save lyndell/c2f53d0c3e3c0e37af70 to your computer and use it in GitHub Desktop.
rmkey
#!/bin/bash
#
# Name: rmkey.sh
# Desc: Remove an IP's fingerprint from the SSH known_hosts file
# URL: https://gist.github.com/lyndell/c2f53d0c3e3c0e37af70
#
# Author: Lyndell Rottmann
# WWW: http://Lyndell.US
# Copyright (c) 2015 Lyndell Rottmann
#
# Debug mode on/off: (default off)
set +x
if [ -z $1 ]
then
echo "Please provide an IP."
exit;
else
IP=$1 # IP from comand line
sed -i -e "/${IP}/D" ~/.ssh/known_hosts
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment