Skip to content

Instantly share code, notes, and snippets.

@pixelbrackets
Created November 25, 2016 16:54
Show Gist options
  • Save pixelbrackets/d1dfb430b9fcafa28cb5e2715665f85a to your computer and use it in GitHub Desktop.
Save pixelbrackets/d1dfb430b9fcafa28cb5e2715665f85a to your computer and use it in GitHub Desktop.
Remove ssh key form authorized_key files
cd /home/
### you may search for a part of the public key only, but make sure to not match unwanted keys of other users
grep -R -l 'SomeSSHKeyOrHostname' */.ssh/authorized_keys
sed -i '/SomeSSHKeyOrHostname/d' somedeploymentuser1/.ssh/authorized_keys
sed -i '/SomeSSHKeyOrHostname/d' somedeploymentuser2/.ssh/authorized_keys
sed -i '/SomeSSHKeyOrHostname/d' somedeploymentuser3/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment