โ† All RHCSA Flashcard Decks

RHCSA User and Group Management Flashcards

6 cards from real RHCSA practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 6 RHCSA User and Group Management flashcards as text
  1. A system administrator needs to add an existing user, 'jsmith', to the supplementary 'developers' group without removing them from any other groups they are currently a member of. Which of the following commands will accomplish this task correctly?

    Answer: usermod -aG developers jsmith

    The `usermod` command is used to modify an existing user account. The `-a` (append) option is crucial; it adds the user to the supplementary group(s) specified with the `-G` option without removing them from their current groups. Using `-G` alone would replace the user's entire list of supplementary groups with the new one. The `-g` option modifies the user's primary group, not supplementary groups. The `useradd` command is for creating new users, not modifying existing ones.

  2. As a system administrator, you want to ensure that all newly created user accounts automatically have a default `.bash_profile` and a `README.txt` file in their home directory. Where should you place these template files?

    Answer: /etc/skel

    The `/etc/skel` directory serves as a skeleton directory. Files and directories within `/etc/skel` are automatically copied to a new user's home directory when the account is created with the `useradd` command. `/etc/default/useradd` and `/etc/login.defs` contain default settings for user creation but not file templates. `/home` is the parent directory for user home directories but does not serve as a template.

  3. A user, 'pjenkins', has their primary group set incorrectly. The administrator needs to change the user's primary group to 'sales'. Which command should be used?

    Answer: usermod -g sales pjenkins

    The `usermod` command with the lowercase `-g` option is used to change a user's primary group ID (GID). The uppercase `-G` option is for managing supplementary (secondary) groups. `chgrp` changes the group ownership of files and directories, but not the user's primary group attribute in the `/etc/passwd` file. The `-aG` options are for appending supplementary groups.

  4. Which of the following commands would a system administrator use to view the most recent login times for all users on the system?

    Answer: lastlog

    The `lastlog` command formats and prints the contents of the `/var/log/lastlog` file, which records the most recent login for each user. The `who` command shows who is currently logged on. The `users` command lists the usernames of currently logged-in users. The `id` command displays user and group ID information for a specified user, not login times.

  5. A user account named 'tempuser' is no longer needed, and a sysadmin has been tasked with removing the account along with its home directory and mail spool. Which command will achieve this?

    Answer: userdel -r tempuser

    The `userdel` command is used to delete a user account. By default, it does not remove the user's home directory. The `-r` option must be used to also remove the user's home directory and mail spool. `usermod -L` would lock the account, not delete it. Simply using `rm -rf` on the home directory would leave the user account entry in files like `/etc/passwd` and `/etc/shadow`.

  6. What is the primary purpose of the `/etc/group` file in a Linux system?

    Answer: To define group names, GIDs, and list the members of each group.

    The `/etc/group` file contains essential information about the groups on the system. Each line defines a group, including its name, Group ID (GID), and a comma-separated list of its members. User password hashes are stored in `/etc/shadow`. Default user creation settings are in `/etc/login.defs` and `/etc/default/useradd`. User account attributes are primarily stored in `/etc/passwd`.