Created
April 16, 2013 06:08
-
-
Save armanm/5393730 to your computer and use it in GitHub Desktop.
This shell script lets you check who can login to your server using SSH keys
This file contains 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/sh | |
# | |
# check who can login to a user's account | |
# | |
check_user() | |
{ | |
local IFS=: | |
while read user home; do | |
test -e $home/.ssh/authorized_keys || continue | |
cut -d' ' -f3 $home/.ssh/authorized_keys | sed -e "s/^/user $user: /" | |
done | |
} | |
cut -d: -f1,6 /etc/passwd | check_user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment