This question already has an answer here:
I'm looking to lock down our Solaris 10, RHEL 5, and SLES 11.2 servers. It has come to my attention that some of the users have no passphrase for their SSH keys. Is there a way I can check for this with a script?
Below I have posted the script I wrote from the answer @tylerl gave me. I'm posting this incase someone else needs this info in the future. There is most likely better ways to do this, but this works. I still need to write additional scripts for the accounts that are not automounted. Thanks everyone for all the help
#!/bin/bash # This script is for checking for a blank passphrase. Meaning no passphrase to secure your SSH key. # Script most be run as root. # Example: sudo ./check-sshkeys mount share:/vol/home /mnt ls /mnt >/tmp/ls for s in `cat /tmp/ls` do echo -e "\e[1m User $s \033[0m " if ls /mnt/$s/.ssh/id_rsa 2>/dev/null then grep ENCRYPTED /mnt/$s/.ssh/id_rsa || echo -e "No RSA passphrase" else echo "RSA key not found" fi if ls /mnt/$s/.ssh/id_dsa 2>/dev/null then grep ENCRYPTED /mnt/$s/.ssh/id_dsa || echo -e "No DSA passphrase" else echo "DSA key not found" fi done rm /tmp/ls umount /mnt