Useradd,userdel Command Small Summary

Source: Internet
Author: User

Useradd adding users

Userdel Deleting a user

Useradd command format

# Useradd [Options] User name


-U UID: Manually specify the UID number of the user

-D Home Directory: Manually specify the user's home directory

-C User Description: Manually specify the user's description

-G Group name: Manually execute user's initial group

-G group Name: Manually specify additional groups for users

-S Shell: Manually specify the user login shell. Default is/bin/bash

[Email protected] ~]# Useradd Zhao

[Email protected] ~]# passwd Zhao

Changing password for user Zhao.

New Password:

Retype new Password:

Passwd:all authentication tokens updated successfully.

The user Zhao is added as command, and a login password is set. Once a user is created, its contents are automatically created for several files, respectively.

/etc/passwd,/etc/group,/etc/shadow,/etc/gshadow,/home/zhao (automatically create their home directory in the home directory),/var/spool/mail

Manually add a user based on the criteria.

# useradd U 666 G root,bin C "Test user" D/haha S/bin/bash Zhao

Add User Zhao, specify its uid is 666, append group is root and bin (note: A group that already exists in the system can be used as the user's additional group), the user is described as test user, the user's home directory is/haha, the shell type is/bin/bash

Userdel command format

# Userdel [Options] User name


-r: Delete User's home directory while deleting users

-F: Force the deletion of a user (you can force the deletion of a user logged on the system)

The-f option does not affect the actions of users who are already logged on in the system, and when a user who is forcibly removed exits, logging in again will not take effect.

This article is from the "LULU" blog, make sure to keep this source

Useradd,userdel Command Small Summary

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: 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.