Linux study notes (users, user groups)

user

  • Description:
    1) Linux system is a multi-user multi-tasking operation, any need to use the resources of the system of accounts, are subject to prior Xianxiang system administrator for an account, login to the system after the identity of the account.
    2) Linux users must belong to at least one group.
Add User
  • The basic syntax for useradd [option] username
  • When the user is created, automatically creates a home directory and user of the same name
  • Can be specified in the user's home directory on the user's common when using useradd -d

Example: Create a user named js, and assign the home directory is / home / web
Here Insert Picture Description

The user is assigned a password or change the password
  • The basic syntax for passwd username

Case: Set a password for the user just created, and switch to the user (Note: does not require highly privileged users to switch to low-rights user input commands)
Here Insert Picture Description

delete users
  • The basic syntax userdel username

Case: delete user js, but retain the home directory (when removed, use the -r option when it will be removed along with the home directory)
Here Insert Picture Description

User queries and switching
  • The basic syntax of the query id user name
  • Switching basic usage su username
  • When you need to return to the original user's input when you can exit
    Here Insert Picture Description

user group

Management mechanism system, unified management of multiple users

Creating user groups
  • The basic syntax groupadd group name
Deleting User Groups
  • The basic syntax groupdel group name

Here Insert Picture DescriptionHere Insert Picture Description

Directly specify the user group increases user
  • The basic syntax for useradd -g users username

    Case: Creating a user group web and then create users and assign user group web
    Here Insert Picture Description
Modifying User Groups
  • The basic syntax usermod -g User Group User

    Case: Creating user groups web1 it js user groups to modify web1

Here Insert Picture Description

Relevant documents (using the cat command with the path to view)

/ Etc / passwd file

User's profile, the user record a variety of information

in each row meanings: login: password: user ID: Group ID: Annotated Description: home directory: login shell
Here Insert Picture Description

/ Etc / shadow file

Password profiles


the meaning of each line: login: password encryption: Last modified: maximum time interval: Warning time: No Time: Time: Identity
Here Insert Picture Description

/ Etc / group file

Group profile, record the information contained in the Linux group


per line meaning: group name: password: Group ID: the list of users within the group
Here Insert Picture Description

while studying records, if any deficiencies welcome message pointing ...

Published 63 original articles · won praise 1 · views 2027

Guess you like

Origin blog.csdn.net/qq_45061361/article/details/104591362