useradd -g group1 tom useradd -g group1 jim useradd -g group1 bob Then cat /etc/group looks at user groups.
The result is this:
The last column is empty.
Yao Ming has created 3 new users in this user group, why?
Notice the difference between -G and-g.
The parameter you use here is -g, which means that the main group of tom, Jim and bob users is group1, that is, their GID is 504. if the user’s GID= the user group’s GID, the last field is blank by default.
To achieve your goal, the command parameters should be:
useradd -G group1 tom
useradd -G group1 jim
useradd -G group1 bob
At this time, tom, Jim and Bob’s affiliated group is group1, which can be displayed.