Learn a little user management command

1, add a user useradd

  -u UID

  -g default belongs to group of users

  -G specified user belongs to more than one group

  -d home directory

  -s command interpreter shell

  -c descriptions

  -e expiration time specified user

  -D View default parameters, in fact, see the / etc / default / useradd

2, modify the user password passwd

  Example: passwd dir dir modify the user password

3, modify the parameter password setting chage

  -l View user's password settings

  -m password modify the minimum number of days

  -M password modify the maximum number of days

  -d password last modified

  -i password expires, the number of days locked accounts

  -E password expiration date: to 0 immediately expired; -1 to never expire

  A few days ago -W password expiration to begin warning

4, modify user information usermod

  Example: usermod -l wangmazi -d / home / wangmazi -g test zhanshan the user's login name zhangshan modify wangmazi, was added to the test group, the user's home directory to / home / wangmazi

  Example: usermod -G test wangmazi wangmazi added to the user group to test

5, delete user userdel

  -r Delete the user's home directory

  Example: userdel -r dir delete user dir

  Manually delete

    Use the find command to find files that belong to a user or group of users

    find the option -user -uid -group -gid

    (1) the file you want to keep moving and backup

    (2) to delete unneeded files

    (3) Elimination of the relevant entry in the user file

    (4) Elimination of the user's home directory

6, add the user groups groupadd

  • Each user belonging to at least one user group
  • Each user group may include a plurality of users
  • Users enjoy the same user group permissions of this user group Total

  -g create user groups and set GID

  Example: groupadd -g 888 wemin create user groups wemin, is a GID of 888

    grep wemon / etc / group View this group

7, delete user group groupdel

  Example: groupdel wemin delete this user group wemin

8, modify user group information groupmod

  Example: groupmod -n apache wemin wemin the name of the user group to apache

9, disable the user usermod -L

  Example: usermod -L apache disable the user apache

10, the user replies usermod -U

  Example: usermod -U apache reply apapche this user

Guess you like

Origin www.cnblogs.com/TuGen/p/11826756.html