[Linux user and group management] --2019-08-07 12:51:16

Original: http://106.13.73.98/__/90/

Create a user -useradd

.
Command Format:useradd [参数] 用户名
useradd can also be written adduser
.
Parameters are as follows

  1. -u Specifies the UID number
  2. -d Specifies the home directory
  3. -e Specifies the effective time
  4. -g Specify the basic group
  5. -G Specify additional group
  6. -M Does not create host directories
  7. -s Specifies the shell
  8. -r When used to delete a user, delete the home directory
  9. -f Generally used to force a user to delete

.
Complementary command:
echo '密码' | passwd --stdin 用户名set a password directly to a specific user

Set user password -passwd

.
Format:passed [参数] 用户名
.
Parameters are as follows

  1. -d Empty password
  2. -lLock the user, locking labeled LK, through the parameters -Sview
  3. -u Unlock the user to unlock labeledPS
  4. -S Uppercase, see the user status
Change User Properties -usermod

.
Command Format:usermod 参数 用户名
the usermod command with all the parameters of useradd.
.
Also contains the following parameters parameters

  1. -l Change User
  2. -L Lock the user
  3. -U Unlock user
Group Management -groupadd

.
Creating a group:groupadd [-g GID] 组名
.
Parameters are as follows

  1. -u Add a member
  2. -d Remove a member
  3. -MRedefine the list of group members to ,separate

.
To delete a group:groupdel 组名

Check user information

.
id 用户名Check user identity mark
.
groups 用户名Charles groups the user belongs
.
users/ w/who Check the logged-in user information
***

user

  • Superuser (root): UID and GID are0
  • Program User: UID is 1-499usually no home directory
  • Average user: UID as the 500-6000default start accumulating from 1001

group

  • The basic group (private group): Each user belongs to a private group the largest private group can not be deleted
  • Additional groups (Public Group) : Each user can belong to any common group

Related documents

. Basic user information file storage format: . User shadow password file, used to store password information . Ordinary user's home directory, usually the user name their files from / copied from the . Group information file
/etc/passwd

用户名:密码占位符:UID:GID:描述信息:宿主目录:登陆shell

/etc/shadow


/home/文件名

/etc/skel

/etc/group


Original: http://106.13.73.98/__/90/

Guess you like

Origin www.cnblogs.com/gqy02/p/11314636.html