Can a user also be a group itself?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












In my Ubuntu 16.04 terminal, logged in as "john" (a normal user), I enter:



john@ubuntu-server:~$ groups john


Then the output goes:



john: john adm ......


So I wonder how john can be a user and a group at the same time. I really don't get it and I cannot find a satisfactory explanation on the Internet. Please enlighten me, thanks.










share|improve this question









New contributor




Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Background: UserPrivateGroups: How it Works
    – steeldriver
    51 mins ago














up vote
3
down vote

favorite












In my Ubuntu 16.04 terminal, logged in as "john" (a normal user), I enter:



john@ubuntu-server:~$ groups john


Then the output goes:



john: john adm ......


So I wonder how john can be a user and a group at the same time. I really don't get it and I cannot find a satisfactory explanation on the Internet. Please enlighten me, thanks.










share|improve this question









New contributor




Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Background: UserPrivateGroups: How it Works
    – steeldriver
    51 mins ago












up vote
3
down vote

favorite









up vote
3
down vote

favorite











In my Ubuntu 16.04 terminal, logged in as "john" (a normal user), I enter:



john@ubuntu-server:~$ groups john


Then the output goes:



john: john adm ......


So I wonder how john can be a user and a group at the same time. I really don't get it and I cannot find a satisfactory explanation on the Internet. Please enlighten me, thanks.










share|improve this question









New contributor




Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











In my Ubuntu 16.04 terminal, logged in as "john" (a normal user), I enter:



john@ubuntu-server:~$ groups john


Then the output goes:



john: john adm ......


So I wonder how john can be a user and a group at the same time. I really don't get it and I cannot find a satisfactory explanation on the Internet. Please enlighten me, thanks.







command-line users groups






share|improve this question









New contributor




Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 51 mins ago









Ravexina

30.1k1474103




30.1k1474103






New contributor




Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









Franky Hung

183




183




New contributor




Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Franky Hung is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Background: UserPrivateGroups: How it Works
    – steeldriver
    51 mins ago
















  • Background: UserPrivateGroups: How it Works
    – steeldriver
    51 mins ago















Background: UserPrivateGroups: How it Works
– steeldriver
51 mins ago




Background: UserPrivateGroups: How it Works
– steeldriver
51 mins ago










1 Answer
1






active

oldest

votes

















up vote
6
down vote



accepted










When you create a user, a group will be created with the same name and will be set as newly created user's primary group.



You can find out what your primary group name is using:



id -gn


The file which defines which group is your primary group lives at: /etc/passwd, run bellow command to get corresponding line to your user:



getent passwd $USER


it should look like:



username:x:1000:1000:Your Name,,,:/home/username:/bin/bash


Pay attention to second (1000), it's your primary user's group id.



or find out what groups your user is a member of using:



id -Gn


The file contains details about groups lives at: /etc/group, this command should show you the details about your user's primary group:



grep "^$USER" /etc/group


Same as:



getent group $USER


The result looks like:



groupname:x:1000:


Remember the 1000 from before? this is the group id which has been set as your primary group in /etc/passwd.



Then when you create new files, they would be owned by your user, and your primary group (which is same as your username and only one user is a member of that group, which is your user).






share|improve this answer






















  • very clearly explained, thx!
    – Franky Hung
    54 mins ago










  • @FrankyHung You are welcome, You can accept my answer by clicking on the gray tick if you think it was helpful to you.
    – Ravexina
    52 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
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',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Franky Hung is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1087523%2fcan-a-user-also-be-a-group-itself%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
6
down vote



accepted










When you create a user, a group will be created with the same name and will be set as newly created user's primary group.



You can find out what your primary group name is using:



id -gn


The file which defines which group is your primary group lives at: /etc/passwd, run bellow command to get corresponding line to your user:



getent passwd $USER


it should look like:



username:x:1000:1000:Your Name,,,:/home/username:/bin/bash


Pay attention to second (1000), it's your primary user's group id.



or find out what groups your user is a member of using:



id -Gn


The file contains details about groups lives at: /etc/group, this command should show you the details about your user's primary group:



grep "^$USER" /etc/group


Same as:



getent group $USER


The result looks like:



groupname:x:1000:


Remember the 1000 from before? this is the group id which has been set as your primary group in /etc/passwd.



Then when you create new files, they would be owned by your user, and your primary group (which is same as your username and only one user is a member of that group, which is your user).






