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

28
chapter26/search_group_id.bash Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
#
# SCRIPT: search_group_id.Bash
# AUTHOR: Randy Michael
# DATE: 14/4/2007
# REV: 1.0
# PURPOSE: This script is used to list the group(s) associated
# with each user defined in the /etc/passwd file.
#
#
###########################################
# DECLARE FILES AND VARIABLES HERE
###########################################
case $(uname) in
SunOS) alias awk=nawk
;;
esac
#########################################
# BEGINNING OF MAIN
#########################################
cat /etc/passwd | awk -F : '{print $1}' | while read ID
do
echo -e "${ID}: \c"
id -Gn $ID
done