Add commands for Linux Account Management

Source: Internet
Author: User

Add commands for Linux Account Management

Add commands for Linux Account Management

1. useradd [-u UID] [-g initial group] [-G Secondary group] [-mM] [-c description bar] [-d Home Directory] [-s shell] user account, parameters:

1)-u: Set the UID of the added account

2)-g: Set the initial group name. the GID of the Group will be placed in the fourth field of/etc/passwd.

3)-G: the group that this account can join. This option parameter will modify the relevant information in/etc/group.

4)-M: force the creation of the user's home directory (default value of the system account)

5)-m: force you to create a home directory (the default value of the general account)

6)-c: Description of the account in the Fifth Column of/etc/passwd.

7)-d: specify a directory as a home directory.

8)-r: Create a system account. The UID of this account is limited. For details, see:

9)-s: Set shell, default value/bin/bash

10)-e: Account Expiration day settings, format, YYYY-MM-DD

11)-f: followed by the seventh field project of shadow, specifying whether the password will be invalid. 0 indicates that the password will be invalid immediately, -1 indicates that the password will never expire (the password will only expire and be forced to be reset upon logon). If it is a number, it indicates the number of days after which the password will expire.

12)-D: display the default value of this command

2. etc/skel: This is the reference directory for new users. That is, new users directly copy the items in this directory to the home directory, therefore, you can modify this directory to automatically add specified content to the Home Directory of the new user.

3. etc/login. defs: new default values for user mail directory, UID, GID, password, and other parameter settings

In short, the directories related to adding user default settings are:/etc/default/useradd,/etc/login. defs,/etc/skel /*

4. passwd [-- sdtin]: change the password of the current user;

Passwd [-l] [-u] [-- sdtin] [-S] [-n days] [-x days] [-w days] [-I days] account; modify the password of a specified user. parameters:

1)-l: Lock, which will be added in front of the second column of/etc/shadow! Invalidate Password

2)-u: unlock

3)-S: List password-related parameters, that is, most of the information in the shadow file.

4)-n: How long cannot I change the password?

5)-x: how long the password must be changed

6)-w: number of warning days before the password expires

7)-I: Password Expiration day

8) -- stdin: obtains the password value through standard input and modifies the password.

5. chage [-ldEImMW] Account name: Modify shadow related options, parameters,

1)-l: list detailed Password parameters for this account

2)-d: followed by date, modified the date of the last password change in the Third Field of shadow), format YYYY-MM-DD

3)-E: followed by the date, modify the shadow eighth field (Account Expiration day) format YYYY-MM-DD

4)-I: next to the number of days, modify the seventh parameter of shadow, password expiration day

5)-m: next to the number of days. Modify the fourth field of shadow (Minimum Password retention days)

6)-M: next to the number of days, modify the fifth field of shadow (how long the password needs to be changed)

7)-W: The next day. Modify the sixth field of shadow (number of days before the password expires)

6. usermod [-cdegGlsuLU] username: parameter,

1)-c: account description in the Fifth Column of/etc/passwd, which can be set at will

2)-d: specify a directory as a home directory.

3)-f: followed by the seventh field project of shadow, specifying whether the password will expire. 0 indicates that the password will expire immediately, -1 indicates that the password will never expire (the password will only expire and be forced to be reset upon logon). If it is a number, it indicates the number of days after which the password will expire.

4)-g: Set the initial group name. the GID of the Group will be placed in the fourth field of/etc/passwd.

5)-G: The group (secondary group) that this account can join. This option parameter modifies the relevant information in/etc/group.

6)-a: it can be used with-G to "add secondary group support" rather than set

7)-l: followed by the account name, that is, to modify the account name, the first column of/etc/passwd

8)-s: The actual shell file, for example,/bin/bash.

9)-u: followed by uid

10)-L: temporarily freeze the user's password so that he cannot log on. That is, change the password bar of/etc/shadow.

11)-U: remove the/etc/shadow password bar, that is, unfreeze

12)-e: Account Expiration day settings, format, YYYY-MM-DD

This article permanently updates the link address:

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.