Seven, Linux user account management

  • User account information files

    • / Etc / passwd: records all accounts on linux

    • / Etc / shadow: the record corresponding to the account password

    • / Etc / group: records all groups

      • passwd structure:

        • username

        • Early versions of the user password, now the "X"

        • UID: 0 indicates that the system administrator, 1-999 reserved for system

        • GID: ditto

        • Information of the user instructions

        • The user's home directory, where the login directory

        • Whether the user can use the shell

      • shadow structure

        • username

        • Encrypted password

        • Recently changed the password of the date, number of days counted from January 1, 1970

        • The number of days the password can not be changed, 0 can be modified immediately

        • The number of days you want to change your password, you can force users to change passwords by this method

        • Password Change Warning Days

        • Time after password expires, the account can also be used

        • Account expiration time, the number of days counted from January 1, 1970

        • Reserved position

      • group structure:

        • group name

        • Group password (generally not required)

        • GUIDE

        • Affiliated group

  • User-created

    • useradd [username]: Create a user

      • -u: Set UID

      • -g: Set Primary Group

      • -G: Setting affiliated group

      • -c: set user Description

      • -d: Specifies the user's home directory

      • -s: Specifies the user shell

      • -e: account expiration date in the format YYYY-MM-DD

      • -f: Specifies the password is valid immediately failure 0, 1 and never fail

  • User cryptographic operations

    • passwd [username]: Change Password

      • -l: lock the account

      • -u: Unlock

      • -s: display parameters account password

      • -n: number of days to set how long you can not change your password

      • -x: the number of days to set how often passwords must be changed within

      • -w: the number of days, set a password expiration warning days

      • -i: the number of days, number of days to set a password failure

    • chage: Modify and password associated time parameters

      • -l: View parameters

      • -d: YYYY-MM-DD modified recently changed the password of a time

      • -E: Modify the account expiration time

      • -I: A few days after the failed password

      • -m: Password retained for at least a few days

      • -M: A few days after the password needs to be updated

      • -w: Set password expiration warning time

  • Delete user operation

    • userdel [username]: delete users, does not remove the user's home directory and mailbox

      • -r: delete the home directory and mailbox

发布了50 篇原创文章 · 获赞 33 · 访问量 1万+

Guess you like

Origin blog.csdn.net/qq_25884515/article/details/96489147