initial commit
This commit is contained in:
33
chapter26/chk_passwd_gid_0.bash
Executable file
33
chapter26/chk_passwd_gid_0.bash
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SCRIPT: chk_passwd_gid_0.bash
|
||||
#
|
||||
# PURPOSE: This script searches the /etc/passwd
|
||||
# for all non-root users who are a member of
|
||||
# the system/root group, GID=0
|
||||
#
|
||||
###########################################
|
||||
# DECLARE FILES AND VARIABLES HERE
|
||||
###########################################
|
||||
|
||||
case $(uname) in
|
||||
SunOS) alias awk=nawk
|
||||
;;
|
||||
esac
|
||||
|
||||
###########################################
|
||||
# BEGINNING OF MAIN
|
||||
###########################################
|
||||
|
||||
awk -F ':' '{print $1, $3}' /etc/passwd | while read U G
|
||||
do
|
||||
# If the user is root skip the test
|
||||
if [ $U != 'root' ]
|
||||
then
|
||||
# Test for GID=0
|
||||
if $(id $U | grep -q 'gid=0' )
|
||||
then
|
||||
echo "WARNING: $U is a member of the root/system group"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user