linux create a group, create a user

A, groupadd [options] group

Create a new group. Groupadd command uses the value specified in the command line plus the default values ​​to create a new group account. The new group will be entered into the system as needed.

(1) Option

1
2
3
4
5
6
7
-f, - Force if the specified group already exists, this option will blind the only successful exit status. When used with -g, and the specified GID_MIN already exists, only the GID select another (i.e., closed -g).
-g, - gid GID value must be unique, unless the -o option. But it must be non-negative. The default value is greater than or equal to the minimum GID_MIN use and greater than each of the other groups.
-K, - key KEY = VALUE /etc/login.defs override the default value (GID_MIN, GID_MAX and others). You can specify multiple K options. Example: -K GID_MIN = 100 -KGID_MAX = 499 . Note: -K GID_MIN = 10, GID_MAX = 499 does not work.
-o, - non-unique This option allows you to add a non-unique GID value.
-p, - password PASSWORD for the new group to use this encrypted password. The password is disabled by default. Note: This option is not recommended, because the password (or encrypted password) will be seen by the user and listed this process. You should make sure Password policies are consistent with the system.
-r, - system to create a system group. The new set of digital system identifier SYS_GID_MIN into SYS_GID_MAX range selection, rather than defined in login.defs GID_MIN to GID_MAX.
-R, - root CHROOT_DIR CHROOT_DIR applied to the modified directory, configure and use.
(2) Configuration Files

It has the following configuration variables in /etc/login.defs can be used to change the behavior of this tool:

. 1
2
. 3
. 4
GID_MAX (Number), GID_MIN (Number) the useradd, the range of the conventional group ID or group groupadd newusers created. The default GID_MIN (GID_MAX) value is 500 (60,000).
MAX_MEMBER_PER_GROUP (number) maximum number of members per group entry. At the maximum value, the / etc / group starts a new entry (row) (using the same name, password, and GID). The default value is 0, no limit to the number of members in the group. This feature (split group) allows the line length limits set file. This is to ensure that the line is longer than NISsan group than 1024 characters. To enforce this restriction, you can use 25.
Note: split groups may not support all of the tools (even concentrated in the shadow tool). You should not use this scalar, unless really needed.
SYS_GID_MAX (number), SYS_GID_MIN (number ) of the group ID ranges system group useradd, groupadd newusers or created. SYS_GID_MIN default value (SYS_GID_MAX) 201 is (-1).

For example: groupadd -r group name

二、useradd

Linux useradd command is used to create a user account.

useradd be used to create user accounts. After the account built, then set password passwd account. The available userdel deletes the account. Use the useradd command to establish the account is actually stored in the / etc / passwd text file.

Syntax
useradd [-mMnr] [- c <Notes>] [- d <Sign Catalog>] [- e <expiration date>] [- f <buffered Days>] [- g <group>] [- G <Group group>] [- s <shell> ] [- u <uid>] [ user account]
or

useradd -D [-b] [- e < expiration date>] [- f <buffered Days>] [- g <group>] [- G <group>] [- s <shell> ]
Parameters:

-c <Note> plus notes text. Note the text is saved in the memo field in passwd.
-d <login directory> Specifies the starting directory when the user logs in.
-D change the default value.
-e <expiration date> designated account expiration date.
-f <buffer days> specifies the number of days after the password expires i.e. close the account.
-g <group> designated group the user belongs.
-G <group> specify additional groups the user belongs.
-m automatically create the user's login directory.
-M Do not automatically create the user's login directory.
-n Cancel establish a user name in the name of the group.
-r create a system account.
-s <shell> shell when a user logs used.
-u <uid> Specifies the user ID.

For example: useradd -r -g group name Username

Guess you like

Origin blog.51cto.com/2065997140/2408971