Skip to content

Instantly share code, notes, and snippets.

@hboetes
hboetes / findunsecuredsshkeys.sh
Created December 3, 2021 12:42
findunsecuredsshkeys
#!/bin/sh
for dir in $(getent passwd|awk -F : '{print $6}'); do
if [ ! -d $dir/.ssh ]; then
continue
fi
find $dir/.ssh -type f | while read file; do
if ! file "$file" | grep -iq 'private key'; then
continue
fi
if ssh-keygen -P '' -y -f "$file" > /dev/null 2>&1; then