Useradd
function:
for new system users created in Linux, Useradd can be used to set up user accounts, after the account is built, and then use passwd to set the password of the account, you can Userdel delete the account. The account created with the useradd instruction is actually saved in the/etc/passwd text file.
options:
-
C: Note text, displayed in the passwd comment field-
D: Specifies the starting directory for user login-
d: Change preset
-e: Specify the expiration date of the account-
F: Specify the number of days after the password expires
-G: Specify the group to which the user belongs
g: Specify the additional group to which the user
is a-
m: automatically establish the user's login directory-
N: To cancel the creation of a group with the name of the user
-
R: Establish the SYSTEM account
-
s: Specify the shell-
u: Specify the user ID
of the user logged in
Example:
useradd-g Sales jack-g Company, Employees//-G Join the main group,-G join the affiliate group
useradd caojk-u 544//Create a new user, specify ID
useradd-d/usr/sam-m Sam//Build a user Sam to generate the home directory/usr/sam.
useradd-s/bin/sh-g group-g adm, Root gem//new gem user, login shell is/bin/sh, primary group is group, subordinate group is root,adm
Useradd command Explanation