Author |
Message
|
tkane |
Posted: Fri Apr 02, 2004 8:41 am Post subject: identyfing users in mqm group |
|
|
 Voyager
Joined: 23 Dec 2002 Posts: 82 Location: Kansas City
|
Hello,
My quest today is to figure out who all is in the mqm group on several (hundred) AIX, Solaris and HP machines.
I thought I had a good script for this in which I greped /etc/group to get the group number for mqm and then greped /etc/passwd for that number.
But today, I found several IDs that are in multiple groups and mqm is the 2nd group.
I want to move these users out, and / or move them to the MQ Wrapper but in oder to do that I'm going to need to figure out who and once I'm done make sure that they don't get the SA to put them back in.
TIA
Tom |
|
Back to top |
|
 |
tkane |
Posted: Tue Apr 06, 2004 7:23 am Post subject: one solution |
|
|
 Voyager
Joined: 23 Dec 2002 Posts: 82 Location: Kansas City
|
Where are all the Unix scripters?
I came up with one solution on my own.
Anybody have anything that will shoot it down?
Code: |
SCRIPT="mqmgroup"
group="mqm"
DATE=`/usr/bin/date +%Y%m%d.%R`
tmpfile="/tmp/gid.list.mqm.$DATE"
users=`wc -l /etc/passwd | awk '{print $1}'`
for i in $(cat /etc/passwd | cut -f 1,1 -d:)
do
id $i >> $tmpfile
done
grep "($group)" $tmpfile
mqm_users=`grep -c "($group)" $tmpfile`
echo $SCRIPT: there are `grep -c "($group)" $tmpfile` users in the $group group on `uname -n`
echo "$SCRIPT: mqm_users= $mqm_users"
echo "$SCRIPT: users= $users"
let "mqm_users = $mqm_users * 100"
let "percent = $mqm_users / $users"
rm $tmpfile
echo "$SCRIPT: mqm users are approx $percent percent of total users on `uname -n`"
|
The odd thing is that it's reporting everybody in one or two boxes being in the mqm group as a secondary group.
TIA
Tom |
|
Back to top |
|
 |
bbburson |
Posted: Thu Apr 08, 2004 7:29 am Post subject: comments on your script |
|
|
Partisan
Joined: 06 Jan 2004 Posts: 378 Location: Nowhere near a queue manager
|
Tom,
I ran your script on a Sun server and had to add the "-a" flag to the id command to get it to show secondary group memberships.
On the server where you see everyone in the mqm group, what does the mqm line in /etc/group look like? It should have all the secondary memberships on it.
Bruce Burson |
|
Back to top |
|
 |
tkane |
Posted: Fri Apr 09, 2004 11:40 am Post subject: |
|
|
 Voyager
Joined: 23 Dec 2002 Posts: 82 Location: Kansas City
|
Bruce,
Thanks for the catch of '-a' I missed that.
I can't see anything about the mqm group line in /etc/group that indicates more than 20 users. Although there are about 200 on that one box.
Good news is most boxes aren't configured that way.
Bad news is I don't know how many are right now.
I'm going to try and push the updated script to all my test boxes this weekend and see what it says.
Thanks
Tom |
|
Back to top |
|
 |
Philip Morten |
Posted: Thu Apr 15, 2004 2:03 am Post subject: identyfing users in mqm group |
|
|
Master
Joined: 07 Mar 2002 Posts: 230 Location: Hursley Park
|
You might want to see if the command logins -g mqm will give you what you want, it's available on all your OS ( except for AIX earlier than 5.2 where lsgroup might help ) |
|
Back to top |
|
 |
|