security.d/chk_homedirs

changeset 8
5209729bbbac
parent 5
fe3130d22800
child 14
59e07bba67cc
equal deleted inserted replaced
7:2c71590b2373 8:5209729bbbac
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # $Id$
4 #
5 ############################################################################# 3 #############################################################################
6 # Copyright (C) 2005 4 # Copyright (C) 2005-2009
7 # 5 #
8 # Michiel Broek <mbse@mbse.dds.nl> 6 # Michiel Broek <mbse@mbse.eu>
9 # Beekmansbos 10 7 # Beekmansbos 10
10 # 1971 BV IJmuiden 8 # 1971 BV IJmuiden
11 # the Netherlands 9 # the Netherlands
12 # 10 #
13 # This file is part of SlackSecCheckSripts. 11 # This file is part of SlackSecCheckSripts.
56 # Check home directories. Directories should not be owned by someone else 54 # Check home directories. Directories should not be owned by someone else
57 # or writeable. 55 # or writeable.
58 # 56 #
59 while read uid homedir; do 57 while read uid homedir; do
60 if [ -d ${homedir}/ ] ; then 58 if [ -d ${homedir}/ ] ; then
61 file=`/bin/ls -ld ${homedir}` 59 file=`/bin/ls -ld ${homedir}/`
62 printf -- "$uid $file\n" 60 printf -- "$uid $file\n"
63 fi 61 fi
64 done < $MPBYPATH | 62 done < $MPBYPATH |
65 awk '$1 != $4 && $4 != "root" { printf "\tuser %s home directory is owned by %s.\n", $1, $4 } 63 awk '$1 != $4 && $4 != "root" { printf "\tuser %s home directory is owned by %s.\n", $1, $4 }
66 $2 ~ /^.....w/ { printf "\tuser %s home directory %s is group writeable.\n", $1, $10 } 64 $2 ~ /^.....w/ { printf "\tuser %s home directory %s is group writeable.\n", $1, $10 }

mercurial