How to list group members in solaris 9


 
Thread Tools Search this Thread
Operating Systems Solaris How to list group members in solaris 9
# 1  
Old 04-30-2009
PHP How to list group members in solaris 9

Hi,

I already gone through with old post regarding listing the group members and tried the command
getenv group other
the result is

other::1:root

i listed my part of the /etc/passwd file below
test1:x:100:1::/home/test1:/bin/sh
test2:x:101:1::/home/test2:/bin/ksh
test3:x:102:1::/home/test3:/bin/ksh

the above three users belong to the other group but the username are not listed in the result.
please let me know the correct way of listing the group members

Thanks
Maro
# 2  
Old 04-30-2009
Quote:
Originally Posted by vr_mari
I already gone through with old post regarding listing the group members and tried the command
getenv group other
the result is

other::1:root
You mean:
getent group other
Quote:

i listed my part of the /etc/passwd file below
test1:x:100:1::/home/test1:/bin/sh
test2:x:101:1::/home/test2:/bin/ksh
test3:x:102:1::/home/test3:/bin/ksh

the above three users belong to the other group but the username are not listed in the result.
please let me know the correct way of listing the group members
Your group file isn't correctly maintained. There is no much thing to do outside parsing the password table which would be trivial.
# 3  
Old 05-01-2009
Hi

My command is
getenv group other

the result is only

other::1:root


Note : i think the genent command is just fetch the string from the /etc/group file.But in the group fiile the last field "user list" only list the secondary users of the group.but i like to list the primary group of the users. please let me know any other way to list the group members
# 4  
Old 05-01-2009
`/usr/bin/logins -g other`

or

`/usr/bin/logins -o -g sys`

depending on how you need it formatted.

`man logins` for more information.


By the way; you're all fired. Turn in your badges at the front desk.

Last edited by seg; 05-01-2009 at 06:52 AM..
# 5  
Old 05-01-2009
Hi Seg

Thanks for your reply.Will your command provide the answer for only loged in users or it will list all the users in that group (including those are not logged in)...

Thanks
Maro
# 6  
Old 05-01-2009
Thanks seg for the tip. I had forgotten the logins command.

vr_mari: not sure about why you insist telling you use getenv while the output clearly shows you run getent. By the way, getent not only look in the /etc files but also in whatever remote database (nis, ldap, ...) might be declared in nsswitch.conf.
# 7  
Old 05-01-2009
The "logins" command lists all users whether or not they are logged in.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Setfacl and granting permissions to a group and its members on a directory

Hi! I created a group HACKERS and made the user "demo" its member. $ id demo uid=500(demo) gid=500(demo) groups=500(demo),502(HACKERS) $ Next, I granted read and execute permissions to the group "HACKERS" on /var/log/httpd as shown below: setfacl -m "g:HACKERS:r-x"... (2 Replies)
Discussion started by: indiansoil
2 Replies

2. Linux

members in a group

Hi all, I am new to Linux.Can anyone tell me how to display or list all the members in a group? Thanks in advance. (9 Replies)
Discussion started by: arthi
9 Replies

3. AIX

How to allow group members to kill process?

Hey I'm writing a script that creates some processes,and some scripts which kill those processes. the question is Simply: How can I allow group members to be able to kill processes created by other member at the same group? I need your help as soon as possible Thanks for your help in... (4 Replies)
Discussion started by: The Dark Knight
4 Replies

4. Shell Programming and Scripting

How to get a list of group members?

Is there a command to get a list of group members? Something similar to the groups command, but instead of passing a username and returning groups, you pass it a groupname, and it returns members? It is difficult to do it manually because the group membership information is split across two... (5 Replies)
Discussion started by: akbar
5 Replies

5. Programming

allowing members of a group to kill a process

I've written a python program where I want to allow members of a specific group the ability to kill it, and I'm not sure how to do it. I've been looking at the setuid() and setgid() and similar functions in the os module, but haven't been able to get them to work. I can't seem to change the uid or... (1 Reply)
Discussion started by: vastcharade
1 Replies

6. Solaris

make issue when I add some members into a NIS group on solaris 9,please help !!

Hello Sir, I want to add some members into a group on NIS domain, but when I run "/usr/ccs/bin/make group" to update the group map it was failed :-( the error message is : problem storing develop... (4 Replies)
Discussion started by: lk74612
4 Replies

7. Solaris

How do you list users in a solaris group

I need to list all users in a group. This is a large unix site running nis+. (6 Replies)
Discussion started by: gillbates
6 Replies

8. UNIX for Dummies Questions & Answers

listing members of a unix group

I know there is a "groups" command to list the groups a user belongs to, but how about the opposite? Is there a standard command to find out which users belong to a particular group? (2 Replies)
Discussion started by: ovaska
2 Replies
Login or Register to Ask a Question