#!/bin/sh

check() {
	[ -s "$1" ] || return 1
	grep -qv '^[ \t]*#' -- "$1"
}

OK=yes
#OK=

getent group wheel \
| cut -f4 -d: \
| tr ',' '\n' \
| while read user; do
	home="`getent passwd "$user" | cut -f6 -d:`"
	if check "$home/.ssh/authorized_keys" \
	   || check "$home/.ssh/authorized_keys2"; then
		echo $user will have ssh access
		#OK=yes
	else
		echo "WARNING: wheel user $user WILL NOT have SSH access!"
		OK=no
	fi
done
