Created
April 27, 2017 07:12
-
-
Save s4s0l/f3631a54fcfafe34160e93bcb6fc3a9f to your computer and use it in GitHub Desktop.
List all ssh keys for all users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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