Use of user and group management usermod under the command line interface

Source: Internet
Author: User

When you use Useradd to add a good user, you want to make some changes, you need to use the Usermod command.

Function Description: Modify the information of the user account.

  syntax : usermod [-L | U][-c < remarks >][-d < login directory >][-e < expiration >][-f < buffer days >][-g < group >][-g < Group;]

[-l < account name;] [-S < specify login Shell>] [-U < new Uid>] Username

Additional note: Usermod can be used to modify the user account settings.

   Parameters:

-c< Notes > Modify the Notes text for the user account.

Full path to the-d< home directory > Modify the directory in which the user is logged in.

-e< deadline > Modify account Expiration time. Format is: YYYY-MM-DD

-f< buffer days > days after the password expires until the account is permanently invalidated

-g< Group > Modify the group to which the user belongs.

-g< Group > Modify the additional groups to which the user belongs.

-l< Account name > Modify user account name.

-L LOCKS the user password to invalidate the password.

-S modifies the shell used by the user when they log in.

-U modifies the user ID.

-U unlocks the password.

Note: Usermod does not allow changes to user accounts that are being used in the system. When Usermod is used to change the UID, it must be confirmed that the user is not
Execute any program in the.

Modifying the user name and user ID is generally not recommended because it may cause problems with changes to the identity of the file owner. For example, the user before the change in/mnt
Has a file test, after modifying the user name and UID, the owner of the file and the owning group and other related information will not be synchronized changes. Other words
The user has no control over the test file.

Example:

#useradd Waston Add User Waston

Added a line in/etc/passwd after the successful addition

Waston:x:4036:4038::/home/waston:/bin/bash

Adding a group #groupadd super

Added a line in/etc/group after the successful addition

super:x:4037:

#usermod-u 4037 Waston Change the UID of the user Waston to 4037, which is the super group

After the change succeeds, this line is updated in/etc/passwd

Waston:x:4037:4038::/home/waston:/bin/bash


The use of other parameters is similar. No more details

Use of user and group management usermod under the command line interface

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.