Create, modify, and delete user accounts.

Context: GNU/Linux command examples.

Create, modify, and delete user accounts.

Certainly! Here are examples of GNU/Linux commands for creating, modifying, and deleting user accounts:

  1. Create a User Account:

    • Create a new user account:

      sudo useradd username

      This command creates a new user account with the specified username.

    • Create a user account with additional information (e.g., full name):

      sudo useradd -c "Full Name" username

      This command creates a user account with the specified username and full name.

  2. Set User Account Password:

    • Set a password for a user account:
      sudo passwd username
      This command prompts you to enter and confirm the password for the specified username.
  3. Modify User Account:

    • Modify a user account's username:

      sudo usermod -l new_username old_username

      This command changes the username of the specified user account.

    • Modify a user account's home directory:

      sudo usermod -d /new/home/directory username

      This command changes the home directory of the specified user account.

    • Modify a user account's primary group:

      sudo usermod -g new_group username

      This command changes the primary group of the specified user account.

  4. Delete User Account:

    • Delete a user account:

      sudo userdel username

      This command removes the specified user account.

    • Delete a user account and its home directory:

      sudo userdel -r username

      This command removes the specified user account along with its home directory.

Note: The above commands typically require root or sudo privileges to execute. Replace "username" with the actual username you want to create, modify, or delete.

These commands provide you with the basic functionality to create, modify, and delete user accounts in GNU/Linux. Depending on the distribution, there may be additional options and flags available for these commands.

You should also read:

deluser

Robert Young is the co-founder of Red Hat. Once day, during a visit to the Red Hat campus in Raleigh, North Carolina, he…