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:

  1. Add a user to an additional group:

    usermod -aG groupname username
  2. Change a user's login shell:

    usermod -s /bin/bash username
  3. Lock a user's account (disable login):

    usermod -L username
  4. Unlock a previously locked user account:

    usermod -U username
  5. Set the expiration date for a user account:

    usermod -e YYYY-MM-DD username
  6. Add a specific home directory for a user:

    usermod -d /path/to/new/home username
  7. Change a user's primary group:

    usermod -g groupname username
  8. Restrict a user's login shell to a specific command:

    usermod -s /sbin/nologin username
  9. Set a user's password to expire and force them to change it on next login:

    usermod -e 0 username
  10. 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.

 

You should also read: