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 ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
||||
|
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 |
|
||||
|
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; 05-18-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. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat Last edited by rockdalinux; 05-19-2008 at 01:05 AM. |
|
||||
|
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. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat Last edited by rockdalinux; 05-19-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. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
![]() |
| Bookmarks |
| Tags |
| groups , linux |
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| MP3 player (Sansa View) | Albion | Ubuntu / Debian | 1 | 05-02-2008 11:46 PM |
| How To View This Cbt And What To Do | linuxqu | Linux software | 2 | 03-24-2008 07:09 PM |
| View log files under Linux | sweta | Getting started tutorials | 0 | 05-30-2007 12:31 AM |
| What is the maximum number of members that a group can have? | warren | Linux software | 4 | 03-29-2006 07:31 AM |
| View MRTG on webpage | sueAnne | Linux software | 1 | 03-10-2005 12:12 PM |