Skip to content

Commit

Permalink
Fixing uid scan in bash script
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrobey committed Nov 5, 2024
1 parent bd363f7 commit ca9b6ba
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions extras/manage/bin/addAACUsers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ fi
# First see what user ids and group ids are used by files in
# the Home directory tree and set the max to
echo "Starting scan for last used uid and gid in our range (12050, 12000) respectively"
sudo find ${HOMEDIR_BASE} -maxdepth 2 -print0 | while read -r -d '' file; do
while read -r -d '' file
do
uid=`sudo stat -c %u $file`
if [[ ! -z "$uid" ]]; then
if (( $uid > ${HACKATHONLASTUSER} )); then
Expand All @@ -53,8 +54,12 @@ sudo find ${HOMEDIR_BASE} -maxdepth 2 -print0 | while read -r -d '' file; do
HACKATHONLASTGROUP=$gid
fi
fi
#echo "User id is $uuid Group id is $gid for file $file"
done
#echo "User id is $uid Group id is $gid for file $file"
done < <(sudo find ${HOMEDIR_BASE} -maxdepth 2 -print0)
echo ""
echo "After home directory scan last User id is $HACKATHONLASTUSER Group id is $HACKATHONLASTGROUP"
echo ""

echo "Starting scan of /etc/group and /etc/passwd for used gids and uids"
while IFS='' read -r line; do
gid=`echo $line | cut -d':' -f 3`
Expand Down

0 comments on commit ca9b6ba

Please sign in to comment.