/etc/passwd:
User name: Password: uid:gid: Comments: Home directory: Default Shell
/etc/group:
Group name: Password: GID: List of users with this group attached to the group
/etc/shadow:
User name: Password: Last time the password was modified: Minimum Age: Maximum Age: Warning Time: Inactive time: Expiry time:
User Management :
useradd,userdel,usermod,passwd,chsh,chfn, Finger ,ID,chage,pwck
User basic information management:
# useradd [options] USERNAME (add users)
-U UID: Specifies its UID value, greater than or equal to 1000,uid value unique
-G GID: Specifies its base group, which must exist
-G GID ... : Specifies its additional groups, if there are multiple, separated by commas with each other
-C "COMMENT": Specifying annotation information
-d/path/to/somewhere: Specify home directory (by default, create a directory with the same name as the user name in the home directory)
-S Shell: Specify the shell path, use absolute path when specified ↓(default SHELL for a user)
/etc/shells: Specifies the security shell that is available for the current system
-m-k:-m force a home directory for the user,-K copies the necessary configuration files for the new user when it is created →/etc/skel
-M: Do not create home directory for users
-e: Account expiration date
-r: Add system User (id value less than 1000)
# userdel [option] USERNAME (delete user, default does not delete their home directory)
-R: Delete the user's home directory and its associated files at the same time
-F: Forcibly delete the user's home directory and its associated files
# ID [options] [USERNAME] (view user's account attribute information)
-U/-G/-G: Displays the ID value of the specified genus Master/group/all Groups
-N: Displays the name represented by the specified ID value
To modify user account properties:
# usermod [Options] USERNAME
-U uid: Modify the original UID value
-G GID: Modify the base group value that belongs to
-a-g GID: Appends a new additional group to the user's original specified group, without using the-a option, overwriting the previous additional group
-C "Information": Add comment information
-D-M: To specify a new home directory for the user,-m to move the previous file to the new home directory
-S: Modify the user shell
-L: Modify user Name
-L: Lock the account to prevent the user from logging into the system
-U: Unlocks the account, allowing the user to log in to the system
-e: Specify the user's expiration time, format "YYYY-MM-DD"
-F: Specify inactivity Time
# Chsh USERNAME (Modify the user's default shell)
# CHFN USERNAME (Modify comment information)
Password Management:
# passwd [USERNAME] (change user password)
--stdin: Allow user passwords to be modified from standard input
-L: Lock the user against logging in
-U: Unlock the user to allow login
-D: Remove user password
# chage [OPTION] NAME
-D: Last modification time
-E: Expiration time
-M: Minimum period of use
-M: Maximum lifespan
-W: Warning time
# Pwck (check user account integrity)
Group Management :
groupadd,groupdel,groupmod,gpasswd
Create/delete Group:
# Groupadd [OPTION] GRPNAME
-G GID: Specify Group ID
-R: Added as System group (ID less than 1000)
# Groupdel GRPNAME
Modify Group Properties:
# groupmod [option] GRPNAME
-G GID: Modify Group ID
-N GRPNAME: Modify Group name
Add Password to group:
# gpasswd GRPNAME
Log in to a new group:
# newgrp GRPNAME <--> exit
Rights Management :
chown,chgrp,chmod,umask
Permission Mode:r,w,x
User category: U owner , G group , O other users . A represents all users
Change file owner: chown
# chown [OPTION] USERNAME file,... (Change the owner of the specified file to username)
-R: Modify the owner of the directory and its internal files
--reference=/path/to/somefile file,... ( changes the property contents of the specified file to the same property as the file specified in the preceding path, and the attribute includes both the owner and the group.
# chown [OPTION] [username]:[grpname] File,... (supports simultaneous modification of both owners and genera)
Changed file group: chgrp (change group)
# CHGRP [OPTION] GRPNAME file,... (Change the group of the designated documents to Grpname)
-R: Recursive modification of directory genera
--reference=/path/to/somefile file,... (IBID.)
Changing file permissions: chmod (change mode)
Modify permissions for three categories of users:
# chmod MODE File,... (also supports-R and--reference)
To modify a class of users or some class user rights:
# chmod user Category =mode,... file,...
Modify some or some bit permissions for a class of users:
# chmod user Category +/-mode,... file,...
Matte Code: Umask
Create file: 666-umask(file default cannot have Execute permission, if there is, then add 1 of its permission)
Create directory: 777-umask
# umask (shows the current user's umask)
# umask 022 (set a user's umask)
Linux users and their rights management commands