usermod
UsersFundamentals In real LinuxModify a user account
Name: usermod = user modify
This command needs a real Linux system; you can practise it in real Linux mode.
Description
usermod changes an existing account: supplementary groups, login shell, home, name, lock state and so on. The classic mistake is -G without -a, which removes the user from every other supplementary group.
Group changes take effect at the next login.
Syntax
usermod [OPTION]... USERCommon options
| -aG | Append to groups (without -a the list is replaced) |
| -G / --groups GROUPS | Set the supplementary groups (without -a, the old ones are replaced) |
| -g / --gid GROUP | Change the primary group |
| -s / --shell SHELL | Change the login shell |
| -d / --home DIR | Change the home directory (with -m the files move too) |
| -l / --login NEWNAME | Change the login name |
| -L / -U | Lock / unlock the account |
| -e / --expiredate DATE | The account expiry date |
| -c / --comment COMMENT | Change the comment (full name) |