/ETC/PASSWD:
The user's information is saved under/ETC/PASSWD (early in the day, the user's password is also placed in the file.) Later, for security reasons, place the password in/etc/shadow):
/etc/group:
The user group information is saved under/etc/group:
/etc/shadow:
The password information is saved under/etc/shadow:
By ': ', the content of/etc/shadow is layered below (from left to right)
Account name
Password
Date of the most recent password change (from 1970-1-1 onwards, in days)
The number of days the password cannot be changed from the last modified date
The number of days the password needs to be reset (in the example above, 99,999 days)
The number of warning days before the password needs to be reset
The grace period after the password expires and the password is still available during the grace period
Account Expiration Date
Reserved (for future expansion)
Initial and valid groups:
A user can belong to more than one user group, then this brings a problem, when the user creates a file or folder, then the user group of the file or folder should be? In fact, the GID recorded below/etc/passwd is the ID of the initial group. When a user logs on, they have the initial group permissions. The user group for a file or folder is determined by the effective group of the creator. We can view the user groups of the current user through the groups command, the first is the effective group, see the following example:
We can change the active group of the current user by newgrp groupname . It is important to note that when this command is used, a new bash process is actually started, and the new active group is only effective in the new bash process. After returning to the original bash process, the new set of valid groups is invalidated, as in the following example:
Beginners Learn Linux-user and user group basics