Linux User management command-useradd passwd usermod chage userdel su instance, useraddusermod

Source: Internet
Author: User

Linux User management command-useradd passwd usermod chage userdel su instance, useraddusermod

User's home directory

Common User:/home/user name. Both the owner and the group belong to this user. The permission is 700.

Super User:/root/the owner and group are both root users with the permission of 550

--------------------------------------------------------------------------------

Useradd [Option] User Name

Option:

-U UID: manually specify the user's UID

-D home directory

-C user description

-G group name: Specifies the initial group of the user.

-G group name: Specify the user's additional group

-S shell specifies the user's logon shell. The default value is/bin/shell.

Chage-d 0 user1 ===> in this way, you must change the password for user1 login.

Bytes ------------------------------------------------------------------------------------------

Passwd [Option] User Name

Option:

-S: query the password status of the user password, which is only used by the root user.

-L currently only root users are used

-U is used only by root to unlock the user.

-- Stdin can use the data output by the pipeline operator as the user's password

Bytes -------------------------------------------------------------------------------------

Usermod

Usermod-c "indicates that the content is enclosed by spaces and enclosed in quotation marks." root => modify user description.

Usermod-G root user1 ==> add user1 user to the root group

Usermod-L user1 ==> lock user1

Usermod-U user ==> unlock user1

---------------------------------------------------------------------------------

Chage [Option] User Name

Option:

-L => exhausting the user's password status

-D ==> Date: last password change date (/etc/shadow)

-M ==> days: Password Change Interval (four fields)

-M ====> days: Password validity period (five fields)

-W ====> days: number of warning days before the password expires (six fields)

-I ====> days: Number of days after the password expires (seven characters)

-E ==> day account expiration time: (eight-character segment)

----------------------------------------------------------------------------------

Userdel

Userdel [-r] User Name

Option:

-R ==> delete a user's colleague to delete the user's home directory

Manually delete ==> the following content needs to be deleted

Vi/etc/passwd ==> Delete content containing user1

Vi/etc/shadow ==> Delete content containing user1

Vi/etc/group ==> Delete content containing user1

Vi/etc/gshadow ==> Delete content containing user1

Rm-rf/var/spool/mail/user1 ==> delete an email from user1.

Rm-rf/home/user1 ==> Delete the home Directory of user1

----------------------------------------------------------------

Su ====> User Switching

Su [Option] User Name

-Use Only-indicates that the environment variables of associated users are switched together

-C only executes the command once without switching the command.

Example: su-root ==> switch to the root user

Su-root-c "useradd user1" ==> log on to www and use the root user to add a user1 user

---------------------------------------------------------------------------

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.