home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / cops_104.zip / cops_104 / extra_src / rhosts_sweeper < prev    next >
Text File  |  1992-03-10  |  558b  |  19 lines

  1. #!/bin/sh
  2. #
  3. #  This just searches for rhosts with a + in them... needs to be run
  4. # as root to be effective (to access each user's rhosts file; run on
  5. # your NFS server if applicable), but might be plugged into the rest of
  6. # cops if you run things as root normally...
  7.  
  8. (ypcat passwd; cat /etc/passwd) | awk -F: '{print $1, $(NF-1)}' |
  9. while read user dir ; do
  10.     target="$dir/.rhosts"
  11.     if test -s "$target" ; then
  12.         grep "+" "$target" > /dev/null
  13.         if test "$?" = "0" ; then
  14.             echo "Warning!  A plus ("+") was found in $user's .rhosts file!"
  15.             fi
  16.         fi
  17.     done
  18.  
  19.