Useradd 3

Marshawn is a recent hire at Red Hat and she's using a RHEL workstation. She's been tasked with creating a lesson plan for the useradd and usermod commands. What should she include in her lesson plan?

Here are some topics that Marshawn could include in her lesson plan for the useradd and usermod commands:

Useradd Command

  1. Basic Syntax: Introduce the basic syntax of the useradd command, including the mandatory username argument and the various options that can be used to configure the new user account.

  2. Creating User Accounts: Walk through the process of creating a new user account using the useradd command, including specifying the username, password, and other account settings.

  3. Configuring User Accounts: Discuss the various options that can be used with the useradd command to configure user accounts, including the -m option to create a home directory, the -s option to set the default shell, and the -g and -G options to set the primary and secondary groups.

  4. Modifying User Accounts: Explain how to modify existing user accounts using the usermod command, including changing the user's password, modifying group

  5. membership, and setting expiration dates.

  6. Best Practices: Highlight some best practices for managing user accounts, such as using strong passwords, limiting access to privileged accounts, and implementing a user account management policy.

Usermod Command

  1. Basic Syntax: Introduce the basic syntax of the usermod command, including the mandatory username argument and the various options that can be used to modify user accounts.

  2. Changing Passwords: Explain how to change a user's password using the -p option or the passwd command.

  3. Modifying User Accounts: Discuss the various options that can be used with the usermod command to modify user accounts, including the -g and -G options to set primary and secondary groups, the -l option to change the username, and the -e option to set an expiration date.

  4. Deleting User Accounts: Explain how to delete user accounts using the userdel command, and how to delete a user's home directory and files using the -r option.

  5. Best Practices: Highlight some best practices for managing user accounts, such as disabling accounts when no longer needed, regularly reviewing account activity logs, and using automated tools for managing user accounts.

Marshawn may also want to include some practical exercises to help her students gain hands-on experience with the useradd and usermod commands, such as creating new user accounts, modifying account settings, and deleting user accounts. Additionally, she can discuss scenarios in which these commands might be used, such as in a corporate environment where multiple users need to be managed, or in a development environment where users need different levels of access to resources.

______________________________________________________________________

James is a highly skilled Linux Sysadmin at Microsoft. Show me some examples of how he would use the usermod command on a daily basis. Assume that he does not use usermod from a root account.

Sure, here are some examples of how James might use the usermod command in his daily work as a Linux Sysadmin at Microsoft:

  1. Adding users to groups: James may use the usermod command to add users to one or more groups. For example, if a new project is starting and several users need access to a shared directory, he could use the following command to add them to a new group called project1:

    • sudo usermod -aG project1 username1
      sudo usermod -aG project1 username2
      sudo usermod -aG project1 username3
  2. Changing default shell: James may use the usermod command to change the default shell for a user. For example, if a user prefers to use the zsh shell instead of the default bash shell, he could use the following command:
    • sudo usermod -s /bin/zsh username
  3. Setting password expiration: James may use the usermod command to set an expiration date for a user's password. For example, he could use the following command to require a user to change their password every 90 days:
    • sudo usermod -e $(date -d "+90 days" +%Y-%m-%d) username
  4. Renaming a user: James may use the usermod command to rename a user. For example, if a user's name changes due to a marriage or other reason, he could use the following command to change their username:
    • sudo usermod -l newusername oldusername
  5. Changing UID: James may use the usermod command to change a user's UID. For example, if a user's UID conflicts with another UID on the system, he could use the following command to change it to a new value:
    • sudo usermod -u 1001 username

These are just a few examples of how James might use the usermod command in his daily work. As a skilled Sysadmin, he would likely use a variety of other usermod options and strategies to manage user accounts and maintain system security.

You should also read:

useradd versus adduser

Christian is a RHEL Sysadmin at Google. He wants to master the similarities and differences between the useradd command and the adduser command.

Useradd 2

Juan is getting ready to take a RHEL-based LFCS exam. Please tell me about strategies to pass the LCFS exam, and the top…

Useradd

What is the origin of the useradd command? The useradd command is a standard command in most Unix-like operating systems, including Linux. It…