How many primary groups can an individual Linux user have? If they can have more than one, how does one go about assigning multiple primary groups to a user? If it's just one, what's the cause?
Can a Linux user have multiple primary user groups?
linux;group;accounts
A user cannot have more than primary group. Why? Because the APIs used for accessing passwd data restrict it to one primary group. See man 3 getpwent:The getpwent() function returns a pointer to a structure containingthe broken-out fields of a record from the password database (e.g.,the local password file /etc/passwd, NIS, and LDAP).  The first timegetpwent() is called, it returns the first entry; thereafter, itreturns successive entries.The passwd structure is defined in <pwd.h> as follows:   struct passwd {       char   *pw_name;       /* username */       char   *pw_passwd;     /* user password */       uid_t   pw_uid;        /* user ID */       gid_t   pw_gid;        /* group ID */       char   *pw_gecos;      /* user information */       char   *pw_dir;        /* home directory */       char   *pw_shell;      /* shell program */   };Note: gid_t pw_git. The standard says for pwd.h:The <pwd.h> header shall define the struct passwd, structure,  which shall include at least the following members:char    *pw_name   User's login name. uid_t    pw_uid    Numerical user ID. gid_t    pw_gid    Numerical group ID. char    *pw_dir    Initial working directory. char    *pw_shell  Program to use as shell. The <pwd.h> header shall define the gid_t, uid_t, and size_t  types as described in <sys/types.h>.And in the page on types.h:nlink_t, uid_t, gid_t, and id_t shall be integer types.Thus, the standards restrict the primary group ID to be a single integer.