Command descriptions for Groupadd and Useradd in Linux

Source: Internet
Author: User
Tags crypt

Groupadd [Options] Group

Description
The Groupadd command creates a new group account using the values specified on the command line plus the default values FR Om the system. The new group would be entered into the system files as needed.
Options

Parameters

-F,--Force this option causes the command to simply exit with success statusifThe specified group already exists. When used With-g, and the specified GID already exists, another (unique) GID is chosen (i.e.-G is turned off). and RMLike the meaning of-F, when using this parameter, even if the specified group already exists, the command will still exit normally (without returning an error), when and-g when used together, another GID is automatically used if the specified GID already exists.-G,--GID gid The numerical value of the group's ID. This value must was unique, unless the-o option is used. The value must be non-negative. The default is for use of the smallest ID value greater than 999 and greater than every other group. Values between 0 and 999 is typically reserved for system accounts.-H,--Help Display help message and exit.-K,--key key=VALUE Overrides/etc/Login. Defs defaults (gid_min, Gid_max and others). Multiple-K options can be specified. Example:-K gid_min= --K gid_max=499Note:-K gid_min=Ten, gid_max=499doesn't work yet.-O,--non-Unique This option permits-add a group with a non-unique GID.-P,--Password Password The encrypted password, as returned by crypt (3).    The default is to disable the password. Note:this option is not recommended because the password (or encrypted password) would be visible by users listing the Pro    Cesses. You should MakeSure the password respects the system's password policy.-R,--system Create a system group. The numeric identifiers of the new systemgroupsIs ChooseninchThe Sys_gid_min-sys_gid_max range, definedinch Login. defs, instead of gid_min-Gid_max. Create a system group. The GID of the new system group is automatically sys_gid_min from the Login.defs-sys_gid_max, instead of Gid_min-gid_max

useradd [Options] LOGIN

Useradd-d
useradd-d [Options]

Description
When invoked without the-d option, the Useradd command creates a new user account using the values specified on the comma nd line plus the default values from the system. Depending on command line options, the useradd command would update system files and may also create the new user ' s home di Rectory and copy initial files.

By default, a group would also is created for the new user (See-g,-N,-u, and Usergroups_enab).

Options

-B,--base-dirBase_dir The default BASE directory forThe systemif-D home_dir is not specified. Base_dir is concatenated with the account name to define the home directory. If the-m option is not used, base_dir must exist. If This option isn't specified, Useradd'll use the base directory specified by the HOME variableinch/etc/default/useradd, or/home by default.-C,--comment Comment any textstring. It is generally a ShortDescription of theLogin, and is currently used as the field forThe user's full name.-D,--Home Home_dir The new user would be created using Home_dir as the value forThe user's Login directory. The default is to append the login name to Base_dir and use the as the login directory name. The directory Home_dir does not has to exist but would not be created if it is missing.-D,--defaults See below, the subsection"changing the default values".-E,--expiredate Expire_date theDateOnwhichThe user account would be disabled. TheDateis specifiedinchThe Format yyyy-mm-DD. If not specified, Useradd'll use the default expiryDatespecified by the EXPIRE variableinch/etc/default/useradd, or an emptystring(no expiry) by default.-F,--Inactive inactive the number of days after a password expiresuntilThe account is permanently disabled. A value of0Disables the account as soon as the password have expired, and a value of-1disables the feature. If not specified, Useradd'll use the default inactivity period specified by the INACTIVE variableinch/etc/default/useradd, or-1by default.-G,--GID Group the group name or number of the user's initial login group. The group name must exist. A group number must refer to an already existing group.If not specified, the bahavior of Useradd would depend on the Usergroups_enab variableinch/etc/Login. defs. If This variable was set to Yes (Or-u/--user-group was specified on the command line), a group would be created forThe user, with the same name as her loginname. If the variable is set to No (Or-n/--no-user-group was specified on the command line), Useradd would set the primary group Of the new user to the value specified by the GROUP variableinch/etc/default/useradd, or -by default.-G,--groupsgroup1[,group2,...    [, GROUPN]] A List of supplementarygroups whichThe user is also a member of. Each group was separated from the next to a comma, with no intervening whitespace. Thegroupsis subject to the same restrictions as the group given with THE-G option. The default is forThe user to belong the initial group.-H,--Help Display help message and exit.-K,--Skel skel_dir The skeleton directory,whichContains files and directories to be copiedinchThe user's home directory, when the home directory was created by Useradd.This option was only validifThe-m (or--create-Home) option is specified. If This option isn't set, the skeleton directory is defined by the SKEL variableinch/etc/default/useradd or, by default,/etc/Skel.-K,--key key=VALUE Overrides/etc/Login. Defs defaults (uid_min, Uid_max, UMASK, Pass_max_days and others). Example:-K pass_max_days=-1Can is used when the creating system account is turn off password ageing, even though system account have no password at all. Multiple-k options can be specified, e.g.:-K uid_min= --K uid_max=499Note:-K uid_min=Ten, uid_max=499doesn't work yet.-L,--no-log-Init do not add the user to the lastlog and Faillog databases. By default, the user's entries in the Lastlog and Faillog databases is resetted to avoid reusing the entry from a previously deleted user. -M,--create-Home Create the user'S Home Directory if it does not exist. The files and directories contained in the skeleton directory (which can is defined with THE-K option) would be copied to The home directory.Useradd'll create the home directory unless create_homeinch/etc/Login. Defs is set to No.-M Do not create the user's home directory, even if the system wide setting From/etc/login.defs (Create_home) is set to Yes.-N,--no-user-Group does not create a group with the same name as the user, but add the user to the group specified by the-G option or by the GROUP variableinch/etc/default/Useradd. The default behavior (ifThe-g,-N, and-u options was not specified) was defined by the USERGROUPS_ENAB variableinch/etc/Login. defs.-O,--non-unique allow the creation of a user account with a duplicate (non-unique)    Uid. This option was only validinchCombination with the-o option.-P,--Password Password The encrypted password, as returned by crypt (3).    The default is to disable the password. Note:this option is not recommended because the password (or encrypted password) would be visible by users listing the Pro    Cesses. You should MakeSure the password respects the system's password policy.-R,--system Create a system account. System users would be created with no aging informationinch/etc/shadow, and their numeric identifiers are ChooseninchThe Sys_uid_min-sys_uid_max range, definedinch/etc/Login. defs, instead of Uid_min-uid_max (and their GID counterparts forThe creation ofgroups). Note that Useradd would not create a home directory forSuch an user, regardless of the default settinginch/etc/Login. Defs (Create_home). You have to specify THE-M optionsifYou want a home directory forA System account is created.-S,--Shell Shell The name of the user's login Shell.  The default is to leave this field blank, which causes the system to select the default login shell specified by the shell Variable In/etc/default/useradd, or an empty string by default.-U,--UID UID The numerical value of the user's ID. This value must was unique, unless the-o option is used. The value must be non-negative. The default is for use of the smallest ID value greater than 999 and greater than every other user. Values between 0 and 999 is typically reserved for system accounts.-U,--user-Group Create A group with the same name as the user, and add the user to this group. The default behavior (ifThe-g,-N, and-u options was not specified) was defined by the USERGROUPS_ENAB variableinch/etc/Login. defs.-Z,--selinux-user Seuser the SELinux user forThe user's login. The default is to leave this field blank, which causes the system to select the default SELinux user. 

Command descriptions for Groupadd and Useradd in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.