Linux useradd Command
Linux useradd command to create user accounts.
useradd used to create user accounts. Built after the account, and then set the account's password passwd. The available userdel Delete account. Use the useradd command to establish the account is actually stored in the / etc / passwd text file.
grammar
useradd [-mMnr][-c <备注>][-d <登入目录>][-e <有效期限>][-f <缓冲天数>][-g <群组>][-G <群组>][-s <shell>][-u <uid>][用户帐号]
or
useradd -D [-b][-e <有效期限>][-f <缓冲天数>][-g <群组>][-G <群组>][-s <shell>]
Parameter Description:
- -c <Notes> Notes add text. Remarks text will be stored in the memo field in passwd.
- -d <login directory> Specifies the user login when starting directory.
- -D Change the default value.
- -e <expiration date> Specifies the account expiration date.
- -f <buffer days> Specifies the number of days after password expires that is to close the account.
- -g <group> Specifies the group the user belongs.
- -G <Groups> 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> after the specified user login used by the shell.
- -u <uid> Specifies the user ID.
Examples
Adding the average user
# useradd tt
Specify the appropriate user group for the user to add
# useradd -g root tt
Create a system user
# useradd -r tt
Specifies the home directory for the newly added user
# useradd -d /home/myd tt
Establish and develop a user ID
# useradd caojh -u 544