The usermod command
The usermod command modifies an existing user. It has the following syntax:
usermod [options] user-name
- c comment: Typically, the comment is the user's full name.
- -d home-dir: The home directory of the new user.
- -e date: The expiration date for a logon.
- -f time: The number of days between logons before the user is considered expired.
- -g group: The initial logon group for the user.
- -G groups: Additional groups the user should belong to.
- -m: Creates the new user's home directory if it doesn't exist already.
- -s shell-path: Specifies the user's logon shell.
- -l: Locks an account.
- -u: Unlocks an account.
Here's an example that changes a user's full name:
$ usermod -c 'The Beave' theodore
The userdel command
The userdel command deletes a user. It has a simple syntax:
userdel [-r] user-name
If you specify -r, the user's home directory is deleted along with the account.
In this tutorial:
- Linux Commands
- Command Shell Basics
- Editing commands
- Wildcards
- Redirection and piping
- Environment variables
- Shell scripts
- Directory and File Handling Commands
- The cd command
- The mkdir command
- The rmdir command
- The ls command
- The cp command
- The rm command
- The mv command
- The touch command
- The cat command
- Commands for Working with Packages and Services
- The rpm command
- Commands for Administering Users
- The usermod command
- The chage command
- The passwd command
- The newusers command
- The groupadd command
- The groupdel command
- Commands for Managing Ownership and Permissions
- The chgrp command
- The chmod command
- Networking Commands
- The ipconfig command
- The netstat command
- The ping command
- The route command
- The traceroute command