Can a user also be a group itself?
Clash 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.
command-line users groups
New contributor
add a comment |Â
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.
command-line users groups
New contributor
Background: UserPrivateGroups: How it Works
â steeldriver
47 mins ago
add a comment |Â
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.
command-line users groups
New contributor
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
command-line users groups
New contributor
New contributor
edited 46 mins ago
Ravexina
30.1k1474103
30.1k1474103
New contributor
asked 57 mins ago
Franky Hung
182
182
New contributor
New contributor
Background: UserPrivateGroups: How it Works
â steeldriver
47 mins ago
add a comment |Â
Background: UserPrivateGroups: How it Works
â steeldriver
47 mins ago
Background: UserPrivateGroups: How it Works
â steeldriver
47 mins ago
Background: UserPrivateGroups: How it Works
â steeldriver
47 mins ago
add a comment |Â
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).
very clearly explained, thx!
â Franky Hung
49 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
48 mins ago
add a comment |Â
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).
very clearly explained, thx!
â Franky Hung
49 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
48 mins ago
add a comment |Â
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).
very clearly explained, thx!
â Franky Hung
49 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
48 mins ago
add a comment |Â
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).
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).
edited 48 mins ago
answered 53 mins ago
Ravexina
30.1k1474103
30.1k1474103
very clearly explained, thx!
â Franky Hung
49 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
48 mins ago
add a comment |Â
very clearly explained, thx!
â Franky Hung
49 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
48 mins ago
very clearly explained, thx!
â Franky Hung
49 mins ago
very clearly explained, thx!
â Franky Hung
49 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
48 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
48 mins ago
add a comment |Â
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.
Franky Hung is a new contributor. Be nice, and check out our Code of Conduct.
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
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
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
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
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
Background: UserPrivateGroups: How it Works
â steeldriver
47 mins ago