share|improve this answer






















  • very clearly explained, thx!
    – Franky Hung
    54 mins ago










  • @FrankyHung You are welcome, You can accept my answer by clicking on the gray tick if you think it was helpful to you.
    – Ravexina
    52 mins ago














up vote
6
down vote



accepted










When you create a user, a group will be created with the same name and will be set as newly created user's primary group.



You can find out what your primary group name is using:



id -gn


The file which defines which group is your primary group lives at: /etc/passwd, run bellow command to get corresponding line to your user:



getent passwd $USER


it should look like:



username:x:1000:1000:Your Name,,,:/home/username:/bin/bash


Pay attention to second (1000), it's your primary user's group id.



or find out what groups your user is a member of using:



id -Gn


The file contains details about groups lives at: /etc/group, this command should show you the details about your user's primary group:



grep "^$USER" /etc/group


Same as:



getent group $USER


The result looks like:



groupname:x:1000:


Remember the 1000 from before? this is the group id which has been set as your primary group in /etc/passwd.



Then when you create new files, they would be owned by your user, and your primary group (which is same as your username and only one user is a member of that group, which is your user).






share|improve this answer






















  • very clearly explained, thx!
    – Franky Hung
    54 mins ago










  • @FrankyHung You are welcome, You can accept my answer by clicking on the gray tick if you think it was helpful to you.
    – Ravexina
    52 mins ago












up vote
6
down vote



accepted







up vote
6
down vote



accepted






When you create a user, a group will be created with the same name and will be set as newly created user's primary group.



You can find out what your primary group name is using:



id -gn


The file which defines which group is your primary group lives at: /etc/passwd, run bellow command to get corresponding line to your user:



getent passwd $USER


it should look like:



username:x:1000:1000:Your Name,,,:/home/username:/bin/bash


Pay attention to second (1000), it's your primary user's group id.



or find out what groups your user is a member of using:



id -Gn


The file contains details about groups lives at: /etc/group, this command should show you the details about your user's primary group:



grep "^$USER" /etc/group


Same as:



getent group $USER


The result looks like:



groupname:x:1000:


Remember the 1000 from before? this is the group id which has been set as your primary group in /etc/passwd.



Then when you create new files, they would be owned by your user, and your primary group (which is same as your username and only one user is a member of that group, which is your user).






share|improve this answer














When you create a user, a group will be created with the same name and will be set as newly created user's primary group.



You can find out what your primary group name is using:



id -gn


The file which defines which group is your primary group lives at: /etc/passwd, run bellow command to get corresponding line to your user:



getent passwd $USER


it should look like:



username:x:1000:1000:Your Name,,,:/home/username:/bin/bash


Pay attention to second (1000), it's your primary user's group id.



or find out what groups your user is a member of using:



id -Gn


The file contains details about groups lives at: /etc/group, this command should show you the details about your user's primary group:



grep "^$USER" /etc/group


Same as:



getent group $USER


The result looks like:



groupname:x:1000:


Remember the 1000 from before? this is the group id which has been set as your primary group in /etc/passwd.



Then when you create new files, they would be owned by your user, and your primary group (which is same as your username and only one user is a member of that group, which is your user).







share|improve this answer














share|improve this answer



share|improve this answer








edited 53 mins ago

























answered 58 mins ago









Ravexina

30.1k1474103




30.1k1474103











  • very clearly explained, thx!
    – Franky Hung
    54 mins ago










  • @FrankyHung You are welcome, You can accept my answer by clicking on the gray tick if you think it was helpful to you.
    – Ravexina
    52 mins ago
















  • very clearly explained, thx!
    – Franky Hung
    54 mins ago










  • @FrankyHung You are welcome, You can accept my answer by clicking on the gray tick if you think it was helpful to you.
    – Ravexina
    52 mins ago















very clearly explained, thx!
– Franky Hung
54 mins ago




very clearly explained, thx!
– Franky Hung
54 mins ago












@FrankyHung You are welcome, You can accept my answer by clicking on the gray tick if you think it was helpful to you.
– Ravexina
52 mins ago




@FrankyHung You are welcome, You can accept my answer by clicking on the gray tick if you think it was helpful to you.
– Ravexina
52 mins ago










Franky Hung is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Franky Hung is a new contributor. Be nice, and check out our Code of Conduct.












Franky Hung is a new contributor. Be nice, and check out our Code of Conduct.











Franky Hung is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1087523%2fcan-a-user-also-be-a-group-itself%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery