initial commit

This commit is contained in:
Fabio Scotto di Santolo
2020-07-28 19:28:25 +02:00
commit 4cc88d2f6e
245 changed files with 22820 additions and 0 deletions

33
chapter26/chk_passwd_gid_0.bash Executable file
View 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