Um usuário não pode ter mais do que o grupo principal. Por quê? Porque as APIs usadas para acessar passwd data a restringem a um grupo principal. Consulte man 3 getpwent :
The getpwent() function returns a pointer to a structure containing
the broken-out fields of a record from the password database (e.g.,
the local password file /etc/passwd, NIS, and LDAP). The first time
getpwent() is called, it returns the first entry; thereafter, it
returns 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 */
};
Nota: gid_t pw_git . A norma diz para pwd.h :
The
<pwd.h>header shall define thestruct 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 thegid_t,uid_t, andsize_ttypes as described in<sys/types.h>.
E na página em types.h :
nlink_t,uid_t,gid_t, andid_tshall be integer types.
Assim, os padrões restringem o ID do grupo primário a ser um único inteiro.