What is primary group and secondary group in unix?

1 answer

Answer

1172658

2026-04-20 05:00

+ Follow

Every user must have a primary group; it is what gets assigned to files you make and things like that. If you type 'id' at the prompt, it will tell you this, among other things. You can also be a member of additional groups, so that you can access things that are owned by these groups.

A user can temporarily change what group is his effective primary group with the 'newgrp' command, allowing all files made afterWords (until the effect is undone) to have a specific group ownership.

If you are familiar with the unix command line and some common utilities, the following example should help.

eg:

$ id

uid=15851(John) gid=20(cluster) groups=20(cluster),502(sysadmin),47071(cool_people)

$ touch sample

$ ls -l

total 2255305

drwxr-xr-x 3 John cluster 10 Dec 1 16:51 sample

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.