Linux study notes_2: user management + practical instructions

User Management

Linux system is a multi-user multi-tasking operating system, a user want to use any system resources, must first apply for a user account to the system administrator, and then enter the system as a user of this account; at least Linux users to belong A group.

  • Add user

    • useradd [-d] bcxtm, Add the user account of bcxtm (default /home/bcxtm) ,, -dadd to the specified directory

      If the group to which the new user belongs is not specified, a group consistent with the user name will be created by default

  • Assign/modify password

    • passwd bcxtm, Interactively set the password, only the root user has this authority
  • delete users

    • userdel [-r] bcxtm, Delete the user account of bcxtm, keep the user directory,, -rcascade to delete the user directory
  • Query user information

    • id bcxtmDisplayed uid, gid,所在组别名称
  • Switch user

    • su - bcxtm, Used su -by non-root users , switch users as an administrator

      No password verification is required to switch from high authority to low authority, and vice versa; use exit to switch to the original user.

  • User group (similar to the concept of role, common users belong to a group)

    • Add group:groupadd groupName
    • Delete group:groupdel groupName
    • Specify the group when creating a user:useradd -g groupName userName
    • Modify user group:usermod -g newGroupName userName
    • User and group relationship configuration storage
      • User profile:/etc/passwd
        • Username: Password: User Identification Number: Group Identification Number: Annotative Description: Home Directory: Login Shell
      • Group configuration file:/etc/group
        • Group name: Password: Group identification number: List of users in the group
      • Password (encrypted login and password information) configuration file:/etc/shadow
        • Username: encrypted password: last modification time: minimum time interval: maximum time interval: warning time: inactivity time: expiration time: sign

Practical instructions

  • Run level concept (configuration file in /etc/inittab)

    • 0: Shut down
    • 1: Single user
    • 2: Multi-user no network service
    • 3:Multiple users have network services (commonly used)
    • 4: System reserved
    • 5: Graphical interface (commonly used)
    • 6: Restart
  • Specify run level

    • init [0-6]
  • How to retrieve root password?

    Enter single-user mode (login without a password), just change the root user password!

  • Help instruction

    • man + 指令
    • help + 指令

Guess you like

Origin blog.csdn.net/Nerver_77/article/details/106771878