#! /bin/sh
#
# Script to show which accounts are currently locked.

tmpfile="/tmp/check.$$"

if [ `whoami` != "root" ]
then
   echo "Only root can run this script"
   exit 1
fi

cat /etc/passwd | cut -d ':' -f1 > "$tmpfile"
sync
sleep 1

while read id
do
   if [ `passwd -S "$id" | cut -d ' ' -f2` = "L" ]
   then
      echo "$id"
   fi
done < "$tmpfile"

sync
sleep 1
rm $tmpfile
exit 0

