Search

How to modify a Linux user using usermod command

The usermod command can also be used to modify options for an existing user with the usermod <options> <username> command. Most of the useradd options from the above table can be used with usermod. Some of the additional options are given in the below table.

 Option

Description

-l <loginname>

Change the user’s username to <loginname>. You should consider changing the user’s home directory and name of the user private group to reflect username change.

-L

 Lock the user. User can no longer log in to the system with the old password.

-U

Unlock the user’s password so the user can log in to the system again.

Related Tutorials
• Introduction to Linux user administration
• How to add a user in Linux using useradd command
• How to use passwd command to manage user passwords
• How to set Linux password aging using chage command
• How to remove user from Linux using userdel command
• The Linux user database (/etc/passwd)
• The Linux password database (/etc/shadow)
• Introduction to Linux User Group
• How to create a new group in Linux using groupadd command
• Linux Group Database (/etc/group) file
• How to manage Linux user group