Create a gist now

Instantly share code, notes, and snippets.

@lyndell /rmkey.sh
Last active Dec 16, 2015

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