usermod
Please demontrate 10 examples of using the usermod command on a Fedora GNU/Linux computer system.
Certainly! Here are 10 examples of using the usermod
command on a Fedora GNU/Linux system:
Add a user to an additional group:
usermod -aG groupname username
Change a user's login shell:
usermod -s /bin/bash username
Lock a user's account (disable login):
usermod -L username
Unlock a previously locked user account:
usermod -U username
Set the expiration date for a user account:
usermod -e YYYY-MM-DD username
Add a specific home directory for a user:
usermod -d /path/to/new/home username
Change a user's primary group:
usermod -g groupname username
Restrict a user's login shell to a specific command:
usermod -s /sbin/nologin username
Set a user's password to expire and force them to change it on next login:
usermod -e 0 username
Change a user's username:
usermod -l newusername username
Remember to replace "groupname," "username," and "/path/to/new/home" with actual values relevant to your system. Additionally, exercise caution when modifying user accounts to avoid unintended consequences.