The usermod command in Linux is used to modify user accounts by changing various attributes without deleting and recreating the account. Here are some common options you can use with usermod:
Change Username:
sudo usermod -l new_username old_usernameChange Home Directory:
sudo usermod -d /new/home/directory -m usernameAdd User to Groups:
sudo usermod -aG groupname usernameChange Login Shell:
sudo usermod -s /path/to/new/shell usernameSet Account Expiration Date:
sudo usermod -e YYYY-MM-DD usernameView User Information: You can check the changes by using commands like
id,groups, or examining the/etc/passwdand/etc/groupfiles.
These options allow administrators to efficiently manage user accounts in a Linux environment.
