Skip to content

Instantly share code, notes, and snippets.

@s4s0l
Created April 27, 2017 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s4s0l/f3631a54fcfafe34160e93bcb6fc3a9f to your computer and use it in GitHub Desktop.
Save s4s0l/f3631a54fcfafe34160e93bcb6fc3a9f to your computer and use it in GitHub Desktop.
List all ssh keys for all users
#!/bin/bash
for X in $(cut -f6 -d ':' /etc/passwd |sort |uniq); do
if [ -s "${X}/.ssh/authorized_keys" ]; then
echo "### ${X}: "
cat "${X}/.ssh/authorized_keys"
echo ""
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment