SXXuidfix

Synopsys


# Removing unwanted user/group entries that conflict with ldap
# Each triple passed to the for loop is a username/uid/gid with the values
# that agree with ldap

Script


set -x
if [ "$OS" == "rhel3" ]; then
for USER in "jonas 100 102" "clamav 46 46" "tomcat 91 91"
do
  # make the three parts available as $1, $2, $3
  set -- $USER

  # Find the UID created in /etc/passwd by the RPM
  # part of the issus we're fixing is that these are not static
  RPMUID=`grep $1 /etc/passwd | cut -d":" -f3`

  # Tomcat's UID/GID are fixed, so we'll test this case before trying to find
  # and then chown all the files
  if [ "$RPMUID" != "$2" ]; then
    find / -uid $RPMUID -exec chown $2:$3 {} \;
  fi

  # Now remove the user and group from the flat files
  userdel $1
  groupdel $1

done
fi

Examples and Testing





Marked up in XHTML - ©2005 Thoughtful Solutions Ltd.