YouTip LogoYouTip

Linux Comm Useradd

# Linux useradd Command [![Image 3: Linux Command Manual](#) Linux Command Manual](#) The Linux useradd command is used to create user accounts. useradd can be used to create user accounts. After the account is created, use passwd to set the account password. The userdel command can be used to delete accounts. The accounts created using the useradd command are actually stored in the /etc/passwd text file. ### Syntax useradd or useradd -D **Parameter Description**: * -c Add a comment. The comment is saved in the comment field of passwd. * -d Specify the initial login directory for the user. * -D Change the default values. * -e Specify the account expiration date. * -f Specify the number of days after password expiration before the account is disabled. * -g Specify the primary group of the user. * -G Specify the supplementary groups of the user. * -m Create the user's home directory. * -M Do not automatically create the user's home directory. * -n Cancel the creation of a group with the same name as the user. * -r Create a system account. * -s Specify the shell to be used after the user logs in. * -u Specify the user ID. ### Examples Add a regular user # useradd tt Assign the corresponding user group to the added user # useradd -g root tt Create a system user # useradd -r tt Specify the home directory for the newly added user # useradd -d /home/myd tt Create a user and specify the ID # useradd caojh -u 544 [![Image 4: Linux Command Manual](#) Linux Command Manual](#)
← Linux Comm DateLinux Comm Chfn β†’