On Unix-like operating systems, the usermod command modifies a user account.
Description
The usermod command is used by an administrator to change a user’s system account settings, as listed in the options below:
- Description
- Syntax
- Notes
- Configuration
- Files
- Examples
- Related commands
- Linux commands help
Syntax
usermod [options] LOGIN
Options
Notes
You must make certain that the named user is not executing any processes when this command is being executed if the user’s numerical user ID, the user’s name, or the user’s home directory is being changed. usermod checks this on Linux, but only checks if the user is logged in according to the utmp file on other systems.
You must change the owner of any crontab files or at jobs manually.
You must make any changes involving NIS (Network Information Service) on the NIS server.
Configuration
The following configuration variables in /etc/login.defs change the behavior of this tool:
Files
usermod makes use of the following files:
Examples
usermod -d /home/exampleusernew exampleuser
Modifies the home directory for the exampleuser account, changing it to /home/exampleusernew.
Related commands
chsh — The C shell command interpreter.useradd — Add a user to the system.userdel — Remove a user from the system.