AIX Unix.. number of users on system in a particular group


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users AIX Unix.. number of users on system in a particular group
# 1  
Old 06-24-2003
AIX Unix.. number of users on system in a particular group

Does anyone know what pipe string might be used to determine how many people are logged onto an AIX system where a group ID begins with lets say 4.

In other words, I am looking to query the system for the number of people currently logged onto a system that belong to any group starting with 4. Could be 400, 4102, 444, etc.
# 2  
Old 06-26-2003
This will give you a list of users and gid starting with 4 - modify it for your needs ( sorry it's what I use to write scripts in).

Code:
#!/bin/csh
set allusers="`who -q`"
foreach xx ($allusers)
        if ("$xx" == "#") then
                 exit
        else
                # find info on user
                set mygid=`grep $xx /etc/passwd|awk -F: '{print $4}'`
                if ("$mygid" != "") then
                set first=`echo $mygid|awk '{print substr($0,0,1)}'`
                        if ("$first" == "4") then
                                # let me know who
                                echo $xx"  "$mygid
                        endif
                endif
        endif
end

Also note it will only give you folks that are in the password file - if you're using NIS, you would have to change where it's looking.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To get total number of users and their groups in remote UNIX machine

Hi All I am trying to do ssh to different server and on the remote server for each user trying to get groups of that user but i am not getting the required result. ssh username@ip_address "for i in $( cat /etc/passwd| cut -d: -f1);do groups $i done;exit" >>abc.txt only names are... (5 Replies)
Discussion started by: Ekamjot
5 Replies

2. What is on Your Mind?

Invitation to join the UNIX Forums Users Group on LinkedIn

Hi Folks, You’re invited to be the first to join the UNIX Forums Users Group on LinkedIn. Joining will allow you to find and contact other UNIX Forums Users Group members on LinkedIn. The goal of this group is to help members: Reach other members of the UNIX Forums Users Group Accelerate... (2 Replies)
Discussion started by: Neo
2 Replies

3. Emergency UNIX and Linux Support

List of users on an AIX system

Is there a way to generate a list of users with name, user ID, and Security Group? It is urgent for audit purposes. Please help. (5 Replies)
Discussion started by: ggayathri
5 Replies

4. UNIX for Advanced & Expert Users

Best practices with AIX system users?

All, Preliminaries: AIX 5.2 Tivoli Maestro 6.1 (9.2) I am auditing an older AIX system. As it stands, I can login remotely to the system using the Maestro application's user account. This is BAD. The administrator claims that he cannot disable the remote login, because it will... (1 Reply)
Discussion started by: Thatto
1 Replies

5. Shell Programming and Scripting

List ALL users in a Unix Group (Primary and Secondary)

Is there a command or better combination of cmds that will give me the list of Unix users in a particular Unix group whether their primary group is that group in question (information stored in /etc/passwd) or they are in a secondary group (information stored in /etc/group). So far all I got... (5 Replies)
Discussion started by: ckmehta
5 Replies

6. AIX

activating volume group on system after higher level aix installation

Hi, if I do install aix 5.3 on the rootvg of an aix 4.3.3 system (having rootvg and data1vg), is it possible to varyonvg the data1vg after the installation ? (any caution ?) (1 Reply)
Discussion started by: astjen
1 Replies

7. Post Here to Contact Site Administrators and Moderators

UNIX Forums Users Group - LinkedIn ?

I received an email claiming to invite me to some sort of user group connected through this forum. I did not click the link because the email is of dubious appearance. Is this group legit and is there other information about it someplace? Thank you. (4 Replies)
Discussion started by: Bobby
4 Replies
Login or Register to Ask a Question