12-18-2014
The user john doe has primary group users and supplementary group videos. There can be several supplementary groups. Try the id command.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
How can I find find all members in the /etc/password file that belong to the dba group in the /etc/group file? (4 Replies)
Discussion started by: mozartny
4 Replies
2. Shell Programming and Scripting
Hello,
I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job.
linux1
linux2
linux3
linux4
linux5 ......
.
.
.
.
.
1.) How can i enter "password" in script rather asking me?
I was trying this...
ssh... (2 Replies)
Discussion started by: deal732
2 Replies
3. Shell Programming and Scripting
Dear Folks :-)
I want to rsync some files between some servers and preserve files owner and group (not UID or GID), in some machines UID and GID are differents, for example:
a) In the rsync server:
# stat vbseo.php
File: `vbseo.php'
Size: 26758 Blocks: 56 IO... (1 Reply)
Discussion started by: Santi
1 Replies
4. UNIX for Dummies Questions & Answers
From what I have read it possible to create a new group by editing the etc/group and etc/passwd in UNIX two files but a non-experienced user may face many problems such as destroying the file by mistake ot that his changes to these file does not make any difference.
However, there is this... (2 Replies)
Discussion started by: whatev3r
2 Replies
5. AIX
Hi Friends,
I am trying to write a script for finding all the users with the GID 0 i.e. Admin users. can you please help me on this. (1 Reply)
Discussion started by: anoopraok
1 Replies
6. UNIX for Dummies Questions & Answers
Hi there,
One can easily retrieve the uid from a username :
id -u $username
But how can we easily retrieve the gid from a group name?
I mean is there a command without using sed?
sed -nr "s/^$groupname:x:(+):.*/\1/p" /etc/group
Thanks for your help
Santiago (7 Replies)
Discussion started by: chebarbudo
7 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I am checking who belong to the dba group ,
and found that oracle and autosys users are part of this group
cat /etc/group | grep dba
dba::400:oracle,autosys
I thought to found user autosys under group 400 togther with user
oracle , but found it in group 1000 as you can see bellow.... (2 Replies)
Discussion started by: yoavbe
2 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I have a passwd file with 3 users belonging to the the root group (gid=0), but the group file does not list these users as members of the root group?
Shoud I be worried and apart from manually changing it, how can it be remediated?
thx
Norgaard (1 Reply)
Discussion started by: Norgaard
1 Replies
9. Shell Programming and Scripting
/etc/group
tiadm::345:mk789,po312,jo343,ju454,ko453,yx879,iy345,hn453
bin::2:root,daemon
sys::3:root,bin,adm
adm::4:root,daemon
uucp::5:root
/etc/passwd
mk789:x:234:1::/export/home/dummy:/bin/sh
po312:x:234:1::/export/home/dummy:/bin/sh
ju454:x:234:1::/export/home/dummy:/bin/sh... (6 Replies)
Discussion started by: chidori
6 Replies
10. AIX
Hi Everyone,
We are encountering the following issue on AIX 5.3. When we do ls -ltr the list displays only user id and group id instead of user name and group name.
This is happening for all users except root. Whe we do ls -ltr with root user it shows perfectly fine.
When we searched... (25 Replies)
Discussion started by: madhav.kunapa
25 Replies
LEARN ABOUT LINUX
getgroups
GETGROUPS(2) Linux Programmer's Manual GETGROUPS(2)
NAME
getgroups, setgroups - get/set list of supplementary group IDs
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int getgroups(int size, gid_t list[]);
#include <grp.h>
int setgroups(size_t size, const gid_t *list);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
setgroups(): _BSD_SOURCE
DESCRIPTION
getgroups() returns the supplementary group IDs of the calling process in list. The argument size should be set to the maximum number of
items that can be stored in the buffer pointed to by list. If the calling process is a member of more than size supplementary groups, then
an error results. It is unspecified whether the effective group ID of the calling process is included in the returned list. (Thus, an
application should also call getegid(2) and add or remove the resulting value.)
If size is zero, list is not modified, but the total number of supplementary group IDs for the process is returned. This allows the caller
to determine the size of a dynamically allocated list to be used in a further call to getgroups().
setgroups() sets the supplementary group IDs for the calling process. Appropriate privileges (Linux: the CAP_SETGID capability) are
required. The size argument specifies the number of supplementary group IDs in the buffer pointed to by list.
RETURN VALUE
On success, getgroups() returns the number of supplementary group IDs. On error, -1 is returned, and errno is set appropriately.
On success, setgroups() returns 0. On error, -1 is returned, and errno is set appropriately.
ERRORS
EFAULT list has an invalid address.
getgroups() can additionally fail with the following error:
EINVAL size is less than the number of supplementary group IDs, but is not zero.
setgroups() can additionally fail with the following errors:
EINVAL size is greater than NGROUPS_MAX (32 before Linux 2.6.4; 65536 since Linux 2.6.4).
ENOMEM Out of memory.
EPERM The calling process has insufficient privilege.
CONFORMING TO
SVr4, 4.3BSD. The getgroups() function is in POSIX.1-2001. Since setgroups() requires privilege, it is not covered by POSIX.1-2001.
NOTES
A process can have up to NGROUPS_MAX supplementary group IDs in addition to the effective group ID. The set of supplementary group IDs is
inherited from the parent process, and preserved across an execve(2).
The maximum number of supplementary group IDs can be found using sysconf(3):
long ngroups_max;
ngroups_max = sysconf(_SC_NGROUPS_MAX);
The maximum return value of getgroups() cannot be larger than one more than this value.
SEE ALSO
getgid(2), setgid(2), getgrouplist(3), initgroups(3), capabilities(7), credentials(7)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-06-03 GETGROUPS(2)