++++++++++++++++++++++++++++++ User and user group management +++++++++++++++++++++++++++++++
1. User Management profile (Linux primarily uses user profiles to view and modify user information)User information file/etc/passwdformat-user namepassword flag (x)User ID (UID-0: Super User, 1-499: System user-pseudo user-service and command, 500-65535: normal user)User Initial Group (GID) Note: Initial group-there can only be one. Additional groups--can have multipleUser Notes (note)User home directory (normal User:/home/user name; Super User:/root/)Shell after login (Linux command parser)Shadow file/etc/shadow is actually a Stored user password (default permission is 000, only the root user can view and modify)format-user nameEncryption Password--The encryption algorithm is SHA512Password Modification Time--use January 1, 1970 as standard Time, every day time stamp plus 1Two-time password change intervalPassword validity timethe warning time before the password expiresGrace time after password expiration--:-1 means that the password is permanently activethe expiration time of the account (to be represented by a timestamp)//data-d "1970-01-01 16066 Days"-date changed to timestampReserved Fieldsgroup information file/etc/groupformat-group nameGroup Password FlagGroup ID (GID)additional users in the groupgroup password file/etc/gshadowformat-group nameGroup PasswordGroup Administrator user nameadditional users in the group
2. User Management related filesUser Home directory: User initial login DirectoryNormal user--/home/user nameSuper User--/rootUser's mailbox:/var/spool/mail/user nameUser Templates directory:/etc/skel
3. User Management Commandsuser Add command--useradd [options] [user name]option:-U (manually specify user's UID number)-D (manually specify user's home directory)-C (manually specify user description)-g (initial group manually specified user)-G (Specify user's additional group)-S (manually specify the user's login shell)Note: User default value file--/etc/default/useradd/etc/login.defs Modify User password: passwd [option] [user name]option:-S query user password status "Super User only available"- l Lock User- u Unlock userecho "123" | passwd--stdin user uses string as password Modify user information: Usermod (basically similar to useradd usage)option:-u Modify user uid- C Modify User Description- G Modify additional group name- L temporary lock user- u unlock user lock Modify User Password status: Chageoption:-L View user details password status- D Change Password The last time///////////is used
for initial password assignment, the user changes the password when they log on. - m two times password change interval- m password expiration date- W warning time before password expires-I Grace days after password expires- e account expiry time Delete User: Userdeloption:-r Delete User's home directory while deleting users command ID: Querying the user's Uid\gid\gid User Switching: Suoption:-(option can only be switched with "-", on behalf of the user's environment variable)-C (do not switch, only once command)
4. User Group Management commandsAdd user group: Groupadd [options] Group nameoption:-G GID specify group IDModify User group: Groupmod [options] Group nameoption:-N (group name)-G (Group ID)Delete user group: Groupdel Group nameNote: There are initial users in the group cannot be deleted if only additional groups can be deletedadd users to or remove from a group: gpasswdoption:-A user name to use join group- D user name removes the user from the group +++++++++++++++++++++++++ +++++ User and user group management +++++++++++++++++++++++++++++++
Linux Learning Notes-user group Management (v)