/etc/passwd shows user in a group, but /etc/group does notTemporary changes to /etc/passwd or /etc/group - how-toDomain Admins vs. Administrators in Windows AD DCJenkins/Hudson - LDAP group *lookup* does not workHow does LDAP handle supplementary/secondary user groups?Can I put /etc/passwd, /etc/group and /etc/shadow on an NFS share?Inconsistent information in Active Directory Members and Member Of propertiesFolder rights doesn't work on group, but does on userSamba does not reload user group membersUnable to authentication after manual edit of /etc/passwd and /etc/shadowSync Active Directory Users in FreeNAS
Could I be denied entry into Ireland due to medical and police situations during a previous UK visit?
What does the behaviour of water on the skin of an aircraft in flight tell us?
Lunar orbital rendezvous
The qvolume of an integer
If Sweden was to magically float away, at what altitude would it be visible from the southern hemisphere?
How to prevent bad sectors?
Uncommanded roll at high speed
Comment dit-on « I’ll tell you what » ?
Can a helicopter mask itself from Radar?
Can I install a row of bricks on a slab to support a shed?
What caused the tendency for conservatives to not support climate change regulations?
Fastest way to perform complex search on pandas dataframe
Expenditure in Poland - Forex doesn't have Zloty
Why is there a need to modify system call tables in linux?
Can't connect to Internet in bash using Mac OS
What is/are this/these giant NASA box(es)?
Is there an explanation for Austria's Freedom Party virtually retaining its vote share despite recent scandal?
Why would Lupin kill Pettigrew?
How can I include a header file that contains `>` in its name?
A pair of spaces equivalent to a pair of CW-complexes
Are UK pensions taxed twice?
Beginner's snake game using PyGame
Thousands and thousands of words
Draw a checker pattern with a black X in the center
/etc/passwd shows user in a group, but /etc/group does not
Temporary changes to /etc/passwd or /etc/group - how-toDomain Admins vs. Administrators in Windows AD DCJenkins/Hudson - LDAP group *lookup* does not workHow does LDAP handle supplementary/secondary user groups?Can I put /etc/passwd, /etc/group and /etc/shadow on an NFS share?Inconsistent information in Active Directory Members and Member Of propertiesFolder rights doesn't work on group, but does on userSamba does not reload user group membersUnable to authentication after manual edit of /etc/passwd and /etc/shadowSync Active Directory Users in FreeNAS
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I want to verify that the user account filesender_1 is a member of the group valid_senders.
When I look at /etc/group, filesender_1 is not there:
valid_senders:x:12345:production_1
I read this as "production_1 is the only member of the group valid_senders, whose group id is 12345."
However:
When I look at /etc/passwd, the group id for valid_senders is listed for filesender_1 ...
filesender_1:x:1515:12345:filesender_1:/local/home/filesender_1:/bin/sh
... so I know valid_senders is the primary group for filesender_1.
Is this a surprising discrepancy, or is it normal for /etc/group to list only members where the group is secondary?
linux groups passwd
add a comment |
I want to verify that the user account filesender_1 is a member of the group valid_senders.
When I look at /etc/group, filesender_1 is not there:
valid_senders:x:12345:production_1
I read this as "production_1 is the only member of the group valid_senders, whose group id is 12345."
However:
When I look at /etc/passwd, the group id for valid_senders is listed for filesender_1 ...
filesender_1:x:1515:12345:filesender_1:/local/home/filesender_1:/bin/sh
... so I know valid_senders is the primary group for filesender_1.
Is this a surprising discrepancy, or is it normal for /etc/group to list only members where the group is secondary?
linux groups passwd
add a comment |
I want to verify that the user account filesender_1 is a member of the group valid_senders.
When I look at /etc/group, filesender_1 is not there:
valid_senders:x:12345:production_1
I read this as "production_1 is the only member of the group valid_senders, whose group id is 12345."
However:
When I look at /etc/passwd, the group id for valid_senders is listed for filesender_1 ...
filesender_1:x:1515:12345:filesender_1:/local/home/filesender_1:/bin/sh
... so I know valid_senders is the primary group for filesender_1.
Is this a surprising discrepancy, or is it normal for /etc/group to list only members where the group is secondary?
linux groups passwd
I want to verify that the user account filesender_1 is a member of the group valid_senders.
When I look at /etc/group, filesender_1 is not there:
valid_senders:x:12345:production_1
I read this as "production_1 is the only member of the group valid_senders, whose group id is 12345."
However:
When I look at /etc/passwd, the group id for valid_senders is listed for filesender_1 ...
filesender_1:x:1515:12345:filesender_1:/local/home/filesender_1:/bin/sh
... so I know valid_senders is the primary group for filesender_1.
Is this a surprising discrepancy, or is it normal for /etc/group to list only members where the group is secondary?
linux groups passwd
linux groups passwd
asked Jun 17 '14 at 17:06
Thomas L HoladayThomas L Holaday
54341217
54341217
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
Yes, this discrepancy is normal. I've seen it so many times I stopped looking at the /etc/passwd and /etc/group files and instead started looking at group memberships the way they should be looked at: getent group <groupname> and groups <username>.
1
This doesn't show the right result...@isd's answer is better!
– 71GA
Nov 9 '17 at 13:31
2
This is not a solution to the problem... it in fact demonstrates the discrepancy. getent group <groupname> does not list users whose primary group is groupname, only those who've been added to groupname as a supplementary group.
– DJ Far
Jan 19 '18 at 14:52
add a comment |
Yes, there is a difference between the primary and supplementary groups. The primary group is the main one shown in /etc/passwd, that a user is in upon login. For a user to be in a supplementary group, their user name is added to the group entry in /etc/group. If you use id -a <user>, it will show the primary and the supplementary groups. The supplementary groups give access to resources, but any new files are created with primary group.
You can change a users currently active primary group using the newgrp command.
It is not necessary for a user to have the primary group also be a secondary group. All it will do is reduce the number of secondary groups a user can be part of. Traditionally a user was limited to 32 secondary groups, but that may have changed in recent years.
usermod can set a users primary and supplementary groups in one command. Using a configuration management tool like puppet can also do that without having to worry about what specific command is necessary on different types of unixes.
add a comment |
There exists a program called members you can install on most linux distros that lists the actual members of a group whether it is their primary group or a supplementary group.
Typically, when a user is created without specifying a group with -g or --gid, the default behavior is to set their primary group as their username, and this gid is not placed in the /etc/group file. Hence files and directories created by the user joe will have ownership joe:joe. But you will not find group 'joe' in the /etc/group file.
If you add the user joe to group 'students', then running
getent group students
will show joe in the list of users in group students.
Running the program
members <groupname>
on a group will show users who are members, either primary or supplementary, of groupname.
add a comment |
Generally speaking, system administrators should add the user to their primary group's member list in /etc/group because the getpwent() family of system calls will remove duplicates when called. Programs aren't supposed to read /etc/group or /etc/passwd directly, they are supposed to use the system calls. All this has been true for at least 20 years now, and probably much longer.
The two halves of your answer contradict each other.
– womble♦
May 15 at 23:02
Don't know how to say it better, nor what you mean by halves, but I'll try an example. My primary group is sysman, gid 1200. So in my /etc/password entry, the gid field contains 1200, and my userid also appears in the list of userids for group sysman in /etc/group. When any program uses the standard means of asking for my group memberships, everything works. But remember programs should never read / etc/passed or /etc/group, that dodges the name service switch and is very bad practice. Use the system calls.
– Medievalist
May 19 at 2:37
add a comment |
You should uselid -g <group>'
4
This needs a better explanation.
– Sven♦
Feb 13 '18 at 12:56
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f605812%2fetc-passwd-shows-user-in-a-group-but-etc-group-does-not%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Yes, this discrepancy is normal. I've seen it so many times I stopped looking at the /etc/passwd and /etc/group files and instead started looking at group memberships the way they should be looked at: getent group <groupname> and groups <username>.
1
This doesn't show the right result...@isd's answer is better!
– 71GA
Nov 9 '17 at 13:31
2
This is not a solution to the problem... it in fact demonstrates the discrepancy. getent group <groupname> does not list users whose primary group is groupname, only those who've been added to groupname as a supplementary group.
– DJ Far
Jan 19 '18 at 14:52
add a comment |
Yes, this discrepancy is normal. I've seen it so many times I stopped looking at the /etc/passwd and /etc/group files and instead started looking at group memberships the way they should be looked at: getent group <groupname> and groups <username>.
1
This doesn't show the right result...@isd's answer is better!
– 71GA
Nov 9 '17 at 13:31
2
This is not a solution to the problem... it in fact demonstrates the discrepancy. getent group <groupname> does not list users whose primary group is groupname, only those who've been added to groupname as a supplementary group.
– DJ Far
Jan 19 '18 at 14:52
add a comment |
Yes, this discrepancy is normal. I've seen it so many times I stopped looking at the /etc/passwd and /etc/group files and instead started looking at group memberships the way they should be looked at: getent group <groupname> and groups <username>.
Yes, this discrepancy is normal. I've seen it so many times I stopped looking at the /etc/passwd and /etc/group files and instead started looking at group memberships the way they should be looked at: getent group <groupname> and groups <username>.
answered Jun 17 '14 at 17:12
JohnJohn
7,99112129
7,99112129
1
This doesn't show the right result...@isd's answer is better!
– 71GA
Nov 9 '17 at 13:31
2
This is not a solution to the problem... it in fact demonstrates the discrepancy. getent group <groupname> does not list users whose primary group is groupname, only those who've been added to groupname as a supplementary group.
– DJ Far
Jan 19 '18 at 14:52
add a comment |
1
This doesn't show the right result...@isd's answer is better!
– 71GA
Nov 9 '17 at 13:31
2
This is not a solution to the problem... it in fact demonstrates the discrepancy. getent group <groupname> does not list users whose primary group is groupname, only those who've been added to groupname as a supplementary group.
– DJ Far
Jan 19 '18 at 14:52
1
1
This doesn't show the right result...@isd's answer is better!
– 71GA
Nov 9 '17 at 13:31
This doesn't show the right result...@isd's answer is better!
– 71GA
Nov 9 '17 at 13:31
2
2
This is not a solution to the problem... it in fact demonstrates the discrepancy. getent group <groupname> does not list users whose primary group is groupname, only those who've been added to groupname as a supplementary group.
– DJ Far
Jan 19 '18 at 14:52
This is not a solution to the problem... it in fact demonstrates the discrepancy. getent group <groupname> does not list users whose primary group is groupname, only those who've been added to groupname as a supplementary group.
– DJ Far
Jan 19 '18 at 14:52
add a comment |
Yes, there is a difference between the primary and supplementary groups. The primary group is the main one shown in /etc/passwd, that a user is in upon login. For a user to be in a supplementary group, their user name is added to the group entry in /etc/group. If you use id -a <user>, it will show the primary and the supplementary groups. The supplementary groups give access to resources, but any new files are created with primary group.
You can change a users currently active primary group using the newgrp command.
It is not necessary for a user to have the primary group also be a secondary group. All it will do is reduce the number of secondary groups a user can be part of. Traditionally a user was limited to 32 secondary groups, but that may have changed in recent years.
usermod can set a users primary and supplementary groups in one command. Using a configuration management tool like puppet can also do that without having to worry about what specific command is necessary on different types of unixes.
add a comment |
Yes, there is a difference between the primary and supplementary groups. The primary group is the main one shown in /etc/passwd, that a user is in upon login. For a user to be in a supplementary group, their user name is added to the group entry in /etc/group. If you use id -a <user>, it will show the primary and the supplementary groups. The supplementary groups give access to resources, but any new files are created with primary group.
You can change a users currently active primary group using the newgrp command.
It is not necessary for a user to have the primary group also be a secondary group. All it will do is reduce the number of secondary groups a user can be part of. Traditionally a user was limited to 32 secondary groups, but that may have changed in recent years.
usermod can set a users primary and supplementary groups in one command. Using a configuration management tool like puppet can also do that without having to worry about what specific command is necessary on different types of unixes.
add a comment |
Yes, there is a difference between the primary and supplementary groups. The primary group is the main one shown in /etc/passwd, that a user is in upon login. For a user to be in a supplementary group, their user name is added to the group entry in /etc/group. If you use id -a <user>, it will show the primary and the supplementary groups. The supplementary groups give access to resources, but any new files are created with primary group.
You can change a users currently active primary group using the newgrp command.
It is not necessary for a user to have the primary group also be a secondary group. All it will do is reduce the number of secondary groups a user can be part of. Traditionally a user was limited to 32 secondary groups, but that may have changed in recent years.
usermod can set a users primary and supplementary groups in one command. Using a configuration management tool like puppet can also do that without having to worry about what specific command is necessary on different types of unixes.
Yes, there is a difference between the primary and supplementary groups. The primary group is the main one shown in /etc/passwd, that a user is in upon login. For a user to be in a supplementary group, their user name is added to the group entry in /etc/group. If you use id -a <user>, it will show the primary and the supplementary groups. The supplementary groups give access to resources, but any new files are created with primary group.
You can change a users currently active primary group using the newgrp command.
It is not necessary for a user to have the primary group also be a secondary group. All it will do is reduce the number of secondary groups a user can be part of. Traditionally a user was limited to 32 secondary groups, but that may have changed in recent years.
usermod can set a users primary and supplementary groups in one command. Using a configuration management tool like puppet can also do that without having to worry about what specific command is necessary on different types of unixes.
edited Feb 13 '18 at 15:20
chicks
3,08072033
3,08072033
answered Jun 17 '14 at 19:05
lsdlsd
1,50797
1,50797
add a comment |
add a comment |
There exists a program called members you can install on most linux distros that lists the actual members of a group whether it is their primary group or a supplementary group.
Typically, when a user is created without specifying a group with -g or --gid, the default behavior is to set their primary group as their username, and this gid is not placed in the /etc/group file. Hence files and directories created by the user joe will have ownership joe:joe. But you will not find group 'joe' in the /etc/group file.
If you add the user joe to group 'students', then running
getent group students
will show joe in the list of users in group students.
Running the program
members <groupname>
on a group will show users who are members, either primary or supplementary, of groupname.
add a comment |
There exists a program called members you can install on most linux distros that lists the actual members of a group whether it is their primary group or a supplementary group.
Typically, when a user is created without specifying a group with -g or --gid, the default behavior is to set their primary group as their username, and this gid is not placed in the /etc/group file. Hence files and directories created by the user joe will have ownership joe:joe. But you will not find group 'joe' in the /etc/group file.
If you add the user joe to group 'students', then running
getent group students
will show joe in the list of users in group students.
Running the program
members <groupname>
on a group will show users who are members, either primary or supplementary, of groupname.
add a comment |
There exists a program called members you can install on most linux distros that lists the actual members of a group whether it is their primary group or a supplementary group.
Typically, when a user is created without specifying a group with -g or --gid, the default behavior is to set their primary group as their username, and this gid is not placed in the /etc/group file. Hence files and directories created by the user joe will have ownership joe:joe. But you will not find group 'joe' in the /etc/group file.
If you add the user joe to group 'students', then running
getent group students
will show joe in the list of users in group students.
Running the program
members <groupname>
on a group will show users who are members, either primary or supplementary, of groupname.
There exists a program called members you can install on most linux distros that lists the actual members of a group whether it is their primary group or a supplementary group.
Typically, when a user is created without specifying a group with -g or --gid, the default behavior is to set their primary group as their username, and this gid is not placed in the /etc/group file. Hence files and directories created by the user joe will have ownership joe:joe. But you will not find group 'joe' in the /etc/group file.
If you add the user joe to group 'students', then running
getent group students
will show joe in the list of users in group students.
Running the program
members <groupname>
on a group will show users who are members, either primary or supplementary, of groupname.
answered Jan 19 '18 at 15:13
DJ FarDJ Far
1111
1111
add a comment |
add a comment |
Generally speaking, system administrators should add the user to their primary group's member list in /etc/group because the getpwent() family of system calls will remove duplicates when called. Programs aren't supposed to read /etc/group or /etc/passwd directly, they are supposed to use the system calls. All this has been true for at least 20 years now, and probably much longer.
The two halves of your answer contradict each other.
– womble♦
May 15 at 23:02
Don't know how to say it better, nor what you mean by halves, but I'll try an example. My primary group is sysman, gid 1200. So in my /etc/password entry, the gid field contains 1200, and my userid also appears in the list of userids for group sysman in /etc/group. When any program uses the standard means of asking for my group memberships, everything works. But remember programs should never read / etc/passed or /etc/group, that dodges the name service switch and is very bad practice. Use the system calls.
– Medievalist
May 19 at 2:37
add a comment |
Generally speaking, system administrators should add the user to their primary group's member list in /etc/group because the getpwent() family of system calls will remove duplicates when called. Programs aren't supposed to read /etc/group or /etc/passwd directly, they are supposed to use the system calls. All this has been true for at least 20 years now, and probably much longer.
The two halves of your answer contradict each other.
– womble♦
May 15 at 23:02
Don't know how to say it better, nor what you mean by halves, but I'll try an example. My primary group is sysman, gid 1200. So in my /etc/password entry, the gid field contains 1200, and my userid also appears in the list of userids for group sysman in /etc/group. When any program uses the standard means of asking for my group memberships, everything works. But remember programs should never read / etc/passed or /etc/group, that dodges the name service switch and is very bad practice. Use the system calls.
– Medievalist
May 19 at 2:37
add a comment |
Generally speaking, system administrators should add the user to their primary group's member list in /etc/group because the getpwent() family of system calls will remove duplicates when called. Programs aren't supposed to read /etc/group or /etc/passwd directly, they are supposed to use the system calls. All this has been true for at least 20 years now, and probably much longer.
Generally speaking, system administrators should add the user to their primary group's member list in /etc/group because the getpwent() family of system calls will remove duplicates when called. Programs aren't supposed to read /etc/group or /etc/passwd directly, they are supposed to use the system calls. All this has been true for at least 20 years now, and probably much longer.
answered May 15 at 20:40
MedievalistMedievalist
101
101
The two halves of your answer contradict each other.
– womble♦
May 15 at 23:02
Don't know how to say it better, nor what you mean by halves, but I'll try an example. My primary group is sysman, gid 1200. So in my /etc/password entry, the gid field contains 1200, and my userid also appears in the list of userids for group sysman in /etc/group. When any program uses the standard means of asking for my group memberships, everything works. But remember programs should never read / etc/passed or /etc/group, that dodges the name service switch and is very bad practice. Use the system calls.
– Medievalist
May 19 at 2:37
add a comment |
The two halves of your answer contradict each other.
– womble♦
May 15 at 23:02
Don't know how to say it better, nor what you mean by halves, but I'll try an example. My primary group is sysman, gid 1200. So in my /etc/password entry, the gid field contains 1200, and my userid also appears in the list of userids for group sysman in /etc/group. When any program uses the standard means of asking for my group memberships, everything works. But remember programs should never read / etc/passed or /etc/group, that dodges the name service switch and is very bad practice. Use the system calls.
– Medievalist
May 19 at 2:37
The two halves of your answer contradict each other.
– womble♦
May 15 at 23:02
The two halves of your answer contradict each other.
– womble♦
May 15 at 23:02
Don't know how to say it better, nor what you mean by halves, but I'll try an example. My primary group is sysman, gid 1200. So in my /etc/password entry, the gid field contains 1200, and my userid also appears in the list of userids for group sysman in /etc/group. When any program uses the standard means of asking for my group memberships, everything works. But remember programs should never read / etc/passed or /etc/group, that dodges the name service switch and is very bad practice. Use the system calls.
– Medievalist
May 19 at 2:37
Don't know how to say it better, nor what you mean by halves, but I'll try an example. My primary group is sysman, gid 1200. So in my /etc/password entry, the gid field contains 1200, and my userid also appears in the list of userids for group sysman in /etc/group. When any program uses the standard means of asking for my group memberships, everything works. But remember programs should never read / etc/passed or /etc/group, that dodges the name service switch and is very bad practice. Use the system calls.
– Medievalist
May 19 at 2:37
add a comment |
You should uselid -g <group>'
4
This needs a better explanation.
– Sven♦
Feb 13 '18 at 12:56
add a comment |
You should uselid -g <group>'
4
This needs a better explanation.
– Sven♦
Feb 13 '18 at 12:56
add a comment |
You should uselid -g <group>'
You should uselid -g <group>'
answered Feb 13 '18 at 12:20
JarodJarod
1
1
4
This needs a better explanation.
– Sven♦
Feb 13 '18 at 12:56
add a comment |
4
This needs a better explanation.
– Sven♦
Feb 13 '18 at 12:56
4
4
This needs a better explanation.
– Sven♦
Feb 13 '18 at 12:56
This needs a better explanation.
– Sven♦
Feb 13 '18 at 12:56
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f605812%2fetc-passwd-shows-user-in-a-group-but-etc-group-does-not%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown