Linux / UNIX Tech Support Forum
This is a discussion on any way to view view ALL members of a group? within the Ubuntu / Debian forums, part of the Linux Distribution category; The thing I learnt a few days ago is that users to whom this particular group is primary will not ...
|
|||||||
| Ubuntu / Debian Discussion about Debian or Ubuntu Linux related problems. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
| Sponsored Links | ||
|
|
|
||||
|
To print the groups a user is in use groups command. For example print all groupname vivek user belongs to:
Code:
groups vivek Code:
vivek : vivek adm dialout cdrom floppy audio dip video plugdev scanner netdev lpadmin powerdev admin dba vboxusers Code:
egrep "^groupname" /etc/group egrep "^adm" /etc/group egrep "^ftpusers" /etc/group
__________________
Vivek Gite Linux Evangelist |
|
||||
|
Code:
[root@localhost ~]# useradd x -g users [root@localhost ~]# egrep "^users" /etc/group users:x:100: [root@localhost ~]# id x uid=502(x) gid=100(users) Gruppen=100(users) Last edited by guzenkov; 18-05-2008 at 10:57 PM. Reason: typo |
|
||||
|
Try
Code:
id -G -n username Here is an example: Code:
useradd rocky id -Gn rocky Code:
groupadd ftp Code:
usermod -a -G ftp rocky Code:
id -Gn rocky
__________________
Rocky Jr. What's wrong? I hope I am not making you uncomfortable... Never send a boy to do a mans job. Last edited by rockdalinux; 19-05-2008 at 01:05 AM. |
|
||||
|
Firstly, your examples work with supplementary groups, not primary as is required in my question. Secondly, you show to what groups user belongs, but the question is what users belong to the group.
|
|
||||
|
So you want command to print ALL members of a group. For example, if I type
somecommand GROUPNAME It should print list of users in both primary and secondary group. Am i right? if so you need to write a small shell script to query both /etc/passwd and /etc/group. Lemme know so that I can come with something. edit: Have you tried members command? Code:
members --all groupname members --all ftp members is a program that sends a space-separated list of secondary and primary member names to its standard output.
__________________
Rocky Jr. What's wrong? I hope I am not making you uncomfortable... Never send a boy to do a mans job. Last edited by rockdalinux; 19-05-2008 at 01:40 AM. |
|
||||
|
Thank you, rockdalinux.
It looks like you got it. I think members command does it, but the problem that I don't have such command in the repositories of neither Archlinux, nor madriva (the two distributions I currently work with). Thus it does not apply to them. I will be really surprised if this simple task is not performed by some standard linux tool. |
|
||||
|
You are welcome.
You can grab source code from Debian repo - http://ftp.de.debian.org/debian/pool...90831-5.tar.gz and always compile it on any Linux distro. Code:
wget http://ftp.de.debian.org/debian/pool/main/m/members/members_19990831-5.tar.gz tar zxvf members_19990831-5.tar.gz cd members-19990831/ make ./members groupname make install cd members ftp
__________________
Rocky Jr. What's wrong? I hope I am not making you uncomfortable... Never send a boy to do a mans job. |
![]() |
| Tags |
| groups , linux |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MP3 player (Sansa View) | Albion | Ubuntu / Debian | 1 | 02-05-2008 11:46 PM |
| How To View This Cbt And What To Do | linuxqu | Linux software | 2 | 24-03-2008 07:09 PM |
| View log files under Linux | sweta | Getting started tutorials | 0 | 30-05-2007 12:31 AM |
| What is the maximum number of members that a group can have? | warren | Linux software | 4 | 29-03-2006 07:31 AM |
| View MRTG on webpage | sueAnne | Linux software | 1 | 10-03-2005 12:12 PM |