Cover V03, I05
Article
Listing 1
Listing 2
Listing 3
Listing 4

sep94.tar


Listing 1: chkduphome script

#!/bin/sh
#
#       chkduphome
#
#       Report account entries in the /etc/passwd file
#       using the same home directories.
#
#       Copyright 1994, Lawrence S Reznick

PW_FILE=/etc/passwd                     # Point to passwd file

DUP_FILE=tempdup.$$                     # egrep search set

echo The following login accounts use the same home dirs as other accounts:

cut -d: -f6 $PW_FILE |
sort |
uniq -c |
egrep -v " 1 " |
sed -e 's/ *[1-9]* //' -e 's/\(.*\)/:\1:/' > $DUP_FILE

egrep -f $DUP_FILE $PW_FILE |
cut -d: -f1,6 |
sort -t: +1 |
tr ':' '        '                       # 2nd arg has only 1 tab

rm $DUP_FILE

[*** End Listing 1 ***]