"Linux learning is not difficult" user management (5): Modify the Linux user account

Source: Internet
Author: User

9.4 "Linux learning is not difficult" user management (5): Modify the Linux user account

Use the Usermod command to change the user's shell type, the group to which it belongs, the lifetime of the user's password, and the user's login name.

Command syntax:

usermod [Options] [user name]

The meanings of the options in the command are as shown in the table.

Options

option meaning

-G < secondary Group name >

Modify the secondary group to which the user belongs (additional group)

-L < new sign-in name >

Modify user account name

-L

Lock the user password to invalidate the password

-S <shell type >

After you modify the user login, use the Shell. if not, the system will use the system preset Shell

-U

Unlock Password

-U < user uid>

Modify User Uid

-C < username Full name >

Modify the user name of the user account

-D < home directory >

Modify the home directory when the user logs on, If you specify the-m option, the user's old directory is moved to a new directory, and the legacy directory does not exist, the new directory

-E < expiry date >

Modify the validity period of the account, plus the user account stop date, the date format is Mm/dd/yy

-F < expiry date >

Modify the number of days after the password expires to set the password to fail state

-G < main group name >

Modify the primary group to which the user belongs, The cluster name must already exist

-O

allows the use of duplicate Uid

-M

Move the contents of the home directory to a new location


Example: Modify the user Wangwu's home directory to/home/opop, and create the/home/opop directory automatically.

[Email protected] ~]# usermod-d/home/opop-m Wangwu

Example: Modify the user Wangwu login name to Zhaoliu.

[Email protected] ~]# usermod-l Zhaoliu Wangwu

Example: Modify user Zhangsan To disable the account 20 days after the password expires.

[Email protected] ~]# usermod-f Zhangsan

Example: To modify the primary group that the user Zhangsan belongs to is root, the group must exist beforehand.

[Email protected] ~]# usermod-g root Zhangsan

Example: Lock the user Zhangsan password to invalidate the password.

[Email protected] ~]# usermod-l Zhangsan

Example: Unlock user zhangsan password.

[Email protected] ~]# usermod-u Zhangsan

Example: the shell type to modify user Zhangsan is/bin/ksh.

[Email protected] ~]# usermod-s/bin/ksh Zhangsan


This article extracts from "Linux Learning is not difficult" textbook, which is one of the most practical, theoretical and practical Linux Introductory materials. To read the entire book, visit the Linux ops (www.linuxywz.com) website .



Linux learning is not difficult user management (5): Modify Linux User accounts

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.