Linux usermod command parameters and usage detailed

Source: Internet
Author: User

Command: Usermod

Function Description: Modify user account.

Syntax: Usermod [-lu][-c < remarks >][-d < login directory >][-e < expiration >][-f < buffer days >][-g < group >][-g < group >][-l & lt; account name >][-s ][-u] [user account]

Supplemental Note: Usermod can be used to modify the user account settings.


-c< Notes > Modify the user account's memo text.

-D Login Directory > modify the user login directory.

-e< expiry date > change the expiration period of account number.

-f< Buffer days > Modify the number of days after the password expires to close the account.

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

-g< Group > Modify the additional groups to which users belong.

-l< Account name > Modify user account name.

-L LOCK the user's password to invalidate the password.

-S modifies the shell used by the user upon login.

-U modifies the user ID.

-U unlocks password.

Usermod does not allow you to change the user account name on the line. When Usermod is used to change the user ID, it must be confirmed that the user did not perform any programs on the computer. You need to manually change the user's crontab file. You also need to manually change the user's at work file. The use of NIS server requires that the related NIS settings be changed on the server.

Application Examples:

1. Add Newuser2 to Group staff

# USERMOD-G Staff Newuser2

2, modify the NewUser user name is Newuser1

# usermod-l Newuser1 NewUser

3, Lock account Newuser1

# usermod-l Newuser1

4, Unlock the Newuser1

# usermod-u Newuser1

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.