Chapter 5 User Management

The user

  1. The three types of users and their ID number ranges
Super user: root Has the highest rights of the computer system. The UID and GID are 0. System user: Automatically creates users associated with system services. Normally these accounts can only be used by system daemons. The UID and GID range is 1 to 499. Common user: created by a super user, a common user can only operate files and directories that have permission and manage processes started by the user. The UID and GID start at 500.Copy the code
  1. User related files: run the cat command to view them
User account information file: /etc/passwd User password information file: /etc/shadowCopy the code
  1. User account information file: /etc/passwd

Root: x: 0:0: root: /root: /bin/bash If the password is x, hide the password

Username: Password: User ID: Group ID: Full name: Home directory: shell

  1. Group-related files: cat command to view
Group account information file: /etc/group Group interface information file: /etc/gshadowCopy the code
  1. To create a user account, run the useradd user name command
  2. Sets or modifies a user’s password and password properties. Passwd [option] [user]

Options:

-d User name (delete) // Deletes the user password

-l User name (lock) // Locks the user account

-u User name (unlock) // Unlocks a user account

  1. To modify the properties of a user, run the usermod user name command

  2. To delete a specified user account, run the userdel [-r] command

  3. View the UID, GID, and group information of a user. If no user is specified, current user information is displayed: id/groups [username]

  4. To create a group, run the groupadd command

  5. To modify the properties of a specified group, run the groupmod group name command

  6. To delete the specified group, run the groupdel group name command

  7. Gpasswd [option] group

Gpasswd -a User name Group name: adds a user to a group

Gpasswd -d Username Group name: deletes a user from a group