Linux-5 basic learning

组Create: groupadd     Groupadd [option]..group_name

-g : GID: Indicates the GID number [GID_MIN, GID_MAX]
-r: Create a system group
    Centos 6: ID<500
    Centos 7: ID<1000

View user-related ID information: id     Id [option]..[USER]         -u: UID         -g: GID         -G: Groups         -n: Name Switch users or execute commands as other users: su     Su [option..] [-] [user [args]]         How to switch users:             Su Username: Non-login switch, ie the home directory configuration file of the target user will not be read (non-full switch)             Su - Username: Login switch, it will read the configuration file of the upper user and switch completely.

 注意:root su to other users without a password, non-root users need a password when switching
    Change the identity to execute the command:
        Su [-] Username -c 'command'

User attribute modification: usermod     Usermod [option] login         -u UID: new UID         -g GID: new GID         -G GROUP1[GROUP2,GROUP2]: The new additional group will be deleted.         -s: new default shell         -c: new comment information         -d: The new home directory, the files in the original home directory will not be synchronized to the new home directory. To move at the same time, use the -m option

-L:lock to specify the user.
    -U:unlock specifies the user

    -e YYYY-MM-DD: Indicates the expiration date of the user account; 

Add password to the user: passwd     Passwd [option] username: Change the password of the specified user, only the root user authority     Passwd : modify your own password         Common options:             -l: lock the specified user             -u: Unlock the specified user

-n mindays: Specify the minimum age
        -x maxdays: maximum usage period
        -w warndays: How many days in advance to start warning
        -i inactivedays: inactivity period

        --stdin: Receive user password from standard input
            Echo "password" | passwd --stdin username

        Note: /dev/null: black hole
              /dev/zero, swallow 0

delete user: userdel     Userdel [option] ....login         -r: delete the user's home directory Group attribute modification: groupmod     Groupmod [option]         -n : new name         -g : change GID Group delete: groupdel     Groupdel group Group password: gpasswd     Gpasswd [option] group         -a userneme group: Add user to the specified group         -d user: Delete the user group with the current group as the group name.

-A user1,user2,....:Set the user list with administrative rights
    Newgrp: Temporary switching basics驵
        If the user does not belong to this group, a group password is required.

Modify user attributes: chage
Modify user comment information: chfn