Shell script to Finding Accounts with No Password

Shell script to Finding Accounts with No Password

listuserwopassword.bash

#!/bin/bash
# Shell script to Finding Accounts with No Password
# Useful to improve system security
# Copyright (c) 2005 nixCraft project
# This script is licensed under GNU GPL version 2.0 or above
# For more info, please visit:
#            http://cyberciti.biz/shell_scripting/bmsinstall.php
# TODO
# - Disable all account w/o password
# - Send an email to admin
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------

SPATH="/usr/local/etc/bashmonscripts"
INITBMS="$SPATH/defaults.conf"
[ ! -f $INITBMS ] && exit 1 || . $INITBMS

if ( isRootUser ); then
	$GREP -v -E "^#" $SHADOW_FILE | $AWK -F: '$2 == "" { print $1 }'
else
	echo "Permission denied [$($ID -u)]"
fi