Courseiva

Red Hat Certified System Administrator EX200 (EX200) — Questions 175

127 questions total · 2pages · All types, answers revealed

Page 1 of 2

Page 2
1
MCQeasy

Based on the exhibit, which command should be used to start the container named 'mycontainer'?

A.podman attach mycontainer
B.podman restart mycontainer
C.podman run mycontainer
D.podman start mycontainer
AnswerD

podman start is correct because it changes an existing, stopped container from the Exited state to the Running state without creating a new container or pulling an image. It resumes the container's configured entrypoint, command, and environment, making it the exact tool needed for the situation shown in the exhibit.

Why this answer

The correct command to start an existing but stopped container is 'podman start mycontainer'. 'podman start' resumes a container that has been created (via 'podman create') or previously stopped, without creating a new instance. Option D is correct because it directly addresses the requirement to start the container named 'mycontainer' that already exists.

Exam trap

The trap here is that candidates confuse 'podman run' (which creates and starts a new container) with 'podman start' (which starts an existing stopped container), leading them to choose option C when the container already exists.

How to eliminate wrong answers

Option A is wrong because 'podman attach' connects your terminal to a running container's standard input/output/error streams; it does not start a container. Option B is wrong because 'podman restart' stops and then starts a container that is already running or stopped, but the question asks specifically to 'start' the container, not to restart it; restart implies a stop followed by a start, which is unnecessary and potentially disruptive for a stopped container. Option C is wrong because 'podman run' creates and starts a new container from an image, but the container 'mycontainer' already exists (as implied by the exhibit), so 'run' would attempt to create a duplicate or fail if the name conflicts.

2
Multi-Selectmedium

Which TWO commands can change the primary group of an existing user?

Select 2 answers
A.usermod -aG
B.gpasswd -a
C.vigr
D.groupmems -a
E.useradd -G
AnswersA, B

`usermod -aG` adds the user to a supplementary group, not the primary group.

Why this answer

None of the listed commands change the primary group of an existing user. The correct commands are `usermod -g` to change the primary group directly, or `groupmod -g` after ensuring the user is the only member of the group.

Exam trap

The trap is assuming that `usermod -aG` or `gpasswd -a` can change the primary group when they actually manage supplementary group membership only.

3
MCQmedium

A system administrator needs to ensure that a web server running Apache httpd starts automatically after a system reboot. Which command should the administrator use to enable the httpd service?

A.systemctl daemon-reload
B.systemctl start httpd
C.systemctl reenable httpd
D.systemctl enable httpd
AnswerD

Enables the service to start at boot.

Why this answer

`systemctl enable httpd` creates the necessary symlinks in the systemd unit configuration directories (e.g., `/etc/systemd/system/multi-user.target.wants/`) to ensure the httpd service starts automatically at boot. This is the standard method for enabling a service in a Red Hat Enterprise Linux 8/9 environment using systemd.

Exam trap

The trap here is that candidates confuse `systemctl start` (immediate runtime start) with `systemctl enable` (persistent boot-time activation), or they invent a non-existent command like `systemctl reenable` instead of using the correct `systemctl enable`.

How to eliminate wrong answers

Option A is wrong because `systemctl daemon-reload` reloads the systemd manager configuration, scanning for new or changed unit files, but does not enable any service for automatic startup. Option B is wrong because `systemctl start httpd` immediately starts the service in the current session but does not configure it to persist across reboots. Option C is wrong because `systemctl reenable httpd` is not a valid systemd command; the correct command to re-enable a service is `systemctl enable httpd` (which is idempotent) or `systemctl disable httpd` followed by `systemctl enable httpd`.

4
MCQeasy

In /etc/fstab, which values in the dump and pass fields enable automatic file system checking at boot?

A.dump=1, pass=0
B.dump=0, pass=0
C.dump=0, pass=1
D.dump=1, pass=1
AnswerC

This is the correct setting. A dump value of 0 is the standard choice on modern Linux systems, as dump(8) is obsolete and almost never used. The pass value of 1 tells fsck(8) to check this filesystem at boot, and 1 is specifically used for the root filesystem; other filesystems use pass=2 to run after the root check completes.

Why this answer

The `pass` field in `/etc/fstab` controls the order of file system checks at boot. A value of 1 means the root file system is checked first, and a value of 2 or higher means other file systems are checked after root. The `dump` field is for backup utility (dump) and is not related to boot-time checking; it must be 0 to disable dump.

Thus, `dump=0, pass=1` enables automatic file system checking (fsck) at boot for the root file system.

Exam trap

Red Hat often tests the misconception that `dump=1` is required for boot-time file system checks, but the `dump` field is unrelated to fsck; the trap is confusing the `dump` field with the `pass` field's role in enabling automatic checks.

How to eliminate wrong answers

Option A is wrong because `dump=1` enables dump backups (not boot-time checking), and `pass=0` disables fsck entirely, so no automatic checking occurs. Option B is wrong because `dump=0` and `pass=0` both disable dump and fsck, meaning no file system check at boot. Option D is wrong because `dump=1` enables dump (unnecessary for boot checking) and `pass=1` enables fsck, but the combination is not required; the correct minimal setting for enabling fsck is `dump=0, pass=1`.

5
Multi-Selecthard

Which three fields are present in every /etc/fstab entry? (Choose three.)

Select 3 answers
A.Mount point
B.Device
C.Dump field
D.Filesystem type
E.UUID
AnswersA, B, C

Correct. The mount point specifies where the filesystem will be attached to the directory tree and is required.

Why this answer

Every /etc/fstab entry consists of six whitespace-separated fields: device, mount point, filesystem type, options, dump, and pass. Although dump and pass can be omitted and default to 0, the dump field is considered present in every entry due to its default value. The question asks for three fields that are present in every entry; these include the mount point (A), device (B), and dump field (C).

The filesystem type (D) is also present, but the question requires exactly three choices, and the dump field is often overlooked. UUID (E) is not a separate field; it is a method to specify the device.

Exam trap

Candidates often think the dump field is optional and thus not present in every entry, but it defaults to 0, making it a field present in all entries. The question asks for fields present, not only mandatory ones.

6
MCQhard

An administrator attempts to mount an XFS filesystem from /dev/sdc1 to /mnt/archive but receives the error: 'mount: /mnt/archive: wrong fs type, bad option, bad superblock on /dev/sdc1, missing codepage or helper program, or other error.' The output of 'dumpe2fs /dev/sdc1' shows 'dumpe2fs: Bad magic number in super-block while trying to open /dev/sdc1'. What is the most likely problem?

A.The mount point /mnt/archive does not exist
B.The filesystem on /dev/sdc1 is XFS, not ext4
C.The XFS kernel module is not loaded
D.The partition /dev/sdc1 does not exist
AnswerB

dumpe2fs is designed for ext2, ext3, and ext4 filesystems; it looks for the ext family superblock magic (0xEF53) at offset 1024 on the device. XFS uses its own superblock format with the ASCII magic "XFSB" at a different offset. When dumpe2fs reads /dev/sdc1, it does not find the ext magic and prints "bad magic number in super-block," which simply means the device does not contain an ext filesystem, not that it is corrupt. The device likely holds a valid XFS filesystem, so running mount -t xfs /dev/sdc1 /mnt/archive will succeed. This is the correct diagnosis because the tool was incompatible with the actual filesystem type.

Why this answer

The error message 'wrong fs type' combined with 'dumpe2fs: Bad magic number in super-block' indicates that the filesystem on /dev/sdc1 is not an ext2/3/4 filesystem. dumpe2fs is designed to read ext2/3/4 superblocks, and the 'bad magic number' error means it cannot find a valid ext superblock. Since the administrator is trying to mount an XFS filesystem, the correct tool to examine it is xfs_db or xfs_info, not dumpe2fs. Therefore, the most likely problem is that the filesystem is XFS, not ext4.

Exam trap

The trap here is that candidates see 'bad superblock' and immediately think of ext4 superblock corruption or backup superblock recovery, when in fact the error is simply due to using an ext4-specific tool (dumpe2fs) on a non-ext4 filesystem.

How to eliminate wrong answers

Option A is wrong because if the mount point /mnt/archive did not exist, the error would be 'mount point does not exist' rather than 'wrong fs type' or 'bad superblock'. Option C is wrong because if the XFS kernel module were not loaded, the error would typically be 'mount: unknown filesystem type 'xfs'' or a similar message, not a 'bad superblock' error from dumpe2fs. Option D is wrong because if /dev/sdc1 did not exist, the error would be 'mount: special device /dev/sdc1 does not exist' or 'no such device', not a superblock-related error.

7
MCQmedium

Refer to the exhibit. A user named 'carol' has been added to the system with the command useradd -G wheel carol. Which line in /etc/group will confirm that carol is now a member of the wheel group?

A.wheel:x:10:carol,root,alice,bob
B.wheel:x:10:root,alice,bob,carol
C.wheel:x:10:root,alice,bob,carol,
D.wheel:x:10:root,alice,bob carol
AnswerB

Correct. The `useradd -G wheel carol` command adds 'carol' to the supplementary group 'wheel' by appending her username to the end of the comma-separated member list in `/etc/group`. The line `wheel:x:10:root,alice,bob,carol` shows 'carol' after the existing members, with no trailing comma, which is the correct format.

Why this answer

The `useradd -G wheel carol` command adds 'carol' to the supplementary group 'wheel', and the `/etc/group` file lists supplementary members as a comma-separated list with no trailing comma. The line `wheel:x:10:root,alice,bob,carol` shows 'carol' appended after the existing members, which matches the expected format.

Exam trap

In Red Hat Enterprise Linux, the /etc/group file format requires member lists to be comma-separated with no trailing comma, and the useradd -G command appends users to the end of the supplementary group member list.

How to eliminate wrong answers

Option A is wrong because it lists 'carol' before 'root', but the `useradd -G` command appends the new user to the end of the existing group member list, not at the beginning. Option C is wrong because it includes a trailing comma after 'carol', which is invalid in `/etc/group` — the file format does not allow a trailing comma. Option D is wrong because it uses a space instead of a comma to separate 'bob' and 'carol', but the `/etc/group` file requires commas as delimiters between usernames.

8
MCQeasy

An administrator writes a script that uses the 'set -e' option at the top. What is the primary effect of this option?

A.It treats unset variables as an error
B.It prints each command before execution
C.It enables debug mode with verbose output
D.It exits the script immediately if a command fails
AnswerD

This is the exact purpose of `set -e`, also known as `errexit`. When enabled, the shell immediately exits if any simple command, pipeline, or compound command (outside of contexts like `if`, `while`, `until`, `!`, or `&&`/`||` left operands) returns a non-zero status. This halts the script at the first error rather than continuing with unchecked failures.

Why this answer

The 'set -e' option instructs the shell to exit immediately if any command or pipeline returns a non-zero exit status (i.e., fails). This is commonly used in scripts to prevent execution from continuing after an error, which could lead to unpredictable behavior or data corruption. It does not affect variable handling, command printing, or debug verbosity.

Exam trap

The trap here is that candidates often confuse 'set -e' with 'set -u' (unset variable errors) or with debugging options like 'set -x' or 'set -v', because all are shell options that begin with 'set -' but have very different effects.

How to eliminate wrong answers

Option A is wrong because treating unset variables as an error is the behavior of 'set -u', not 'set -e'. Option B is wrong because printing each command before execution is the effect of 'set -x' (or 'set -o xtrace'), not 'set -e'. Option C is wrong because enabling debug mode with verbose output is achieved by 'set -v' (or 'set -o verbose'), which prints shell input lines as they are read, not by 'set -e'.

9
MCQmedium

A file has been assigned an incorrect SELinux context, preventing a service from accessing it. Which command restores the default SELinux context for that file?

A.restorecon
B.chcon
C.fixfiles
D.setfiles
AnswerA

restorecon resets a file's SELinux context to the policy-defined default by consulting the file_contexts rules, typically with `restorecon -v /path/to/file`. It is the correct tool when a file's context has become incorrect because it determines the intended context from the policy rather than relying on a manually specified value, and it only changes files whose current context does not match the default.

Why this answer

The `restorecon` command is used to restore the default SELinux security context for a file or directory based on the system's policy store (the file_contexts database). When a file has an incorrect context that prevents a service from accessing it, `restorecon` resets the context to the correct default, allowing the service to access the resource as intended.

Exam trap

The trap here is that candidates often confuse `chcon` (which changes context manually) with `restorecon` (which restores the default from policy), leading them to pick `chcon` because they think they need to 'change' the context rather than 'restore' it to the correct default.

How to eliminate wrong answers

Option B (chcon) is wrong because `chcon` changes the SELinux context manually to a user-specified value, but it does not restore the default context from the policy database; it can introduce further misconfiguration if the wrong context is specified. Option C (fixfiles) is wrong because `fixfiles` is a script that corrects file contexts on entire filesystems or directories (e.g., after a policy update), not for a single file, and it is overkill for a targeted restoration. Option D (setfiles) is wrong because `setfiles` is a low-level tool used to initialize or verify file contexts on a filesystem, typically during system installation or policy reloads, and is not intended for routine single-file context restoration.

10
MCQmedium

A team wants to run a container as a non-root user inside the container for security. Which instruction should be included in the Containerfile?

A.USER
B.PODMAN_USER
C.ENV USER
D.RUN useradd
AnswerA

The USER instruction is the standard Containerfile directive that sets the active user for subsequent instructions, including the final CMD/ENTRYPOINT runtime process. By specifying a non-root user or numeric UID (e.g., USER 1000), the container runs with least privilege. This is the only option here that directly changes the identity of the running container process.

Why this answer

The USER instruction in a Containerfile (Dockerfile) sets the user name or UID to use when running the container and for any subsequent RUN, CMD, or ENTRYPOINT instructions. By default, containers run as root (UID 0), which poses a security risk. Using USER to switch to a non-root user (e.g., USER 1001) ensures the container process runs with reduced privileges, aligning with the principle of least privilege.

Exam trap

The trap here is that candidates often confuse creating a user (RUN useradd) with actually running as that user, forgetting that the USER instruction is required to switch the runtime context, or they invent non-existent instructions like PODMAN_USER.

How to eliminate wrong answers

Option B (PODMAN_USER) is wrong because there is no such instruction in Containerfile/Dockerfile syntax; Podman uses the same standard instructions as Docker. Option C (ENV USER) is wrong because ENV sets environment variables (e.g., ENV USER=myuser) but does not change the runtime user identity; the container still runs as root unless a USER instruction is used. Option D (RUN useradd) is wrong because while useradd creates a user account inside the image, it does not switch the active user for subsequent instructions or the container's entrypoint; you must still use USER to actually run as that user.

11
MCQhard

A RHEL 9 system has a second disk /dev/sdb that needs to be partitioned with a single partition using all space, formatted with XFS, and mounted persistently at /data. The administrator uses fdisk to create the partition /dev/sdb1. Which filesystem creation command should be used?

A.mkfs.xfs /dev/sdb1
B.mke2fs /dev/sdb1
C.mkfs -t ext4 /dev/sdb1
D.mkfs.ext4 /dev/sdb1
AnswerA

mkfs.xfs is the correct command because it explicitly initializes an XFS filesystem on the target partition. XFS is the default filesystem in RHEL 9 for root and many standard partitions, and this invocation creates the required on-disk structure, including the superblock, allocation groups, and B+tree metadata. After running this command, the partition can be mounted and used as an XFS volume.

Why this answer

The correct command is mkfs.xfs /dev/sdb1 because the question specifies that the partition must be formatted with XFS. The mkfs.xfs command is the dedicated tool for creating an XFS filesystem on a block device. It directly invokes the mkfs.xfs utility, which writes the XFS superblock and metadata structures to the partition.

Exam trap

The trap here is that candidates often confuse mkfs.xfs with generic mkfs commands or ext-family tools, assuming any mkfs variant will work, but the exam specifically tests knowledge of the correct filesystem-specific command for XFS.

How to eliminate wrong answers

Option B is wrong because mke2fs is a legacy command for creating ext2/ext3/ext4 filesystems, not XFS. Option C is wrong because mkfs -t ext4 creates an ext4 filesystem, not XFS. Option D is wrong because mkfs.ext4 is a convenience wrapper for creating ext4 filesystems, not XFS.

12
MCQmedium

Refer to the exhibit. An administrator runs xfs_growfs on /dev/sdc1. What is the most likely reason the command succeeded without prior partition resizing?

A.The partition was automatically resized by xfs_growfs
B.The underlying block device (partition or logical volume) was extended before the command
C.The filesystem was already using the full partition size and the command had no effect
D.The filesystem was mounted with the 'grow' option allowing online growth
AnswerB

xfs_growfs works by expanding the filesystem's data allocation structures to consume the additional space that must already exist on the backing device. Before running the command, the administrator must have extended the partition or logical volume using lvextend or a partition editor. When invoked on a mounted XFS filesystem with no arguments, it grows the filesystem to the maximum size permitted by the underlying block device.

Why this answer

xfs_growfs can only expand an XFS filesystem to fill the available space on the underlying block device. If the command succeeded without prior partition resizing, it means the block device (e.g., a partition or logical volume) was already extended beforehand. The filesystem then uses the new space when xfs_growfs is run.

Exam trap

A common misconception is that xfs_growfs can resize the partition itself, but it only expands the filesystem to match an already extended block device (e.g., LVM volume or disk partition).

How to eliminate wrong answers

Option A is wrong because xfs_growfs does not resize partitions; it only grows the filesystem within the existing block device. Option C is wrong because if the filesystem already used the full partition, xfs_growfs would report that no change was needed, but the question states the command 'succeeded' (implying growth occurred). Option D is wrong because there is no 'grow' mount option in XFS; online growth is handled by xfs_growfs itself, not a mount flag.

13
MCQmedium

An administrator writes a script to check disk usage and send an alert if usage exceeds 80%. The script uses 'df -h /' and parses the output. To maintain portability and avoid common pitfalls, which approach is recommended?

A.Use 'df -h / | tail -1 | sed 's/.* //' | tr -d '%'
B.Use 'df -h / | tail -1 | cut -d' ' -f5'
C.Use 'df / | awk 'NR==2 {print $5}' | tr -d '%'
D.Use 'df -h / | grep -oP '\d+%'
AnswerC

This option uses `df /` without `-h`, which produces a stable, machine-parseable output. The `awk` command extracts the fifth field (the percentage used) and `tr` removes the percent sign. This is portable across different Unix/Linux systems.

Why this answer

It uses `df /` (without `-h`) to produce a stable, machine-parseable output where the fifth field (`$5`) is always the percentage used, and `awk` reliably extracts it. The `tr -d '%'` removes the percent sign for numeric comparison. This approach avoids the portability issues of parsing human-readable output from `df -h`, which can vary in column spacing and ordering across different Unix/Linux systems.

Exam trap

The trap on the RHCSA exam is that candidates assume `-h` is always better for readability, but the exam tests understanding that human-readable output is unreliable for scripting due to inconsistent column formatting across different Unix/Linux distributions.

How to eliminate wrong answers

Option A is wrong because `sed 's/.* //'` greedily removes everything up to the last space, which fails if the mount point contains spaces or if the output format varies (e.g., long device names). Option B is wrong because `cut -d' ' -f5` splits on single spaces, but `df -h` output often uses multiple spaces or tabs as delimiters, causing `cut` to misinterpret columns. Option D is wrong because `grep -oP` uses Perl-compatible regex, which is not available in all environments (e.g., older systems or minimal installations), and the pattern `\d+%` may match unexpected text like '1%' in a filesystem name.

14
MCQhard

During boot, a server fails to mount an NFS filesystem listed in /etc/fstab. Which troubleshooting step should be taken first to isolate the issue?

A.Check the status of remote-fs.target with 'systemctl status remote-fs.target'
B.Check the status of nfs-client.target with 'systemctl status nfs-client.target'
C.Try to manually mount the NFS share with 'mount /mnt/nfs'
D.View kernel messages with 'dmesg | grep -i nfs'
AnswerA

Checking 'systemctl status remote-fs.target' is the correct first step because systemd uses this target to synchronize the activation of all remote filesystem mounts, including NFS, during the boot sequence. If the target is in a 'failed' or 'degraded' state, the status output will directly show which mount unit failed and why, allowing you to then inspect that specific unit's logs or configuration rather than guessing. This target is explicitly ordered after network-online.target and pulls in the mount units, so its state is the authoritative indicator of whether boot-time NFS mounting was attempted and completed.

Why this answer

When an NFS filesystem fails to mount during boot, the first step is to check whether the remote-fs.target unit is active. This target is responsible for triggering the mounting of all remote filesystems (including NFS) after the network is available. If remote-fs.target is not active or has failed, the NFS mount will not be attempted, and troubleshooting should start here before investigating the NFS share itself.

Exam trap

Red Hat often tests the misconception that NFS client services (nfs-client.target) are responsible for mounting NFS filesystems, when in fact the mounting is orchestrated by remote-fs.target, and troubleshooting should start there.

How to eliminate wrong answers

Option B is wrong because nfs-client.target is a target that only ensures NFS client services (like rpcbind and nfs-idmapd) are started, but it does not directly control the mounting of filesystems listed in /etc/fstab; the actual mount is governed by remote-fs.target. Option C is wrong because attempting to manually mount the share with 'mount /mnt/nfs' assumes the issue is with the share or network, but if the boot failure is due to a missing or misconfigured remote-fs.target, the manual mount might succeed and mislead the troubleshooting; the correct first step is to check the target status. Option D is wrong because viewing kernel messages with 'dmesg | grep -i nfs' can provide useful details after the target status is verified, but it is not the first step; the boot failure may be caused by a target dependency issue that dmesg would not directly reveal.

15
MCQmedium

Refer to the exhibit. An administrator wants to create an LVM logical volume using /dev/sdb3. What is the first step to complete this task?

A.Format the partition with mkfs.ext4 /dev/sdb3
B.Create a physical volume with pvcreate /dev/sdb3
C.Create a logical volume with lvcreate -L 10G -n lv01 vg01
D.Create a volume group with vgcreate vg01 /dev/sdb3
AnswerC

The exhibit confirms that the physical volume /dev/sdb3 and the volume group vg01 already exist, so the only remaining prerequisite is to create the logical volume itself. The command lvcreate -L 10G -n lv01 vg01 allocates a 10 GiB logical volume named lv01 from the free extents in vg01, which is exactly the correct next step. Afterward, a filesystem can be created on /dev/vg01/lv01.

Why this answer

Based on the exhibit, /dev/sdb3 is already initialized as a physical volume and belongs to a volume group. Therefore, the first step to create a logical volume is to use lvcreate directly, as the PV and VG are already in place. Option B is incorrect because pvcreate is not needed when the partition is already a PV.

Exam trap

The trap is that candidates may assume they must always run pvcreate first, but the exhibit shows the PV already exists. Always verify the current state of the disk before deciding the next step.

How to eliminate wrong answers

Option A is wrong because formatting the partition with mkfs.ext4 creates a filesystem directly on the block device, which bypasses LVM entirely and prevents its use as a physical volume. Option C is wrong because lvcreate requires an existing volume group (vg01) that already contains physical volumes; attempting this step first would fail as vg01 does not exist. Option D is wrong because vgcreate requires at least one initialized physical volume as an argument; /dev/sdb3 must first be a PV via pvcreate before it can be added to a volume group.

16
MCQmedium

A system administrator needs to change the primary group of an existing user to a group that already exists. Which command should be used?

A.groupmod -g existinggroup username
B.usermod -g existinggroup username
C.usermod -p existinggroup username
D.usermod -G existinggroup username
AnswerB

This is correct because `usermod -g` directly modifies the user's primary group by changing the GID field in the `/etc/passwd` entry. The specified group must already exist on the system, otherwise `usermod` will return an error and make no changes. After this command, newly created files and directories will inherit this group as their owning group by default, until the user changes it.

Why this answer

The `usermod -g` command changes the primary group of an existing user to a specified group that already exists on the system. The `-g` option sets the initial login group (GID) for the user, which must be a valid group name or GID from `/etc/group`.

Exam trap

The trap here is confusing the `-g` (primary group) and `-G` (supplementary groups) options of `usermod`, leading candidates to pick option D when they need to change the primary group.

How to eliminate wrong answers

Option A is wrong because `groupmod -g` changes the GID of an existing group, not the primary group of a user. Option C is wrong because `usermod -p` is used to set or change the user's password (encrypted), not their group membership. Option D is wrong because `usermod -G` sets the supplementary (secondary) group list for the user, not the primary group.

17
MCQmedium

A junior system administrator configures rsyslog on a RHEL 9 server to forward logs to a remote centralized log server. They add the line *.* @192.168.1.100:514 to /etc/rsyslog.conf and restart rsyslog with systemctl restart rsyslog. Local logging works fine, but the remote server does not receive any logs. The administrator checks the local firewall and confirms that UDP port 514 is open outbound. They also verify network connectivity using nc. What is the most likely cause?

A.The systemd unit for rsyslog is masked, preventing it from running.
B.The remote rsyslog server is not listening on UDP port 514.
C.The SELinux boolean rsyslog_remote is disabled, blocking outbound syslog.
D.The configuration should use @@ for TCP instead of @ for UDP.
AnswerC

On RHEL 9, SELinux ships with the rsyslog_remote boolean disabled by default, which prevents rsyslogd from making outbound TCP/UDP connections to a central log server. Even with a correct rsyslog action line (e.g., *.* @192.0.2.10:514), SELinux will silently drop the packet and log an AVC denial in /var/log/audit/audit.log. Enabling the boolean with `setsebool -P rsyslog_remote 1` allows rsyslog to send syslog messages over the network, making this the correct fix when the service restarts normally but no logs arrive at the remote server.

Why this answer

On RHEL 9, SELinux enforces a targeted policy that blocks rsyslog from making outbound network connections by default. The boolean `rsyslog_remote` controls this behavior; when disabled, SELinux denies the outbound syslog traffic even though the local firewall allows it. The administrator must enable this boolean with `setsebool -P rsyslog_remote on` to allow rsyslog to forward logs via UDP or TCP.

Exam trap

The trap here is that candidates focus on network-level troubleshooting (firewall, connectivity) and overlook SELinux, which is a mandatory access control layer that can block outbound connections even when the firewall is open.

How to eliminate wrong answers

Option A is wrong because if the systemd unit for rsyslog were masked, the `systemctl restart rsyslog` command would fail with an error, and local logging would not work. Option B is wrong because the administrator verified network connectivity with `nc`, which would fail if the remote server were not listening on UDP 514, and the question states local logging works fine, implying the remote server is reachable. Option D is wrong because the `@` directive correctly specifies UDP transport; using `@@` would switch to TCP, which is not required and would not fix the SELinux block.

18
MCQeasy

An administrator needs to add a 2GB swap partition to an existing disk (/dev/sdc) that already has one partition. The administrator creates a second primary partition using fdisk and sets the type to Linux swap (82). Which command completes the setup to enable swap?

A.swapon /dev/sdc2
B.mkfs.swap /dev/sdc2 && swapon /dev/sdc2
C.mkswap /dev/sdc2 && swapon /dev/sdc2
D.mkswap /dev/sdc && swapon /dev/sdc
AnswerC

mkswap /dev/sdc2 writes the swap signature and metadata to the /dev/sdc2 partition, preparing it for use as swap space. Then swapon /dev/sdc2 activates it immediately, making the kernel use it for paging. This two-step sequence is the correct procedure, and you can verify that it worked with swapon --show or by checking the output of free.

Why this answer

After creating the partition with fdisk and setting the type to 82 (Linux swap), the partition must be formatted as a swap area using `mkswap` before it can be activated. The `swapon` command then enables the swap space. Option C correctly chains `mkswap /dev/sdc2` to initialize the swap signature and `swapon /dev/sdc2` to activate it.

Exam trap

Red Hat often tests the distinction between formatting a filesystem (`mkfs`) and initializing swap (`mkswap`), leading candidates to mistakenly use `mkfs.swap` or skip the initialization step entirely.

How to eliminate wrong answers

Option A is wrong because `swapon` alone cannot activate a partition that has not been initialized as a swap area; it requires a valid swap signature written by `mkswap`. Option B is wrong because `mkfs.swap` is not a valid command; the correct command is `mkswap`. Option D is wrong because it targets the whole disk `/dev/sdc` instead of the specific partition `/dev/sdc2`, and the disk itself cannot be used as swap without a partition table and proper initialization.

19
MCQhard

An administrator replaces a failed disk in a RAID 10 array /dev/md0. The new disk is /dev/sdc. The admin runs: mdadm /dev/md0 --add /dev/sdc. The command succeeds, but the array does not start rebuilding. What is the most likely reason?

A.The new disk must be partitioned with the same layout as the failed disk.
B.The --add command should have been --re-add instead.
C.The array is still clean and does not need the new disk yet.
D.The failed disk was not removed from the array first; you need to mark it as failed and remove it.
AnswerD

Use mdadm --manage /dev/md0 --fail /dev/sdX and --remove before adding new disk.

Why this answer

When a disk in a RAID array fails, the array marks it as faulty but does not automatically remove it. The administrator must first explicitly mark the failed disk as failed with `mdadm --fail` and then remove it with `mdadm --remove` before adding a replacement. Without removing the failed device, the array still considers the old disk as part of the array, and the new disk is not recognized as a replacement, so no rebuild starts.

Exam trap

The trap here is that candidates assume a failed disk is automatically removed from the array, but mdadm requires explicit removal before a new disk can be added to trigger a rebuild.

How to eliminate wrong answers

Option A is wrong because mdadm can add a whole disk (e.g., /dev/sdc) directly to a RAID array without requiring partitions; the array will use the entire disk as a component. Option B is wrong because --re-add is used to re-add a disk that was previously part of the array and was removed but not failed, not for a new replacement disk. Option C is wrong because a RAID 10 array with a missing or failed disk is degraded and will immediately start rebuilding once a spare or new disk is added; the array's 'clean' state is irrelevant to the rebuild trigger.

20
MCQhard

A Red Hat Enterprise Linux server has been configured with a custom repository for offline updates. The administrator runs 'yum repolist' and the custom repository is not listed. Which command should be used to verify that the repository configuration file is valid and located in the correct directory?

A.yum repoinfo
B.cat /etc/yum.repos.d/custom.repo
C.yum check-repo
D.yum-config-manager --dump
AnswerB

Running cat /etc/yum.repos.d/custom.repo will print the exact bytes of the file to stdout, confirming both that the file exists in the proper /etc/yum.repos.d directory and what its repository configuration lines contain. If the file is missing, cat returns a nonzero exit status with a 'No such file or directory' error, so it provides an unambiguous, immediate pass/fail verification for this specific path.

Why this answer

The most direct way to verify that a repository configuration file is valid and located in the correct directory is to check its presence and syntax using 'cat /etc/yum.repos.d/custom.repo'. The repository configuration files must reside in /etc/yum.repos.d/ and have a .repo extension; if the file is missing or malformed, 'yum repolist' will not list the repository. This command simply reads the file, allowing the administrator to confirm its location and inspect its contents for errors.

Exam trap

The trap here is that candidates may assume a specialized yum subcommand exists for repository validation (like 'yum repoinfo' or 'yum check-repo'), when in fact the simplest and most reliable method is to directly inspect the configuration file with 'cat' or 'vim'.

How to eliminate wrong answers

Option A is wrong because 'yum repoinfo' is not a valid yum command; the correct command is 'yum repoinfo <repoid>' to display details about a repository that is already recognized, not to verify the configuration file's existence or validity. Option C is wrong because 'yum check-repo' is not a valid yum command; yum does not have a built-in 'check-repo' subcommand for validating repository configuration files. Option D is wrong because 'yum-config-manager --dump' is used to display the current yum configuration settings, not to verify the location or validity of a specific repository configuration file; it requires the repository to already be recognized.

21
MCQmedium

A database server experiences high disk I/O wait times. The administrator runs 'iostat -x 1' and sees that the avgqu-sz for /dev/sda is 25 and await is 200 ms. The disk is a single 7200 RPM SATA drive. Which action is most likely to improve performance?

A.Increase the read-ahead buffer using blockdev --setra
B.Change the I/O scheduler from CFQ to noop
C.Run 'fsck -f' on the filesystem to check for fragmentation
D.Replace the drive with an SSD or add additional drives in RAID 10
AnswerD

Replacing a mechanical drive with an SSD or deploying RAID 10 directly attacks the root cause of high disk i/o wait: excessive per-request latency and insufficient IOPS. SSDs eliminate rotational seek times and provide thousands of IOPS, while RAID 10 combines striping for parallel reads and writes with mirroring for redundancy, allowing multiple spindles to serve requests concurrently. This decreases both service time and queue depth, thereby reducing the await metric and iowait experienced by the database server.

Why this answer

The high avgqu-sz (25) and await (200 ms) indicate the single 7200 RPM SATA drive is saturated, as its maximum IOPS is typically around 75-100 random I/O operations per second. Replacing it with an SSD (which can handle thousands of IOPS) or adding drives in RAID 10 (which increases IOPS through parallelism) directly addresses the hardware bottleneck. No software tuning can overcome the physical limitations of a single spinning disk under heavy I/O load.

Exam trap

The trap here is that candidates assume software tuning (scheduler, read-ahead) can fix a hardware saturation issue, but Red Hat exams emphasize that when a single spinning disk is the bottleneck, only a hardware upgrade or RAID configuration will improve performance.

How to eliminate wrong answers

Option A is wrong because increasing the read-ahead buffer (--setra) only helps sequential I/O patterns, not the random I/O causing high wait times, and can actually waste memory and increase latency for random workloads. Option B is wrong because changing the I/O scheduler from CFQ to noop reduces CPU overhead but does not increase the disk's maximum IOPS; the disk is already saturated, so the scheduler choice has negligible impact on throughput. Option C is wrong because fsck checks filesystem metadata integrity, not fragmentation; even if the filesystem were fragmented, defragmentation would provide minimal benefit on a modern filesystem like ext4 and cannot resolve a hardware throughput bottleneck.

22
MCQmedium

A user named jdoe is receiving 'Permission denied' errors when trying to access a file owned by root with permissions 644. The user is a member of the root group. What is the most likely cause?

A.The directory containing the file lacks execute permission for the group or others.
B.The file's group owner is not root.
C.The file's read permission is not granted to the root group.
D.The user needs to be added to the root group again.
AnswerA

The directory containing the file lacks execute permission for the group or others. This is the most likely cause because to access a file inside a directory, the user needs execute (x) permission on the directory. Without it, even with correct file permissions, the user will get 'Permission denied'.

Why this answer

The file has permissions 644, meaning the owner (root) has read/write, and the group (root) and others have read-only access. Since jdoe is a member of the root group, the file's group read permission should allow access. However, to traverse a directory and access any file within it, the user needs execute (x) permission on that directory.

If the directory lacks execute for the group or others, jdoe will get 'Permission denied' even if the file permissions are correct.

Exam trap

The trap here is that candidates focus solely on file permissions (644) and overlook that directory execute permission is required for file access, leading them to incorrectly suspect group membership or file group ownership issues.

How to eliminate wrong answers

Option B is wrong because the file's group owner is root (as stated in the scenario), and the user jdoe is a member of the root group, so group ownership is correct. Option C is wrong because the file's permissions 644 grant read (4) to the group, so the root group does have read permission. Option D is wrong because the user is already a member of the root group; re-adding them would not resolve a directory permission issue.

23
MCQhard

A system administrator wants to run a container as a systemd service that restarts automatically after a system reboot. Which approach follows Red Hat best practices?

A.Create a cron job that checks if the container is running and starts it if not.
B.Create a sysvinit script that calls podman commands.
C.Add 'podman run ...' to /etc/rc.local.
D.Use 'podman generate systemd --new --name mycontainer' and enable the generated service.
AnswerD

podman generate systemd --new --name mycontainer generates a complete systemd service unit that records the exact podman command, container ID, and environment required to create and start the container fresh on every invocation of the service. Placing this unit in /etc/systemd/system and enabling it with systemctl enable --now makes systemd the supervisor: it sets up dependencies such as After=network-online.target, can apply Restart=on-failure, and will tear down the container cleanly on service stop. This is the intended way to manage a container's lifecycle as a systemd service.

Why this answer

`podman generate systemd --new --name mycontainer` creates a systemd unit file that defines the container as a transient service with `Restart=always` and `WantedBy=multi-user.target`, ensuring the container starts automatically after a reboot. This approach aligns with Red Hat best practices for managing containers as systemd services, leveraging systemd's native dependency and restart capabilities rather than relying on legacy or non-standard methods.

Exam trap

The trap here is that candidates may think any method that runs a command at boot (like cron or rc.local) is sufficient, but Red Hat specifically tests that systemd is the standard service manager in RHEL 8/9 and that `podman generate systemd` is the recommended way to create persistent container services with proper restart and dependency handling.

How to eliminate wrong answers

Option A is wrong because a cron job that polls for container status introduces unnecessary latency, race conditions, and complexity; it does not integrate with systemd's dependency-based startup ordering or provide reliable restart-on-failure behavior. Option B is wrong because sysvinit scripts are legacy in RHEL 8/9, which uses systemd as the default init system; using sysvinit bypasses systemd's native container management features and is not a supported Red Hat best practice. Option C is wrong because `/etc/rc.local` is executed after most services have started, offers no dependency management, and is considered a legacy workaround; it does not provide the restart policy or lifecycle control that systemd units offer.

24
MCQhard

A server has a requirement that all users in the 'finance' group must have a password aging policy that forces password change every 90 days. Which approach best achieves this for existing users?

A.Set PASS_MAX_DAYS 90 in /etc/login.defs
B.Edit /etc/shadow and change the fifth field for all users
C.Configure pam_pwquality.so to enforce password age
D.Write a script to run 'chage -M 90' for each user in the finance group
AnswerD

A script that calls chage -M 90 for each user in the finance group is the correct approach because chage directly updates the maximum password age field in /etc/shadow for existing user accounts. For example, you can iterate over `getent group finance | cut -d: -f4`, and run chage for each member, which precisely targets the intended accounts and leaves all other users untouched.

Why this answer

`chage -M 90` sets the maximum password age for a specific user, and by scripting it to apply to all members of the 'finance' group, you directly enforce the 90-day policy on existing users. This approach works regardless of the default settings in `/etc/login.defs`, which only affect new users, and avoids the manual and error-prone editing of `/etc/shadow`.

Exam trap

The trap here is that candidates often confuse `/etc/login.defs` as applying to all users (including existing ones), when in fact it only sets defaults for new user creation via `useradd`.

How to eliminate wrong answers

Option A is wrong because `/etc/login.defs` only sets default values for newly created users; it does not retroactively apply to existing users. Option B is wrong because manually editing the fifth field in `/etc/shadow` is fragile, error-prone, and not a supported or recommended administrative practice; the `chage` command is the proper tool for this task. Option C is wrong because `pam_pwquality.so` is a module for password quality/complexity checks (e.g., length, character classes), not for enforcing password aging policies like maximum days between changes.

25
MCQhard

A storage administrator is asked to increase the size of an ext4 filesystem mounted at /data. The underlying logical volume /dev/mapper/vg01-lv01 is currently 10GB and the volume group has 5GB of free extents. After extending the logical volume by 2GB using lvextend -L +2G /dev/mapper/vg01-lv01, what command must be run to resize the filesystem?

A.resize2fs /dev/mapper/vg01-lv01
B.lvextend -r -L +2G /dev/mapper/vg01-lv01
C.xfs_growfs /data
D.fsck -f /dev/mapper/vg01-lv01
AnswerA

resize2fs /dev/mapper/vg01-lv01 is correct because the logical volume was already extended with lvextend (without -r), leaving the ext4 filesystem still sized for the old smaller LV. Running resize2fs online grows the ext4 filesystem to consume the newly added space in the enlarged block device, and since the filesystem type is ext4, resize2fs is the matching tool. Unlike shrinking, growing an ext4 filesystem with resize2fs can be done while the filesystem is mounted, which makes it the immediate follow-up command in this LVM workflow.

Why this answer

After extending the logical volume with `lvextend`, the filesystem does not automatically recognize the new space. For ext4 filesystems, the `resize2fs` command must be run to resize the filesystem to use the additional logical volume capacity. This command can be executed online (while the filesystem is mounted) and will expand the filesystem to fill the available space in the logical volume.

Exam trap

The trap here is that candidates may confuse filesystem-specific resize commands (resize2fs for ext4 vs. xfs_growfs for XFS) or assume that `lvextend` automatically resizes the filesystem without the `-r` flag.

How to eliminate wrong answers

Option B is wrong because `lvextend -r` automatically resizes the filesystem during the LV extension, but the question states the administrator already ran `lvextend` without the `-r` flag, so a separate resize command is required. Option C is wrong because `xfs_growfs` is used for XFS filesystems, not ext4; using it on an ext4 filesystem would fail. Option D is wrong because `fsck -f` performs a filesystem consistency check and repair, not a resize operation; it does not change the filesystem size.

26
MCQeasy

Refer to the exhibit. Which command will ensure cron jobs run automatically at system boot?

A.systemctl reenable crond
B.systemctl start crond
C.systemctl enable crond
D.systemctl unmask crond
AnswerC

Enables the service to start at boot.

Why this answer

The `systemctl enable crond` command creates the necessary symlinks in the systemd unit configuration to ensure the `crond` service starts automatically at boot. This is the correct method to enable a service for automatic startup in a systemd-based Red Hat Enterprise Linux system.

Exam trap

The trap here is that candidates often confuse `systemctl start` (immediate start) with `systemctl enable` (boot-time start), or think that `systemctl unmask` alone is sufficient to make a service start at boot.

How to eliminate wrong answers

Option A is wrong because `systemctl reenable crond` is used to re-create the symlinks for the service, typically after modifying the unit file, but it does not ensure the service is enabled for boot if it was already disabled. Option B is wrong because `systemctl start crond` only starts the service immediately in the current session, without configuring it to start automatically at boot. Option D is wrong because `systemctl unmask crond` removes a mask that prevents the service from being started manually or automatically, but it does not enable the service for boot; the service must still be enabled separately.

27
MCQhard

Refer to the exhibit. What effect does the value INACTIVE=-1 have on newly created user accounts?

A.The account expires immediately.
B.Passwords never expire.
C.Account is disabled if password expires but user does not log in within -1 days (immediately).
D.The password inactivity period is disabled.
AnswerD

When INACTIVE is set to -1, the password inactivity period is disabled entirely. After a user's password expires, the account will not be automatically locked due to the user failing to log in within a set number of days. The user remains able to log in and is typically forced to change the expired password, provided other account expiration policies such as EXPIRE are not also set.

Why this answer

The `INACTIVE=-1` setting in the `useradd -D` or `/etc/default/useradd` configuration disables the password inactivity period. This means that after a password expires, the account will not be locked due to inactivity, effectively turning off the inactivity timer. The value -1 is a special sentinel that indicates no inactivity period is enforced.

Exam trap

Red Hat often tests the distinction between password expiration (`PASS_MAX_DAYS`) and the inactivity period (`INACTIVE`), trapping candidates who confuse the two or misinterpret -1 as 'immediate' rather than 'disabled'.

How to eliminate wrong answers

Option A is wrong because `INACTIVE=-1` does not cause immediate account expiration; account expiration is controlled by the `EXPIRE` field or `-e` option, not the inactivity setting. Option B is wrong because password expiration is controlled by `PASS_MAX_DAYS` (e.g., in `/etc/login.defs`), not by the inactivity period; `INACTIVE` only affects what happens after a password expires. Option C is wrong because a negative value (-1) disables the inactivity check entirely; it does not mean 'immediately' — the account is not disabled at all due to inactivity when set to -1.

28
Multi-Selecteasy

A systems administrator needs to list all currently defined firewall rules in firewalld, including rules for all zones. Which TWO commands can be used to accomplish this? (Choose exactly two.)

Select 1 answer
A.firewall-cmd --list-all-zones
B.iptables -L
C.systemctl status firewalld
D.firewall-cmd --get-default-zone
E.firewall-cmd --list-all
AnswersA

Correct. This command displays the full configuration for all zones, including rules for each zone.

Why this answer

`firewall-cmd --list-all-zones` displays the firewall rules for every zone in firewalld, including all default and custom zones, satisfying the requirement to list rules for all zones. Option E is incorrect because `firewall-cmd --list-all` only shows rules for the default zone, not all zones. The other options are incorrect: `iptables -L` shows raw kernel rules that may not reflect firewalld's configuration, `systemctl status firewalld` checks the service status, and `firewall-cmd --get-default-zone` shows only the default zone name, not rules.

Exam trap

Candidates might assume that `firewall-cmd --list-all` lists all zones, but it only lists the default zone. The key distinction is the `--list-all-zones` option specifically for all zones, versus `--list-all` for the default zone only.

29
MCQmedium

A filesystem is reported as 'read-only' after a system crash. The admin runs fsck and sees 'clean' status. What is the most likely reason it remains read-only?

A.fsck cannot fix errors on ext4 filesystems.
B.The filesystem is still mounted; fsck cannot fix it while mounted.
C.The filesystem is XFS, and fsck does not repair XFS.
D.fsck detected errors but did not fix them automatically.
AnswerC

This is correct. XFS is not repairable by fsck; fsck only inspects the XFS log to see whether the filesystem was cleanly unmounted and reports a 'clean' status based on that flag alone, without traversing metadata structures. To actually verify and repair an XFS filesystem you must use the dedicated xfs_repair utility, so a read-only XFS filesystem after a crash would still be reported as 'clean' by fsck while remaining unusable for writes.

Why this answer

If fsck reports 'clean', it means no errors were found in the filesystem's journal, so option D is incorrect. Option C is correct because XFS filesystems cannot be repaired by fsck; they require xfs_repair. Running fsck on an XFS filesystem simply reports the clean flag without performing a real check, leaving the kernel to enforce read-only status if any issues persist.

Exam trap

Candidates often assume that 'clean' means the filesystem is fully healthy and that fsck repairs all filesystem types. The trap is that fsck is for ext four, and XFS requires xfs_repair.

How to eliminate wrong answers

Option A is wrong because fsck can fix errors on ext4 filesystems; it is specifically designed to check and repair ext2/3/4 filesystems. Option B is wrong because the question states the admin runs fsck after a system crash, implying the filesystem is not mounted (or fsck would refuse to run with a warning); even if mounted read-only, fsck can still check it, but the issue here is that fsck did not apply repairs. Option C is wrong because the filesystem is reported as ext4 (fsck is run and shows 'clean'), not XFS; XFS uses xfs_repair, not fsck, and the question explicitly mentions fsck.

30
MCQeasy

An administrator wants to add an additional swap partition of 2GB on device /dev/sdb1. Which set of commands should be used to enable swap and make it persistent across reboots?

A.parted /dev/sdb set 1 swap on
B.swapadd /dev/sdb1
C.mkswap /dev/sdb1; swapon /dev/sdb1; echo '/dev/sdb1 swap swap defaults 0 0' >> /etc/fstab
D.mkfs.ext4 /dev/sdb1; mount /dev/sdb1 /swap
E.None of the above
AnswerC

This is the correct sequence: `mkswap` initializes the partition with a swap signature, `swapon` activates it immediately for use by the kernel, and appending the line to `/etc/fstab` ensures the swap partition is automatically enabled at boot. The fstab entry uses the correct fields: device, mount point specified as `swap`, filesystem type `swap`, and `defaults` as the mount options. This covers both immediate activation and persistence across reboots, satisfying the administrator's requirement.

Why this answer

It follows the proper sequence to prepare and activate a swap partition on /dev/sdb1. First, `mkswap` initializes the partition as a swap area by writing a swap signature. Then `swapon` activates it immediately.

Finally, adding an entry to /etc/fstab ensures the swap is automatically enabled at boot, making it persistent across reboots.

Exam trap

Red Hat often tests the distinction between filesystem creation (`mkfs.*`) and swap initialization (`mkswap`), and the trap here is that candidates may confuse `swapon` with a non-existent command like `swapadd` or think `parted` can enable swap directly.

How to eliminate wrong answers

Option A is wrong because `parted` does not have a 'swap on' subcommand; swap is enabled via `mkswap` and `swapon`, not through a parted flag. Option B is wrong because `swapadd` is not a valid Linux command; the correct command to activate swap is `swapon`. Option D is wrong because `mkfs.ext4` creates an ext4 filesystem, which is not suitable for swap; swap requires a raw partition formatted with `mkswap`, and mounting it is not how swap is used.

Option E is wrong because option C is correct.

31
MCQhard

Refer to the exhibit. An administrator needs to create a 1.2 TiB logical volume named 'data' in volume group 'myvg' and mount it persistently at /data. Which sequence of commands should be used?

A.lvcreate -L 1.2T -n data myvg mkfs.ext4 /dev/myvg/data echo '/dev/myvg/data /data ext4 defaults 0 0' >> /etc/fstab mount -a
B.lvcreate -l 100%FREE -n data myvg mkfs.xfs /dev/myvg/data echo '/dev/mapper/myvg-data /data xfs defaults 0 0' >> /etc/fstab mount -a
C.lvcreate -L 1.2T -n data myvg mkfs.xfs /dev/myvg/data echo '/dev/myvg/data /data xfs defaults 0 0' >> /etc/fstab mount -a
D.lvcreate -L 1200G -n data myvg mkfs.ext4 /dev/myvg/data echo '/dev/myvg/data /data ext4 defaults 0 0' >> /etc/fstab mount -a
AnswerC

This is correct because lvcreate -L 1.2T allocates exactly 1.2 TiB—in LVM, an uppercase T suffix represents Tebibytes (2^40 bytes), not SI terabytes. Formatting with mkfs.xfs creates a modern, scalable filesystem appropriate for large volumes, and the fstab entry uses /dev/myvg/data, a stable LVM2 device-mapper path. Running mount -a then validates the configuration by actually mounting the new filesystem.

Why this answer

It creates a logical volume of exactly 1.2 TiB using the valid -L 1.2T size specification. LVM's -L option accepts floating-point values with suffixes like T for TiB. The volume is formatted with XFS (default for RHEL 8+), a correct fstab entry is added with /dev/myvg/data, and mount -a mounts it persistently.

Option D uses 1200G, which yields approximately 1.17 TiB, not the required 1.2 TiB.

Exam trap

A common pitfall on the RHCSA exam is assuming that -L does not accept fractional TiB values. In fact, lvcreate supports floating-point sizes (e.g., 1.2T). Candidates may incorrectly use an approximation like 1200G instead of the exact 1.2T.

How to eliminate wrong answers

Option A is wrong because lvcreate -L 1.2T uses an invalid size suffix; LVM does not accept fractional TiB values (e.g., 1.2T), which would cause a syntax error or unexpected behavior. Option B is wrong because -l 100%FREE creates a volume using all free space in the volume group, not a specific 1.2 TiB size, and it uses xfs instead of ext4 (though xfs is acceptable, the size requirement is not met). Option C is wrong because lvcreate -L 1.2T uses the invalid size suffix 1.2T, and it formats with xfs instead of ext4, but the primary failure is the invalid size specification.

32
MCQeasy

An administrator needs to configure a service to start automatically at boot and also start it immediately without rebooting. Which single command accomplishes both tasks?

A.systemctl start httpd.service
B.systemctl enable httpd.service
C.systemctl enable --now httpd.service
D.systemctl reenable httpd.service
AnswerC

systemctl enable --now httpd.service combines boot-persistent enablement with immediate activation in a single atomic operation. The --now flag instructs systemd to both create the boot-enabling symlinks and start the unit right away, eliminating the risk of forgetting either step. This is the correct choice when the requirement explicitly states that the service must start automatically after reboot; it satisfies both the immediate runtime need and the persistent boot-time need simultaneously.

Why this answer

`systemctl enable --now httpd.service` combines the `enable` action (creating symlinks for automatic start at boot) with the `start` action (immediately launching the service) in a single command. This is the precise method in systemd to achieve both goals without rebooting.

Exam trap

The trap here is that candidates often confuse `enable` with `start`, thinking `enable` alone also starts the service, or they choose `start` alone, forgetting that boot persistence requires a separate `enable` step.

How to eliminate wrong answers

Option A is wrong because `systemctl start httpd.service` only starts the service immediately but does not configure it to start automatically at boot; it lacks the `enable` action. Option B is wrong because `systemctl enable httpd.service` only configures the service to start at boot but does not start it immediately; it requires a separate `start` command or a reboot. Option D is wrong because `systemctl reenable httpd.service` is used to recreate the enable symlinks (e.g., after a unit file change) but does not start the service; it neither starts it immediately nor guarantees a fresh enable for boot.

33
MCQmedium

Refer to the exhibit. Which entry is most likely to cause the system to fail to boot if the NFS server is unavailable?

A.The third entry (/home)
B.The fourth entry (/mnt)
C.The second entry (/boot)
D.The first entry (/)
AnswerB

NFS mount without _netdev option; network may not be ready, causing boot delay or failure.

Why this answer

The /mnt entry in /etc/fstab is configured with the default mount options, which include the _netdev option being absent. Without _netdev, the system will attempt to mount the NFS filesystem during the boot process before the network is fully operational. If the NFS server is unavailable, the mount will fail, and because the default mount behavior for non-root filesystems in /etc/fstab is to cause a boot failure if the mount fails (unless the 'nofail' option is specified), the system will drop into emergency mode and fail to complete the boot process.

Exam trap

Red Hat often tests the misconception that any NFS mount in /etc/fstab will cause a boot failure if the server is unavailable, but the trap here is that only mounts without the _netdev or nofail options will cause the system to fail to boot, and candidates may overlook the absence of these options in the default /mnt entry.

How to eliminate wrong answers

Option A is wrong because /home is a local filesystem (typically on a local disk or LVM), not a network filesystem, so its availability does not depend on the NFS server. Option C is wrong because /boot is a critical local filesystem that must be mounted early in the boot process; it is never an NFS mount in standard Red Hat Enterprise Linux configurations, and its failure would be due to local disk issues, not NFS server unavailability. Option D is wrong because the root filesystem (/) is mounted by the kernel or initramfs before /etc/fstab is processed, and its entry in /etc/fstab is typically ignored or used for remount options; a failure of the root entry in fstab does not cause a boot failure in the same way as a missing NFS server.

34
MCQhard

Refer to the exhibit. A user 'alice' is unable to write to /data directory. What is the most likely reason?

A.The directory permissions restrict access
B.The filesystem is nearly full
C.The directory is owned by root and alice is not root
D.The directory has ACLs preventing access
AnswerA

With mode 700 (drwx------), only the directory's owner has read, write, and execute permissions. Alice is neither root nor the owning UID, so for her the directory falls under 'others' with no permission bits set. Since creating or modifying a file requires write (and execute) permission on the directory itself, her write attempt is denied. This is exactly why the effective access is 'Permission denied'.

Why this answer

The exhibit (not shown here) likely displays directory permissions such as 'drwxr-xr-x' or 'drwx------' that do not grant write access to the user 'alice'. In Linux, the write permission (w) on a directory controls whether a user can create, delete, or rename files within it. Since 'alice' lacks write permission on /data, she cannot write to it, regardless of ownership or filesystem space.

Exam trap

The trap here is that candidates often assume ownership by root (Option C) is the sole reason for denial, overlooking that permissions (Option A) are the actual gatekeeper; Red Hat exams test whether you understand that 'root ownership' does not block a non-root user if the 'others' permission allows write.

How to eliminate wrong answers

Option B is wrong because a nearly full filesystem would produce a 'No space left on device' error, not a permission denied error; the question describes inability to write due to permissions, not capacity. Option C is wrong because directory ownership by root does not inherently prevent 'alice' from writing if the directory's permissions grant write access to others (e.g., 'drwxrwxrwx') or if 'alice' is in a group with write permission; the exhibit likely shows restrictive permissions, not just ownership. Option D is wrong because ACLs (Access Control Lists) could also restrict access, but the question asks for the 'most likely' reason, and standard Unix permissions are the default and more common cause; ACLs would require explicit 'setfacl' configuration, which is less typical in basic scenarios.

35
MCQhard

An administrator is tasked with deploying a containerized application on a Red Hat Enterprise Linux 8 server that is part of a high-security environment. The application must run as a non-root user inside the container. The container image is based on Red Hat Universal Base Image (UBI) and exposes port 443 for HTTPS. The administrator needs to ensure that the container can be restarted automatically if it crashes and that the application logs are persisted on the host in /var/log/app. The application requires a configuration file that is generated dynamically at startup and must be accessible to the container. The administrator has created a systemd service file for the container but wants to use Podman's built-in features to manage the container. Which approach meets all requirements?

A.Create a systemd service file using 'podman generate systemd' on a running container, then enable the service with 'systemctl enable --now container-myapp'. The container should be started with '--restart=always' and appropriate volume and port mappings.
B.Create a 'podman service' unit using 'podman service create' to manage the container with automatic restart and boot-start.
C.Run the container with 'podman run --restart=always -v /var/log/app:/var/log -p 443:443 myapp' and rely on the container's restart policy.
D.Use 'podman create --restart=on-failure -v /var/log/app:/var/log -p 443:443 myapp' and then start it with 'podman start'.
AnswerC

The '--restart=always' policy only works if the Podman process is running; it does not survive a system reboot without systemd.

Why this answer

Podman's built-in restart policy (`--restart=always`) ensures the container restarts automatically after a crash without requiring systemd. The volume mount persists logs at /var/log/app on the host, and the port mapping exposes port 443. This approach uses Podman's native features as desired, meeting all requirements.

Option A relies on a systemd service generated by Podman, which shifts management back to systemd instead of using Podman's built-in restart capability. Option B uses an invalid command. Option D uses `--restart=on-failure`, which only restarts on non-zero exit codes and may miss other crash scenarios.

Exam trap

Candidates may assume that Podman's `--restart` flag only works with systemd, but Podman supports restart policies natively for crash recovery. Systemd integration is required only for automatic restarts after host reboots, which is not stated as a requirement here.

How to eliminate wrong answers

Option B is wrong because 'podman service create' is not a valid Podman command; Podman does not have a 'service create' subcommand for managing containers—this is a Docker Swarm concept. Option C is wrong because '--restart=always' is not supported by Podman's 'podman run' command; Podman relies on external process managers like systemd for restart policies, and the container would not survive a host reboot or crash without systemd integration. Option D is wrong because 'podman create --restart=on-failure' is not a valid Podman option; Podman's '--restart' flag is only available with 'podman run' and is not recommended for production use without systemd, and 'podman start' does not enable automatic restart on crash or boot.

36
MCQmedium

After configuring sudo, a user reports: 'sudo: unable to open /etc/sudoers: Permission denied'. The admin checks the file permissions and sees '-rw-r-----' owned by root:root. What is the most likely cause?

A.The file is owned by the wrong user.
B.The sudo binary is missing the setuid bit.
C.The file permissions are too permissive (0640 instead of 0440).
D.SELinux is blocking access.
AnswerC

Sudo requires /etc/sudoers to be owned by root:root and have mode 0440 (read-only for owner and group). A mode of 0640 grants write permission to root, which sudo considers unsafe because it suggests the file was modified manually outside visudo's validation; sudo then refuses to open it for policy parsing and reports an error. Changing the mode back to 0440 with `chmod 0440 /etc/sudoers` resolves the issue. The message may explicitly say 'sudo: /etc/sudoers is mode 0640, should be 0440'.

Why this answer

The sudoers file requires strict permissions of 0440 (owner read, group read) to be considered secure by sudo. The current permissions of 0640 (owner read/write, group read) are too permissive, as they grant write access to the owner (root), which violates sudo's security model. When sudo detects that /etc/sudoers has permissions other than 0440, it refuses to open the file and reports 'Permission denied' to prevent potential tampering.

Exam trap

The trap here is that candidates assume 'Permission denied' always means the user lacks read access, but sudo specifically rejects files with write permissions for root to enforce its security policy, not because the user cannot read the file.

How to eliminate wrong answers

Option A is wrong because the file is owned by root:root, which is the correct ownership for /etc/sudoers; the issue is with permissions, not ownership. Option B is wrong because the sudo binary's setuid bit is unrelated to this error; the error message specifically references /etc/sudoers, not the sudo executable, and a missing setuid bit would cause a different error like 'sudo: must be setuid root'. Option D is wrong because SELinux would produce a different error message (e.g., 'Permission denied' with an AVC denial logged in audit.log) and the file permissions are the direct cause here; SELinux is not indicated by the given permission string.

37
MCQmedium

Refer to the exhibit. An administrator tries to mount the partition /dev/sdc1 and gets a superblock error. What is the most likely cause?

A.The filesystem is not recognized; need to install xfsprogs
B.The partition table is corrupted
C.The filesystem has not been created; mkfs.xfs was not run
D.The mount point /mnt/backup does not exist
AnswerC

Although blkid shows a UUID and type, the superblock error indicates the filesystem is not valid. This can happen if the partition was created but not formatted, yet blkid might show leftover metadata. Typically, you must run mkfs.xfs to create the filesystem.

Why this answer

The superblock error indicates that the kernel cannot read the filesystem metadata at the start of the partition. This most commonly occurs when no filesystem has been created on the partition — i.e., mkfs.xfs was never run on /dev/sdc1. Without a valid filesystem superblock, the mount command fails with a 'wrong fs type, bad option, bad superblock' message.

Exam trap

Red Hat often tests the distinction between a partition existing (created with fdisk/gdisk) and a filesystem existing on that partition (created with mkfs), leading candidates to confuse partition table corruption with a missing filesystem.

How to eliminate wrong answers

Option A is wrong because if the xfsprogs package were missing, the system would not have the xfs kernel module or mount helper, but the error would be 'mount: unknown filesystem type' rather than a superblock error. Option B is wrong because a corrupted partition table would prevent the kernel from recognizing the partition at all (e.g., 'no such device' or 'invalid partition table'), not produce a superblock error on a recognized block device. Option D is wrong because if /mnt/backup did not exist, the error would be 'mount point /mnt/backup does not exist', not a superblock error.

38
MCQmedium

An administrator receives an alert that a process named 'apache2' is consuming excessive CPU. The administrator needs to identify the PID of the process and then change its priority to the lowest possible value (least favorable scheduling). Which sequence of commands should be used?

A.pidof apache2; renice -n 20 -p <PID>
B.pidof apache2; renice -n 19 -p <PID>
C.ps -C apache2 -o pid=; renice -n -20 -p <PID>
D.ps aux | grep apache2; nice -n 19 <PID>
AnswerB

The pidof apache2 command directly outputs the PID(s) of the apache2 process, which can be passed to renice using -p. The renice -n 19 -p <PID> command sets the niceness of the existing process to 19, the lowest possible priority (often called 'most nice'). This is the correct way to reduce a running process's CPU priority on Linux; note that lowering priority (raising nice value) can be done by the process owner without root.

Why this answer

`pidof apache2` retrieves the PID of the apache2 process, and `renice -n 19 -p <PID>` sets the priority to the lowest possible (least favorable) scheduling value. In Linux, `renice` accepts nice values from -20 (highest priority) to 19 (lowest priority), so 19 is the correct value for the least favorable scheduling.

Exam trap

Red Hat often tests the exact range of nice values (0-19 for non-root users, -20 to 19 for root) and the distinction between `nice` (for starting processes) and `renice` (for changing priority of running processes), leading candidates to confuse the two or use out-of-range values.

How to eliminate wrong answers

Option A is wrong because it uses `renice -n 20`, but the valid nice range is -20 to 19; a value of 20 is out of range and will be rejected or clamped. Option C is wrong because it uses `renice -n -20`, which sets the highest priority (most favorable scheduling), not the lowest. Option D is wrong because `nice` is used to start a new process with a given priority, not to change the priority of an existing process; also, the syntax `nice -n 19 <PID>` is incorrect as `nice` expects a command, not a PID.

39
MCQhard

A system administrator is configuring a new RHEL 9 server with two 500GB SSDs. The requirement: create a 200GB XFS filesystem for /srv/data that is resilient to disk failure. The admin decides to create a RAID 1 (mirror) using mdadm with partitions on each disk: /dev/sda1 and /dev/sdb1, each 200GB. He creates the partitions with fdisk, then runs: mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1. The array is created and synced. He then creates a physical volume, volume group, and logical volume on top of /dev/md0, formats with XFS, and mounts. Later, a disk fails. After replacing the failed disk, he recreates the partition with identical size and runs: mdadm /dev/md0 --add /dev/sdb1. The command fails with 'Device /dev/sdb1 is busy'. What is the most likely cause?

A.The replacement disk was not initialized with an mdadm superblock before adding.
B.The kernel still sees the old partition table; need to run partprobe to reread the partition table.
C.The /dev/md0 array is still in a clean state and does not need the disk yet.
D.The /dev/sdb1 partition is already part of another md array.
AnswerB

After you create a new partition table entry on /dev/sdb, the kernel keeps using the old partition layout cached in memory. Running partprobe (or partx -a) forces a re-read of the partition table so that /dev/sdb1 actually appears. Without this step, mdadm will report that the partition does not exist, even though it is visible in fdisk output.

Why this answer

After replacing a failed disk and recreating the partition, the kernel's in-memory partition table still reflects the old state. The `mdadm --add` command fails with 'Device busy' because the kernel sees the old partition layout and may still hold references to the old partition. Running `partprobe` (or `partx -a`) forces the kernel to reread the partition table from the disk, clearing the stale state and allowing the new partition to be added to the RAID array.

Exam trap

The trap here is that candidates often assume the 'Device busy' error means the disk is already in use by another array or process, when in fact it is a stale partition table cache that prevents the kernel from recognizing the new partition.

How to eliminate wrong answers

Option A is wrong because mdadm does not require a separate superblock initialization on the replacement partition; the `--add` command will write the superblock automatically when the partition is added to the array. Option C is wrong because even if the array is in a clean state (e.g., degraded but functional), it still accepts a new disk to restore redundancy; the 'Device busy' error is unrelated to array state. Option D is wrong because there is no indication that /dev/sdb1 is part of another array; the error is due to the kernel's stale partition table, not membership in another md device.

40
Multi-Selecteasy

Which TWO of the following are valid ways to make a shell script executable?

Select 2 answers
A.bash script.sh
B.chmod 755 script.sh
C.. script.sh
D.chmod u+x script.sh
E.chmod +x script.sh
AnswersB, D

chmod 755 sets permissions to rwxr-xr-x, making the script executable for everyone, which is a valid way to make it executable.

Why this answer

Options B and D are both valid ways to make a shell script executable. Option B uses numeric mode to set execute permission for the owner, while option D uses symbolic mode to add execute for the owner only. Option E is also valid but is not one of the two answers required by the question.

Exam trap

Candidates often think that 'chmod +x' is the only symbolic way, but 'chmod u+x' is also correct. The question requires two answers, and both B and D are valid.

41
MCQhard

A server has a software RAID 5 array /dev/md0. One of its disks fails. The administrator wants to replace it without rebooting. Which command should be used to mark the disk as failed?

A.mdadm --fault /dev/md0 /dev/sdb
B.echo faulty > /sys/block/md0/md/dev-sdb/state
C.mdadm --set-faulty /dev/md0 /dev/sdb
D.mdadm --fail /dev/md0 /dev/sdb
AnswerD

This is the correct command: mdadm --manage --fail /dev/md0 /dev/sdb (the --manage action is implicit when using --fail) marks /dev/sdb as faulty in the RAID 5 array /dev/md0. Once marked, mdadm removes the device from the active array, and the array continues operating in a degraded state because RAID 5 tolerates a single disk failure. You can then remove the failed disk (mdadm --remove) and replace it (mdadm --add) to rebuild redundancy, which is the proper workflow for handling a failing disk.

Why this answer

The correct command to mark a disk as failed in a software RAID array without rebooting is `mdadm --fail /dev/md0 /dev/sdb`. This command tells the md driver to mark the specified disk as faulty, which triggers the RAID 5 array to degrade and allows the failed disk to be removed and replaced while the system remains online.

Exam trap

The trap here is that candidates confuse the valid `--fail` option with the non-existent `--fault` or `--set-faulty` options, or they incorrectly think the sysfs method is the standard command-line approach expected in the EX200 exam.

How to eliminate wrong answers

Option A is wrong because `mdadm --fault` is not a valid mdadm option; the correct option is `--fail` or `--set-faulty`. Option B is wrong because while writing 'faulty' to the sysfs attribute `/sys/block/md0/md/dev-sdb/state` can mark a disk as faulty, the correct string to write is 'faulty' (not 'faulty' with a typo, but the path uses 'dev-sdb' which is correct; however, the syntax shown is a valid alternative, but the question asks for the command, and this is a sysfs manipulation, not the standard mdadm command expected in the EX200 exam). Option C is wrong because `mdadm --set-faulty` is not a valid mdadm option; the correct option is `--fail`.

42
MCQhard

Refer to the exhibit. An administrator sees that a user from 192.168.1.101 cannot connect to the SSH server. Based on the log, what is the most probable cause?

A.The client's host key type is not supported by the server
B.The server's firewall is blocking the connection
C.The SSH service is not running
D.The client's IP is blacklisted
AnswerA

The SSH handshake fails during algorithm negotiation because the server's list of acceptable host key algorithms (as sent in its SSH_MSG_KEXINIT) does not include the type the client offers, such as ssh-rsa or ssh-ed25519. This produces a 'no matching host key type' error before any authentication, which is exactly the negotiation failure recorded in the log. The server does not reject the client's credentials or IP; it cannot even complete the transport layer handshake.

Why this answer

The log shows 'no matching host key type found. Their offer: ssh-rsa'. This indicates the client offered an ssh-rsa host key, but the server's configuration (likely via the `HostKeyAlgorithms` directive in `/etc/ssh/sshd_config`) does not include ssh-rsa.

In modern OpenSSH (e.g., RHEL 8/9), ssh-rsa is often disabled by default due to its reliance on SHA-1, which is considered weak. The server requires a different host key type (e.g., rsa-sha2-256, rsa-sha2-512, or ecdsa-sha2-nistp256), causing the connection to fail before authentication even begins.

Exam trap

The RHCSA exam often tests the distinction between authentication failures (e.g., wrong password or key) and key exchange failures (e.g., unsupported host key algorithm), leading candidates to mistakenly blame firewall rules or service status when the log clearly points to a cryptographic algorithm mismatch.

How to eliminate wrong answers

Option B is wrong because a firewall block would typically result in a timeout or 'Connection refused' error, not a host key algorithm mismatch log entry. Option C is wrong because if the SSH service were not running, the client would receive a 'Connection refused' message, not a host key negotiation failure. Option D is wrong because an IP blacklist (e.g., via `DenyUsers` or `Match Address` in sshd_config) would reject the connection after authentication or with a 'Permission denied' message, not during the key exchange phase.

43
MCQmedium

A system administrator needs to create a shell script that checks if the user 'jdoe' exists in the system and, if not, creates the user with a home directory. The script should also verify that the creation was successful. Which of the following script snippets correctly implements this logic?

A.if grep -q '^jdoe:' /etc/passwd; then echo 'Exists'; else useradd 'jdoe' && echo 'Created'; fi
B.if id 'jdoe' &>/dev/null; then echo 'Exists'; else useradd -m 'jdoe' && echo 'Created' || echo 'Failed'; fi
C.if ! id 'jdoe' &>/dev/null; then useradd -m 'jdoe'; else echo 'Exists'; fi
D.[ -z $(id 'jdoe' 2>/dev/null) ] && useradd -m 'jdoe' && echo 'Created'
AnswerB

Correctly checks existence, creates with home dir, and verifies.

Why this answer

It uses `id` to check for the user's existence (redirecting output to /dev/null to suppress messages), then uses `useradd -m` to create the user with a home directory. The `&&` and `||` operators ensure that success or failure of the creation is explicitly reported, fulfilling the requirement to verify successful creation.

Exam trap

Red Hat often tests the misconception that grepping /etc/passwd is sufficient for user existence checks, but the trap here is that modern systems may use remote authentication sources, so `id` is the correct command to query all NSS sources.

How to eliminate wrong answers

Option A is wrong because it greps /etc/passwd for '^jdoe:', which can produce false negatives if the user exists in LDAP or other NSS sources, and it does not create a home directory (missing -m). Option C is wrong because it does not verify that the creation was successful; it only runs useradd without checking its exit status. Option D is wrong because the `[ -z ... ]` test is unreliable (the command substitution may produce unexpected output or errors), and it does not handle the case where the user already exists (it would attempt to create the user again, which would fail).

44
MCQmedium

A system administrator runs 'mount -a' and receives an error: 'mount: /mnt/nfs: mount point does not exist'. The /etc/fstab entry is: server:/export /mnt/nfs nfs defaults 0 0. What is the most likely cause?

A.The directory /mnt/nfs does not exist
B.The 'defaults' option does not include '_netdev'
C.The filesystem type should be 'nfs4'
D.The NFS server is unreachable
AnswerA

Correct: The mount point must exist before mounting.

Why this answer

The error message 'mount: /mnt/nfs: mount point does not exist' explicitly indicates that the directory /mnt/nfs is missing. The 'mount -a' command processes all entries in /etc/fstab, and for each filesystem, it requires the mount point directory to exist before the mount can succeed. Since the directory is absent, the mount fails immediately, regardless of the NFS server status or filesystem type.

Exam trap

Red Hat often tests the distinction between mount point existence errors and network connectivity errors, trapping candidates who assume the issue is with NFS configuration or server reachability when the error message clearly points to a missing local directory.

How to eliminate wrong answers

Option B is wrong because the '_netdev' option is used to indicate that the filesystem requires network access, which is relevant for systemd ordering but does not affect the mount point existence check; the error is about a missing directory, not network dependency. Option C is wrong because 'nfs' is a valid filesystem type that auto-negotiates the NFS version (including NFSv4) with the server; specifying 'nfs4' is not required and would not resolve a missing mount point. Option D is wrong because an unreachable NFS server would produce a different error, such as 'mount.nfs: Connection timed out' or 'No route to host', not a 'mount point does not exist' error.

45
MCQeasy

A system administrator has created a new group named 'ops'. The administrator wants to add the existing user 'alice' to this group as a supplementary group without affecting her current group memberships. Which command should be used?

A.usermod -aG ops alice
B.usermod -G ops alice
C.groupadd ops alice
D.usermod -g ops alice
AnswerA

usermod -aG ops alice explicitly appends alice to the supplementary group ops while preserving any existing supplementary group memberships. The -a (append) flag works in conjunction with -G (supplementary groups) to add the specified group to the user's current group set rather than replacing it. This is the correct, non-destructive way to grant a user access to an additional secondary group.

Why this answer

The `-a` (append) flag combined with `-G` (supplementary groups) in `usermod` adds the user 'alice' to the 'ops' group without removing her from any existing supplementary groups. Without `-a`, the `-G` flag alone would replace the user's current supplementary group list with only the specified groups, which would remove her from any other groups she already belongs to.

Exam trap

The trap here is that candidates often forget the `-a` flag and choose `usermod -G ops alice`, mistakenly thinking it adds the user to the group, when in fact it replaces all supplementary group memberships.

How to eliminate wrong answers

Option B is wrong because `usermod -G ops alice` without the `-a` flag sets the user's supplementary groups to exactly 'ops', overwriting and removing all other supplementary group memberships. Option C is wrong because `groupadd` creates a new group, not a user; the syntax `groupadd ops alice` is invalid and would fail or be misinterpreted. Option D is wrong because `usermod -g ops alice` changes the user's primary group (the group listed in /etc/passwd) to 'ops', not a supplementary group, and would alter the default group ownership for files created by alice.

46
MCQmedium

A technician runs 'mkfs.xfs /dev/sdb1' and later mounts it. The file system is reported as having a block size of 1024 bytes. What is the most likely reason?

A.The administrator used the -b size=1024 option.
B.The block size setting was ignored due to a kernel limitation.
C.The default block size for XFS is 1024 bytes.
D.The partition size is less than 1GB, so mkfs.xfs automatically used a 1024-byte block size.
AnswerD

When the partition on /dev/sdb1 is smaller than 1 GiB, mkfs.xfs automatically uses 1024-byte blocks instead of the usual 4096-byte blocks. This tuning improves space efficiency on small volumes by reducing the overhead associated with larger blocks, such as internal fragmentation and per-block metadata structures. The administrator did not need to specify any option; this is the default behavior for sub-1 GiB XFS filesystems.

Why this answer

Mkfs.xfs automatically selects a 1024-byte block size when the underlying partition is smaller than 1 GB. This is a built-in heuristic in the XFS filesystem to optimize metadata overhead and space utilization on small volumes. The technician did not specify a block size, so the tool applied this default behavior based on partition size.

Exam trap

Red Hat often tests the misconception that XFS always uses a 4096-byte block size, leading candidates to overlook the automatic block size reduction on small partitions.

How to eliminate wrong answers

Option A is wrong because the technician did not use the -b size=1024 option; the question states the command was run without any block size argument. Option B is wrong because there is no kernel limitation that ignores or overrides the block size setting; the kernel fully supports the specified block size. Option C is wrong because the default block size for XFS is 4096 bytes, not 1024 bytes; the 1024-byte block size is only used automatically for partitions smaller than 1 GB.

47
MCQeasy

A system administrator needs to create a file system on a new 10GB partition /dev/sdb1 for use with a database that requires high reliability and supports snapshots. Which file system type should be chosen?

A.xfs
B.ext4
C.vfat
D.btrfs
AnswerA

XFS is the correct choice because it is the default filesystem on RHEL 9, and Red Hat fully supports it for production workloads. While XFS itself does not have native snapshot capabilities, it works seamlessly with LVM, which provides snapshot functionality for consistent backups and recovery. Its allocation groups, scalable inode handling, and high concurrency support make it ideal for large database files, exactly what the administrator needs.

Why this answer

XFS is the correct choice because it is a high-performance, 64-bit journaling file system that supports snapshots via LVM or external tools, and is designed for large files and partitions. For a database requiring high reliability and snapshot capabilities, XFS provides robust data integrity features and is the default file system in Red Hat Enterprise Linux 8 and later, making it the recommended option for this scenario.

Exam trap

The trap here is that candidates may choose btrfs because it natively supports snapshots, but the EX200 exam expects XFS as the default RHEL file system for high-reliability production use, and btrfs is not covered as a standard option in the exam objectives.

How to eliminate wrong answers

Option B (ext4) is wrong because while ext4 is a reliable journaling file system, it does not natively support snapshots; snapshots require LVM or other external mechanisms, and ext4 is less optimized for very large partitions and high-concurrency database workloads compared to XFS. Option C (vfat) is wrong because vfat is a simple, non-journaling file system designed for compatibility with legacy systems and removable media; it lacks journaling, reliability features, and snapshot support, making it unsuitable for a database. Option D (btrfs) is wrong because although btrfs supports snapshots and checksumming, it is not the default file system in RHEL and is considered less mature for production database use; the EX200 exam focuses on XFS as the standard choice for high-reliability scenarios.

48
MCQmedium

The administrator wants to mount a new filesystem on /dev/sdb1 with the label 'backup' and mount it at /mnt/backup. Which commands achieve this?

A.parted /dev/sdb mkpart primary xfs 0% 100% && mkfs.xfs -L backup /dev/sdb1
B.mkfs.xfs /dev/sdb1 && xfs_admin -L backup /dev/sdb1 && mount -L backup /mnt/backup
C.mkfs.xfs -L backup /dev/sdb1 && mount /dev/sdb1 /mnt/backup
D.mkfs.ext4 -L backup /dev/sdb1 && echo '/dev/sdb1 /mnt/backup ext4 defaults 0 0' >> /etc/fstab
AnswerB, C

This sequence correctly creates an XFS filesystem on the existing /dev/sdb1, assigns it the label 'backup' using xfs_admin -L, and mounts it by label with 'mount -L backup /mnt/backup'. Mounting by label resolves through /dev/disk/by-label, avoiding dependence on unstable device names, and works without needing an /etc/fstab entry for immediate use. It assumes the partition already exists and that /mnt/backup is a valid mount point, both of which are prerequisites.

Why this answer

Both options B and C correctly create an XFS filesystem with the label 'backup' on /dev/sdb1 and mount it to /mnt/backup. Option B uses mkfs.xfs, then sets the label with xfs_admin, then mounts by label (mount -L works without fstab). Option C creates the filesystem with the label in one step and mounts by device path.

Options A and D are incorrect: A includes an unnecessary parted command and uses ext4? Actually A creates an XFS partition but then mounts? Wait A: parted ... mkpart primary xfs ... && mkfs.xfs -L backup /dev/sdb1. It doesn't mount, so incomplete. D uses ext4, not XFS.

Thus B and C are both valid.

Exam trap

The trap is that candidates may think mounting by label requires an /etc/fstab entry (as initially stated in the explanation for B), but mount -L works without fstab. Also, they might overlook that both B and C are valid sequences.

How to eliminate wrong answers

Option A is wrong because parted does not create a filesystem; it only creates a partition, and the mkpart command syntax is incomplete (missing filesystem type and partition type). Option B is wrong because xfs_admin -L backup cannot change the label of an XFS filesystem that is already mounted or without the filesystem being unmounted first, and mount -L backup uses the label but the label hasn't been set correctly before mounting. Option D is wrong because it creates an ext4 filesystem instead of XFS, and while it adds an fstab entry, it does not actually mount the filesystem immediately, failing the requirement to mount it at /mnt/backup.

49
MCQhard

An administrator wants to add the two 2G disks (sdc and sdd) as physical volumes, extend the 'data' logical volume in volume group 'vg' by 2G, and grow the filesystem. Which sequence of commands should be used?

A.pvcreate /dev/sdc /dev/sdd; vgextend vg /dev/sdc /dev/sdd; lvresize -L 2G /dev/vg/lv_data; xfs_growfs /data
B.pvcreate /dev/sdc /dev/sdd; vgextend vg /dev/sdc /dev/sdd; lvextend -L +2G /dev/vg/lv_data; resize2fs /dev/vg/lv_data
C.pvcreate /dev/sdc /dev/sdd; vgextend vg /dev/sdc; vgextend vg /dev/sdd; lvextend -L +2G /dev/vg/lv_data; xfs_growfs /dev/vg/lv_data
D.pvcreate /dev/sdc /dev/sdd; vgextend vg /dev/sdc /dev/sdd; lvextend -L +2G /dev/vg/lv_data; xfs_growfs /data
AnswerD

This command chain is fully correct. pvcreate initializes both /dev/sdc and /dev/sdd as physical volumes, then vgextend adds both to volume group vg in a single command. lvextend -L +2G grows lv_data by exactly 2 GiB (the plus sign means 'add' rather than 'set to'), and xfs_growfs /data expands the XFS filesystem that is mounted at /data to consume the additional space. This is the proper order: create PVs, extend the VG, extend the LV, and finally grow the filesystem online without needing to unmount.

Why this answer

It follows the correct sequence: create physical volumes on both disks, extend the volume group with both disks in a single command, extend the logical volume by exactly 2G using the `+` sign, and then grow the XFS filesystem using `xfs_growfs` with the mount point `/data`. The `+` in `lvextend -L +2G` is critical to add 2G rather than resize to 2G total, and `xfs_growfs` requires the mount point (or a block device) for XFS filesystems.

Exam trap

The trap here is that candidates often confuse the `-L` option with and without the `+` sign, and mistakenly use `resize2fs` for XFS filesystems, or use `lvresize` instead of `lvextend` without the correct syntax for adding space.

How to eliminate wrong answers

Option A is wrong because `lvresize -L 2G` (without the `+`) would resize the logical volume to exactly 2G, not add 2G, and it uses `lvresize` instead of `lvextend` (though functionally similar, the intent is extension). Option B is wrong because it uses `resize2fs` which is for ext2/3/4 filesystems, not XFS; the filesystem on `/data` is XFS, so `xfs_growfs` must be used. Option C is wrong because it splits the `vgextend` into two separate commands (which is redundant but not incorrect), but more critically it uses `xfs_growfs /dev/vg/lv_data` with the block device path instead of the mount point; while `xfs_growfs` can accept a block device, the mount point is the standard and safer approach, and the question explicitly states 'grow the filesystem' which implies using the mount point.

50
MCQhard

You maintain a script that performs a long-running task and must clean up temporary files if the script is interrupted. The script uses: #!/bin/bash tempfile=$(mktemp) trap "rm -f $tempfile" EXIT # long task sleep 100 You notice that if the script receives SIGINT (Ctrl+C), the temporary file is not removed. Investigation shows that the trap on EXIT is not executed on SIGINT. Which modification should be made?

A.Move the trap inside a subshell: (trap ... EXIT; long task).
B.Change `trap ... EXIT` to `trap ... 0`.
C.Add `set -e` at the beginning of the script.
D.Add a trap for INT: `trap "rm -f $tempfile; exit" INT`.
AnswerD

This is the only option that explicitly handles the signal that is actually interrupting the script. The trap directive installs a handler for SIGINT, so when Ctrl-C is sent, the shell runs "rm -f $tempfile; exit" instead of simply dying. Because the trap is installed at the top level before the long task begins, it remains in effect throughout the task, and the explicit exit prevents the shell from continuing after the cleanup runs. This guarantees the temporary file is removed even on user interruption.

Why this answer

The EXIT trap is only triggered on normal script termination (e.g., reaching the end or an explicit `exit`), not on signals like SIGINT. By adding a separate trap for INT that explicitly removes the temp file and calls `exit`, the cleanup runs even when the user presses Ctrl+C, ensuring the temporary file is deleted.

Exam trap

Red Hat often tests the misconception that the EXIT trap handles all termination scenarios, including signals, when in fact it only runs on normal exit paths, not on unhandled signals like SIGINT.

How to eliminate wrong answers

Option A is wrong because moving the trap inside a subshell would cause the trap to apply only to the subshell, not the main script, and the subshell would exit immediately after the long task, defeating the purpose of the trap. Option B is wrong because `trap ... 0` is exactly equivalent to `trap ... EXIT` in bash; both trigger only on normal exit, not on signals, so this change would not fix the issue.

Option C is wrong because `set -e` causes the script to exit on any command failure, but it does not affect signal handling or trap execution; it would not ensure cleanup on SIGINT.

51
MCQmedium

A cron job fails to run. Which command should the administrator use to verify the cron daemon is active?

A.systemctl status cron
B.systemctl status crond
C.systemctl list-units --type=service
D.service crond status
AnswerB

'systemctl status crond' is the correct systemd command to inspect the cron daemon's runtime state. It displays whether crond.service is active (running), its load status, main process ID (PID), and recent log entries from the journal, which helps quickly identify why jobs are not executing. This is the standard, direct diagnostic action on RHEL 7 and later.

Why this answer

On RHEL-based systems (including Red Hat Enterprise Linux, CentOS, and Fedora), the cron daemon is named `crond`, not `cron`. The `systemctl status crond` command checks whether the `crond` service is active, enabled, and running. This is the correct method for verifying the cron daemon's status on systems using systemd.

Exam trap

A common pitfall is assuming the cron daemon is named 'cron' (as on Debian/Ubuntu) and selecting option A. However, on RHEL-based systems, the service is named 'crond', making option B correct. Always verify the exact service name for the exam's target distribution.

How to eliminate wrong answers

Option A is wrong because `systemctl status cron` references a service named 'cron', but on RHEL-based systems the cron daemon is named 'crond', not 'cron' (Debian/Ubuntu uses 'cron'). Option C is wrong because `systemctl list-units --type=service` lists all loaded service units, but it does not specifically check the status of the cron daemon; it would require additional filtering and does not directly answer whether crond is active. Option D is wrong because `service crond status` is a legacy SysVinit command that may work on older systems, but on modern RHEL 7+ systems using systemd, the recommended and consistent command is `systemctl status crond`; the `service` command is a compatibility wrapper and may not reflect the true systemd state in all cases.

52
MCQmedium

A server's firewall is managed by firewalld. The admin adds a rule to allow HTTPS traffic to the public zone, but clients still cannot connect. What is the most likely cause?

A.The rule was added with --permanent but firewall-cmd --reload was not run.
B.The rule must be added as a rich rule, not a simple service.
C.The default zone is not set to public.
D.firewalld is just a wrapper for iptables, so iptables rules must be cleared.
AnswerA

Permanent rules do not affect runtime until reload.

Why this answer

When a rule is added with the `--permanent` flag in firewalld, it is written to the configuration files but not applied to the runtime firewall. Until `firewall-cmd --reload` is executed, the runtime configuration remains unchanged, so the new rule allowing HTTPS traffic is not active. Clients cannot connect because the firewall is still blocking HTTPS based on the old runtime rules.

Exam trap

The trap here is that candidates often assume adding a rule with `--permanent` immediately takes effect, forgetting that firewalld requires a reload or the `--runtime-to-permanent` approach to synchronize changes.

How to eliminate wrong answers

Option B is wrong because HTTPS traffic can be added as a simple service using `firewall-cmd --add-service=https`; rich rules are not required for standard services like HTTPS. Option C is wrong because the rule was explicitly added to the public zone, so the default zone setting is irrelevant; the rule applies to the public zone regardless of whether it is the default. Option D is wrong because firewalld manages its own runtime and permanent configurations independently of iptables; clearing iptables rules would disrupt firewalld's state and is not necessary or recommended.

53
MCQhard

A systems administrator installs a custom hardware device driver kernel module named 'mydevice' on a RHEL 9 system. The module is built and placed in /lib/modules/$(uname -r)/extra/. The administrator loads it manually with modprobe mydevice and it works. However, after a system reboot, the module is not loaded. The administrator checks that the device is present at boot time. Which step should be taken to ensure the module loads automatically at boot?

A.Add the line 'install mydevice /sbin/modprobe --ignore-install mydevice' to /etc/modprobe.d/load.conf
B.Rebuild the initramfs with 'dracut --force --add mydevice'
C.Add the line 'load mydevice' to /etc/rc.local and ensure rc.local is executable.
D.Run 'echo mydevice > /etc/modules-load.d/mydevice.conf'
AnswerD

Writing the module name to a file under /etc/modules-load.d/ is the canonical systemd way to force a kernel module to be loaded at boot. systemd-modules-load.service reads every .conf file in that directory during early boot and passes each line as a module name to modprobe, so 'mydevice' will be loaded reliably. The echo redirection creates the necessary file with the correct content, and because the service runs before most hardware-dependent services, the driver will be present when the device is probed.

Why this answer

Writing the module name to a file in /etc/modules-load.d/ ensures systemd loads the module automatically at boot. The modules-load.d mechanism is the standard RHEL 9 method for specifying kernel modules to be loaded early in the boot process, before the root filesystem is fully available.

Exam trap

The trap here is that candidates confuse the initramfs rebuild (dracut) with the simpler modules-load.d mechanism, thinking all kernel modules must be baked into the initramfs to load at boot, when in fact only modules needed before root is mounted require that treatment.

How to eliminate wrong answers

Option A is wrong because the 'install' directive in modprobe.d is used to override the default installation command for a module, not to specify automatic loading at boot; it would only affect manual modprobe invocations. Option B is wrong because rebuilding the initramfs with dracut --add mydevice is unnecessary for a module already installed in /lib/modules/.../extra/; initramfs is for modules needed during early boot (e.g., storage drivers), and adding a device driver that is not required for mounting root is wasteful and not the standard method. Option C is wrong because /etc/rc.local is a legacy mechanism that runs after the system is fully booted, not during early kernel module loading; it is also not enabled by default on RHEL 9 and would load the module too late for device initialization.

54
MCQhard

A Red Hat Enterprise Linux 9 system enforces a security policy that user accounts must be disabled after 90 days of inactivity. The system administrator has configured /etc/shadow accordingly with the proper fields. User 'bob' has been on leave for 95 days. When bob returns and tries to log in, he is unable to do so. The administrator checks the shadow file and sees that bob's password expiration date has passed and the account is locked due to inactivity (the inactivity period has exceeded). The administrator wants to immediately reactivate bob's account without changing the password, and also wants to set the account to expire in 30 days from now (relative to the current date). Which set of commands should the administrator run to achieve this goal?

A.chage -E $(date -d +30days +%Y-%m-%d) bob; chage -I -1 bob
B.usermod -e 2024-12-31 bob; passwd -S bob
C.chage -d 0 bob; usermod -L bob
D.usermod -e $(date -d +30days +%Y-%m-%d) bob; passwd -u bob
AnswerA

This combination is correct because chage -E $(date -d +30days +%Y-%m-%d) bob dynamically sets the account expiration date to exactly 30 days from today, while chage -I -1 bob sets the inactivity period to -1, which disables the automatic locking of an account whose password has expired. This directly clears the lockout caused by exceeding the inactivity threshold, so Bob's account can be used again for the next 30 days. It addresses both the expired expiration date and the inactivity-based lock.

Why this answer

`chage -E $(date -d +30days +%Y-%m-%d) bob` sets the account expiration date to 30 days from now, and `chage -I -1 bob` disables the inactivity period (sets it to -1, meaning no inactivity lockout), which immediately reactivates the account without changing the password. This directly addresses the requirement to unlock the account (which was locked due to exceeding the inactivity period) and set a new expiration date.

Exam trap

The trap here is that candidates confuse password lock (`passwd -l`/`passwd -u`) with inactivity lock (`chage -I`), and assume `passwd -u` can reactivate an account disabled by inactivity, when in fact only `chage -I` or modifying the INACTIVE field in `/etc/shadow` can do that.

How to eliminate wrong answers

Option B is wrong because `usermod -e 2024-12-31 bob` sets a static expiration date (not relative to current date) and `passwd -S bob` only shows the password status, it does not unlock the account or disable the inactivity lock. Option C is wrong because `chage -d 0 bob` forces a password change on next login (which violates 'without changing the password'), and `usermod -L bob` locks the account, which is the opposite of reactivating it. Option D is wrong because `usermod -e $(date -d +30days +%Y-%m-%d) bob` correctly sets the expiration date, but `passwd -u bob` only unlocks a password-locked account (via `passwd -l`), not an account locked due to inactivity in /etc/shadow (the INACTIVE field); it does not reset the inactivity counter or disable the inactivity period.

55
MCQmedium

A system administrator needs to restore the default SELinux security context on all files under /var/www/html after a misconfiguration. Which command should be used?

A.setfiles -R /var/www/html
B.restorecon -R /var/www/html
C.fixfiles -R /var/www/html
D.chcon -R -t httpd_sys_content_t /var/www/html
AnswerB

restorecon is the correct command because it reads the active policy's `file_contexts` rules and resets each file's SELinux context to the default for its path. With `-R`, it descends recursively through `/var/www/html`, fixing any files whose contexts were altered by copying, misconfiguration, or manual `chcon`. It is the standard tool for restoring contexts on a specific path.

Why this answer

The `restorecon -R /var/www/html` command restores the default SELinux security contexts on all files under /var/www/html by reading the file contexts defined in the SELinux policy (typically from /etc/selinux/targeted/contexts/files/file_contexts). The `-R` flag ensures recursive operation, making it the correct tool to fix misconfigured contexts without manually specifying a type.

Exam trap

The trap here is that candidates confuse `restorecon` with `chcon` or `setfiles`, thinking that manually setting the type with `chcon` is equivalent to restoring the default context, but `chcon` does not consult the policy and can set an incorrect type if the path's default context differs from the specified type.

How to eliminate wrong answers

Option A is wrong because `setfiles` is used to verify or set file contexts based on a file context specification file, but it requires a specification file argument (e.g., `setfiles -c /etc/selinux/targeted/policy/policy.31 file_contexts /var/www/html`) and is not the standard command for restoring contexts on a live system; it is more commonly used for initial labeling or relabeling after policy changes. Option C is wrong because `fixfiles` is a higher-level script that can restore contexts, but its `-R` option is not valid; `fixfiles` uses `-F` to force restoration or `-R` to remove files from the restore list, and the correct syntax for recursive restore is `fixfiles restore /var/www/html` or `fixfiles -R /var/www/html` is not a standard usage. Option D is wrong because `chcon -R -t httpd_sys_content_t /var/www/html` manually sets the type to `httpd_sys_content_t`, which may not match the default context defined in the policy (e.g., `httpd_sys_content_t` is correct for static content, but the default context could be `httpd_sys_rw_content_t` for writable directories or other types depending on the path); this approach bypasses the policy and can lead to further misconfiguration.

56
MCQhard

You are managing a Red Hat Enterprise Linux 8 server that hosts backup scripts. A user named 'backup' (UID 1005) is a member of the 'backup' group. The directory /var/backups is owned by root:backup with permissions 775. The 'backup' user needs to create files in this directory. However, when the user attempts to create a file, they receive 'Permission denied'. You verify that 'backup' is indeed listed in the backup group in /etc/group. The user's current shell was started after their last login. Which of the following is the most likely cause and solution?

A.The directory lacks the setgid bit; set it with 'chmod g+s /var/backups'.
B.The user needs to log out and log back in to refresh their group membership.
C.The user's umask is too restrictive, preventing file creation. Change the umask to 002.
D.The user should use 'newgrp backup' to switch to the backup group temporarily.
AnswerB

Linux determines a user's supplemental groups at login time from the /etc/group database and stores them in the process credentials via initgroups(). When a user is added to a new group after their current login, existing shells and daemons keep the old group set; simply editing /etc/group does not update running sessions. The user must end the session and log in again so that login(1) or systemd user session reinitializes the supplementary groups, allowing access to files and directories that require that group.

Why this answer

The user 'backup' is already a member of the 'backup' group in /etc/group, but the current shell session was started before the group membership was added or refreshed. On Linux, group membership is determined at login time by the PAM modules; simply adding a user to a group does not affect already running processes. The user must log out and log back in (or start a new login shell) to acquire the new group membership via the initgroups() system call, which populates the process's supplementary group list.

Exam trap

The trap here is that candidates often think the setgid bit or umask is the issue, but the real problem is that group membership changes do not apply to existing login sessions—a fundamental Linux behavior that Red Hat EX200 frequently tests.

How to eliminate wrong answers

Option A is wrong because the setgid bit (chmod g+s) would cause new files to inherit the group of the directory, but the user already has group write permission via the 775 permissions; the issue is that the user's process does not have the 'backup' group in its supplementary groups, not that the directory lacks setgid. Option C is wrong because umask only affects the default permissions of newly created files, not the ability to create files at all; even with a restrictive umask (e.g., 077), the user could still create files if they had write permission, but they would be created with no group/other permissions. Option D is wrong because 'newgrp backup' would work to switch the user's effective group to 'backup' temporarily, but it is not the most likely cause or the best solution; the question asks for the most likely cause and solution, and the standard fix is to log out and log back in to refresh group membership for all future sessions.

57
MCQmedium

An administrator needs to schedule a script to run every Monday, Wednesday, and Friday at 2:30 PM. Which cron expression should be used?

A.30 14 * * 1,3,5
B.30 14 * * 1-5
C.14 30 * * 1,3,5
D.30 14 * * 0,2,4
AnswerA

The cron expression has the correct field order: minute (30), hour (14), day of month (*), month (*), and day of week (1,3,5). Numeric day-of-week values start at 0 for Sunday, so 1 is Monday, 3 is Wednesday, and 5 is Friday. Because the day-of-month and month fields are wildcards, the job would run solely on those weekdays at 2:30 PM.

Why this answer

Cron uses five fields (minute, hour, day-of-month, month, day-of-week). 2:30 PM is 14:30 in 24-hour format, so minute=30 and hour=14. The day-of-week field uses 0-7 (0 and 7 = Sunday), with Monday=1, Wednesday=3, Friday=5. The asterisks for day-of-month and month mean 'every day' and 'every month', so the expression `30 14 * * 1,3,5` runs the script at 2:30 PM on Monday, Wednesday, and Friday.

Exam trap

Red Hat often tests the 24-hour time format and the correct ordering of minute and hour fields, causing candidates to swap them (as in Option C) or to confuse the day-of-week numbering (Sunday=0 vs Monday=1) as seen in Option D.

How to eliminate wrong answers

Option B is wrong because `1-5` in the day-of-week field specifies Monday through Friday (days 1,2,3,4,5), which includes Tuesday and Thursday, not just Monday, Wednesday, and Friday. Option C is wrong because the fields are reversed: `14 30` would mean minute=14 and hour=30, which is invalid (hour 30 does not exist) and would never run at 2:30 PM. Option D is wrong because `0,2,4` in the day-of-week field corresponds to Sunday (0), Tuesday (2), and Thursday (4), which is the wrong set of days.

58
MCQhard

A system administrator wants to find all files in /var that are larger than 100MB and have been modified within the last 7 days. The output should be a list of file paths with sizes in human-readable format, sorted by size descending. Which command pipeline accomplishes this?

A.find /var -type f -size +100M -mtime -7 -ls | sort -k7 -n
B.find /var -type f -size +100M -mtime -7 -exec ls -lh {} \; | sort -k5 -h
C.find /var -type f -size +100M -mtime -7 -exec du -h {} + | sort -rh
D.find /var -type f -size +100M -mtime -7 -printf '%s %p\n' | sort -n -r | head -20
AnswerC

du -h gives human-readable sizes, sort -rh sorts by size descending correctly.

Why this answer

It uses `find` with `-size +100M` and `-mtime -7` to match files larger than 100MB modified within 7 days, then `-exec du -h {} +` aggregates sizes in human-readable format, and `sort -rh` sorts by the first field (size) in reverse human-numeric order, producing the required descending list.

Exam trap

Red Hat often tests the distinction between `-exec ls -lh` and `-exec du -h` for human-readable sizes, and the requirement for `sort -rh` (reverse human-numeric) versus `sort -n` (plain numeric) to correctly sort sizes with suffixes like 'M' or 'G'.

How to eliminate wrong answers

Option A is wrong because `-ls` outputs a detailed listing with size in the 7th column, but `sort -k7 -n` sorts numerically on that column, which does not handle human-readable suffixes (e.g., 'M', 'G') and would sort incorrectly. Option B is wrong because `-exec ls -lh {} \;` runs `ls` per file, but `sort -k5 -h` sorts by the 5th column (size), which works for human-readable sizes; however, `ls -lh` output includes multiple columns and the size column may vary in position (e.g., with symlinks or ACLs), and the pipeline lacks `-r` for descending order, so it would sort ascending, not descending. Option D is wrong because `-printf '%s %p\n'` prints size in bytes (not human-readable) and `sort -n -r` sorts numerically descending, but the output is not in human-readable format as required, and `head -20` limits output to 20 lines, which is not requested.

59
MCQhard

Refer to the exhibit. After mounting /dev/sdb1 with the noexec option, a script located at /mnt/data/test.file cannot be executed. What change will allow execution while maintaining security?

A.Copy the script to /tmp and run from there
B.Use chmod +x /mnt/data/test.file
C.Change the mount option to exec in /etc/fstab and remount
D.Remount without noexec and add setuid bit
AnswerC

Alter the /etc/fstab entry for /dev/sdb1 to include exec (or remove noexec), then run mount -o remount /mnt/data to re-read the options without a full unmount. This tells the kernel that the filesystem is allowed to serve as a source of executable programs. Using fstab ensures the change survives a reboot, and the remount applies it immediately to the mounted filesystem.

Why this answer

The noexec mount option prevents execution of any binaries or scripts on the filesystem, regardless of file permissions. To allow execution while maintaining security, you must change the mount option to exec in /etc/fstab and remount the filesystem (e.g., mount -o remount,exec /mnt/data). This approach preserves other mount options and avoids the security risks of removing noexec globally.

Exam trap

In RHEL, the noexec mount option overrides any execute permissions set on files, regardless of chmod. The common mistake is trying to fix permissions instead of modifying the mount options via /etc/fstab and remounting with exec.

How to eliminate wrong answers

Option A is wrong because copying the script to /tmp does not change the mount options on /mnt/data; /tmp may also be mounted with noexec, and even if it is not, this workaround bypasses the intended security policy without addressing the underlying filesystem configuration. Option B is wrong because chmod +x sets the executable permission bit on the file, but the noexec mount option overrides file permissions entirely—execution is blocked at the kernel level regardless of the file's mode. Option D is wrong because remounting without noexec and adding the setuid bit introduces a significant security risk (setuid allows the script to run with the privileges of its owner, often root), and the question asks to maintain security while allowing execution, not to escalate privileges.

60
Multi-Selecthard

An administrator wants to change the default systemd target to multi-user.target. Which three steps are part of a correct procedure? (Choose three.)

Select 3 answers
A.systemctl enable multi-user.target
B.systemctl start multi-user.target
C.systemctl isolate multi-user.target
D.ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
E.systemctl set-default multi-user.target
AnswersC, D, E

systemctl isolate multi-user.target is correct because it atomically switches the currently running target by stopping all units not required by multi-user.target and starting the required ones, effectively performing a runtime runlevel switch. This is the proper way to change the active target immediately, and while it does not modify the default for future boots, it is the necessary command to apply a target change without a reboot.

Why this answer

`systemctl isolate multi-user.target` immediately switches the current systemd target to multi-user.target, which is the correct way to change the active target at runtime without a reboot. This command stops all units not required by the new target and starts those that are, effectively changing the system's operational state.

Exam trap

The trap here is that candidates confuse `systemctl enable` (which controls whether a unit starts at boot) with `systemctl set-default` (which sets the default target for boot), and they may think `systemctl start` is sufficient to change the active target, not realizing that `isolate` is required to properly transition systemd to a different target.

61
MCQeasy

A developer wants to create a script that accepts a directory path as an argument and creates a timestamped backup of that directory. If no argument is provided, it should back up the current directory. How should the script handle the argument?

A.dir=${1:-.}
B.dir=${@:-.}
C.dir=${0:-.}
D.dir=${?:-.}
AnswerA

The parameter expansion `${1:-.}` explicitly targets the first positional parameter (`$1`) and applies the `:-` operator: if `$1` is unset or null, the expansion substitutes the literal `.` (the current directory). This precisely fulfills the requirement to accept a directory argument with a sensible default when no argument is supplied, because `$1` is the first argument passed to the script, and the default value is only used when that argument is missing or empty.

Why this answer

`${1:-.}` uses the default value substitution syntax in bash: if parameter `$1` (the first positional argument) is unset or null, it expands to `.` (the current directory). This ensures the script backs up the supplied directory path or defaults to the current directory when no argument is provided, exactly matching the requirement.

Exam trap

Red Hat often tests the distinction between positional parameters (`$1`, `$2`, etc.) and special variables (`$@`, `$0`, `$?`), and the trap here is that candidates confuse `$1` with `$0` (the script name) or incorrectly assume `$@` works as a single default value, leading to option B or C.

How to eliminate wrong answers

Option B is wrong because `${@:-.}` expands to all positional arguments (`$@`) or `.` if none are provided, but `$@` is a list, not a single directory path, and using it in a backup command would break the script. Option C is wrong because `${0:-.}` refers to the script's own name (the zeroth argument), not the first argument passed by the user, so it would always expand to the script name instead of the intended directory. Option D is wrong because `${?:-.}` is not valid bash syntax; `$?` holds the exit status of the last command, and the `:-` substitution does not apply meaningfully here, causing a syntax error or unintended behavior.

62
MCQeasy

An administrator wants to mount an existing ext4 filesystem from /dev/sdb1 to /mnt/data at boot time. What entry should be added to /etc/fstab?

A./dev/sdb1 /mnt/data xfs defaults 0 0
B.LABEL=data ext4 defaults 0 0
C./dev/sdb1 /data ext4 defaults 0 0
D./dev/sdb1 /mnt/data ext4 defaults 0 0
AnswerD

This is a valid and correct fstab entry for mounting the ext4 filesystem on /dev/sdb1 to the /mnt/data mount point. It properly specifies all six required fields: the device file, the exact mount directory, the ext4 filesystem type matching the on-disk format, the defaults option set (rw, suid, dev, exec, auto, nouser, async), and 0 for both dump and fsck pass. When the system boots or mount -a is executed, this line will mount the filesystem at /mnt/data as requested.

Why this answer

It specifies the correct device (/dev/sdb1), the correct mount point (/mnt/data), the correct filesystem type (ext4), and the correct mount options (defaults) for an ext4 filesystem to be mounted at boot. The /etc/fstab entry must include all six fields in order: device, mount point, filesystem type, options, dump, and pass.

Exam trap

The trap here is that candidates may confuse the filesystem type (ext4 vs xfs) or misremember the required mount point path (/mnt/data vs /data), leading them to select an option that looks correct but has a subtle mismatch.

How to eliminate wrong answers

Option A is wrong because it specifies xfs as the filesystem type, but the question explicitly states the filesystem is ext4. Option B is wrong because it omits the mount point and the device identifier (it uses LABEL=data but does not include a mount point or the required six-field structure). Option C is wrong because it specifies /data as the mount point, but the question requires the mount point to be /mnt/data.

63
MCQhard

A system administrator needs to ensure that a user named 'bob' can access a shared directory '/data' owned by group 'developers'. The directory has permissions 2775 and is owned by root:developers. Bob is a member of the 'developers' group. However, when Bob tries to create a file in '/data', it fails with 'Permission denied'. What is the most likely cause?

A.The directory has incorrect SELinux context
B.Bob's umask is set to 0077
C.The setgid bit is not set
D.Bob's primary group is not developers
AnswerA

Even when the directory's mode and ownership (2775, root:developers) grant Bob write access, SELinux performs a separate mandatory access control check. If /data carries a context type that Bob's domain is not allowed to write to (for example, default_t instead of a type like public_content_rw_t or a domain-specific type), the kernel denies the operation with EACCES. This appears as a permission problem though standard permissions are correct. To fix, restore or apply the correct context, e.g., restorecon -Rv /data or a custom semanage fcontext rule.

Why this answer

The directory '/data' has permissions 2775, which grants read, write, and execute to the group 'developers'. Bob is a member of 'developers', so standard Unix permissions should allow him to create files. However, the failure with 'Permission denied' despite correct group membership and permissions strongly indicates that SELinux is enforcing a policy that denies Bob write access.

The most likely cause is that the directory lacks the correct SELinux context (e.g., `default_t` instead of a type like `public_content_rw_t` or a context that allows write operations).

Exam trap

Red Hat often tests the misconception that group membership alone guarantees access, ignoring that SELinux can block operations even when Unix permissions are correct; the trap here is that candidates focus on umask or primary group instead of recognizing SELinux as the likely cause when permissions and group membership appear correct.

How to eliminate wrong answers

Option B is wrong because umask affects the default permissions of newly created files, not the ability to create them; a umask of 0077 would not cause a 'Permission denied' error when creating a file if the directory permissions allow write access. Option C is wrong because the setgid bit (2775) is already set (the '2' in the permissions), so it is not missing; the setgid bit ensures new files inherit the group, but its absence would not cause a 'Permission denied' error. Option D is wrong because Bob's primary group does not need to be 'developers'; as a member of the 'developers' group, he has group-level access to the directory regardless of his primary group.

64
MCQhard

A system administrator notices that a server is responding slowly. The administrator runs `top` and sees a process named `backup_script` consuming 95% CPU. The process runs as root and is supposed to run nightly backups. However, the system load average is low. The administrator wants to investigate without killing the process. Which of the following is the best course of action?

A.Use `renice -n 19 -p <PID>` to lower the priority of the process.
B.Use `nice -n 19 ./backup_script` to start the process with lower priority next time.
C.Use `chrt -i 0 <PID>` to set the scheduling policy to idle.
D.Use `kill -STOP <PID>` to pause the process and then resume later.
AnswerA

renice changes the nice value of an already-running process; specifying -n 19 with -p <PID> sets it to the lowest dynamic priority while leaving the process in a Running (or sleepable) state. This reduces its CPU scheduler share so interactive workloads are less affected, and the backup continues making progress rather than being suspended or restarted.

Why this answer

`renice -n 19 -p <PID>` lowers the CPU scheduling priority of the running `backup_script` process to the lowest possible value (19), which reduces its CPU consumption without killing it. This allows the administrator to investigate the cause of the high CPU usage while minimizing the impact on other processes and system responsiveness.

Exam trap

Red Hat often tests the distinction between `nice` (for starting a new process) and `renice` (for adjusting an existing process), and candidates may confuse the two or think `nice` can be applied to a running process.

How to eliminate wrong answers

Option B is wrong because `nice` sets the priority of a new process, not an already running one; the administrator needs to adjust the priority of the currently running `backup_script`, not start a new instance. Option C is wrong because `chrt -i 0 <PID>` sets the scheduling policy to SCHED_IDLE, which is an idle scheduling class that only runs when no other process needs the CPU, but this is a more drastic change than needed and may not be appropriate for a backup script that should eventually complete; also, the `-i` option is for SCHED_IDLE, but the correct syntax for setting idle policy is `chrt -i 0 <PID>` (though `chrt` typically uses `-i` for idle, but the policy value 0 is for SCHED_OTHER, not idle — the trap is that `chrt -i` expects a priority argument, and 0 is not valid for idle). Option D is wrong because `kill -STOP` pauses the process, which would halt the backup entirely, preventing it from completing its work and potentially leaving data in an inconsistent state; the administrator wants to investigate without killing or stopping the process.

65
MCQmedium

An administrator wants to ensure that any new user accounts created on the system have a default primary group matching the username. What change is needed?

A.Set GROUP to same name in /etc/default/useradd
B.Set USERGROUPS_ENAB to no; then create user with -g
C.Set USERGROUPS_ENAB to yes in /etc/login.defs
D.Set CREATE_HOME to yes in /etc/login.defs
AnswerC

When USERGROUPS_ENAB is set to yes, useradd automatically creates a private group whose name and GID match the new username and sets that group as the user's primary group. This is the default behavior on RHEL and derivatives, providing a one-to-one mapping between user and group. As long as this setting remains enabled, every new user account will have its own private primary group.

Why this answer

Setting USERGROUPS_ENAB to yes in /etc/login.defs instructs the useradd command to automatically create a private group with the same name as the new user and assign it as the user's primary group. This is the default behavior in Red Hat Enterprise Linux and ensures that each new user has a matching primary group without manual intervention.

Exam trap

The trap here is that candidates often confuse the GROUP setting in /etc/default/useradd (which sets a fixed default group) with the USERGROUPS_ENAB mechanism that dynamically creates a matching group, leading them to incorrectly select Option A.

How to eliminate wrong answers

Option A is wrong because the GROUP setting in /etc/default/useradd specifies the default primary group for new users (e.g., GROUP=100 for users group), not a group matching the username. Option B is wrong because setting USERGROUPS_ENAB to no disables the automatic creation of a private group, and using -g manually would require the group to already exist, not create it automatically. Option D is wrong because CREATE_HOME controls whether a home directory is created for new users, not the primary group assignment.

66
MCQhard

A container exits immediately with status 1. The administrator runs 'podman logs container' but sees no output. What is the most likely reason for the missing logs?

A.The container binary is missing or has the wrong architecture (exec format error).
B.The container's logging driver is not configured to capture stdout.
C.The log file is rotated and cleared.
D.The container is using a non-standard log location inside the container.
AnswerA

When a container exits immediately with status 1 and no output, the kernel often returns ENOEXEC ('exec format error') because the configured entrypoint or command is not a valid executable for the host architecture. This occurs when the image was built for a different CPU architecture (e.g., ARM on x86_64) or when a script's shebang points to a missing interpreter. The container's main process never actually runs, so no stdout/stderr is generated, making logs appear empty. Therefore, the correct action is to verify the image architecture and the executable's format using 'file' and 'podman inspect'.

Why this answer

When a container exits immediately with status 1 and `podman logs` shows no output, the most common cause is that the container binary is missing or has the wrong architecture (e.g., an x86 binary on an ARM system). This results in an 'exec format error' that prevents the container's entrypoint from executing, so no stdout/stderr is ever written to the logging driver. The container exits before any process runs, leaving the log buffer empty.

Exam trap

Red Hat often tests the misconception that missing logs are always due to a logging configuration issue, but the trap here is that an immediate exit with status 1 and no output points to a failure before any process runs, such as an exec format error.

How to eliminate wrong answers

Option B is wrong because Podman's default logging driver (journald) captures stdout/stderr from the container's PID 1; if the container never starts a process, there is nothing to capture, so the driver is not the issue. Option C is wrong because log rotation or clearing would not cause an immediate exit with status 1 and zero logs; rotated logs would still show prior output if any existed. Option D is wrong because `podman logs` only reads from the container's configured log driver (stdout/stderr), not from files inside the container; a non-standard log location inside the container is irrelevant to the `podman logs` command.

67
MCQmedium

A script needs to execute a command that might fail, but the script should continue. The administrator wants to capture the exit status for logging. Which code snippet correctly implements this?

A.set -e; ./risky_command; rc=$?; echo $rc
B.rc=$? ./risky_command; echo $rc
C../risky_command; rc=$?; echo $rc
D../risky_command && rc=$?; echo $rc
AnswerC

The semicolon is a command terminator that allows rc=$? to execute regardless of how risky_command exited. After risky_command finishes, $? holds its exact exit status, and the assignment immediately stores it before any other command or expansion can alter it. The subsequent echo $rc then prints the saved value, making this the correct pattern for capturing a failure status without terminating the script.

Why this answer

It runs the risky command, captures its exit status immediately after in the `$?` variable, and then echoes it for logging. The script continues regardless of the command's success or failure, which meets the requirement. The `$?` variable holds the exit status of the last executed foreground command, so assigning it to `rc` right after `./risky_command` ensures the correct value is stored.

Exam trap

In Red Hat Enterprise Linux shell scripting, a common mistake is to use `set -e` or conditional operators like `&&` when the goal is to capture the exit status regardless of success or failure. The correct approach is to assign `$?` unconditionally immediately after the command.

How to eliminate wrong answers

Option A is wrong because `set -e` causes the shell to exit immediately if any command fails, which contradicts the requirement that the script should continue after a failure. Option B is wrong because `rc=$? ./risky_command` sets `rc` in the environment of `./risky_command` (not the current shell) and `$?` is evaluated before the command runs, so `rc` gets the exit status of the previous command, not `./risky_command`. Option D is wrong because `&&` makes the assignment `rc=$?` conditional on `./risky_command` succeeding; if the command fails, `rc` is never assigned, and the exit status is lost.

68
MCQmedium

Refer to the exhibit. An administrator wants to mount /dev/sdc1 on /mnt/storage. What must be done first?

A.Mount /dev/sdc directly
B.Add an entry to /etc/fstab
C.Create a partition on /dev/sdc
D.Run mkfs.xfs /dev/sdc1
AnswerC

The exhibit shows /dev/sdc as a whole disk with no recognized partitions (e.g., no /dev/sdc1). Before you can format and mount storage, you must create a partition table and a partition on the disk using a tool such as parted or fdisk. This step creates the necessary block device /dev/sdc1, which can then be formatted with mkfs.xfs and mounted. Without a partition, neither the device name referenced in the question nor a filesystem exists.

Why this answer

The exhibit shows that /dev/sdc has no partition table (it is a raw disk). Before you can mount a filesystem on /dev/sdc1, you must first create a partition on /dev/sdc using a tool like fdisk or parted. Without a partition, the block device /dev/sdc1 does not exist, so any mount attempt would fail with a 'no such device' error.

Exam trap

A common pitfall in the Red Hat RHCSA exam is thinking you can directly mount a raw disk or create a filesystem on a non-existent partition, leading candidates to select mkfs.xfs or /etc/fstab before partitioning.

How to eliminate wrong answers

Option A is wrong because mounting /dev/sdc directly would attempt to mount the whole disk without a partition table, which is not a standard practice and would fail unless the disk contains a filesystem written directly to it (which is not the case here). Option B is wrong because adding an entry to /etc/fstab is only useful after the partition and filesystem exist; it does not create the partition or the block device. Option D is wrong because running mkfs.xfs /dev/sdc1 requires that /dev/sdc1 already exists as a valid block device; you cannot create a filesystem on a non-existent partition.

69
MCQhard

A system fails to boot because of a corrupted fstab file. The administrator boots into rescue mode from a RHEL installation ISO. Which command should be run first to mount the root filesystem read-write?

A.mount /dev/mapper/rhel-root /mnt/sysimage
B.mount -o rw,remount /sysroot
C.chroot /mnt/sysimage
D.systemctl rescue
AnswerA

When you enter RHEL rescue mode, the installer mounts the installed system's root logical volume at the /mnt/sysimage directory. This command explicitly mounts the LVM logical volume /dev/mapper/rhel-root to that expected mount point, making the filesystem contents visible so you can later chroot and repair /etc/fstab. Without this mount, the repair tools cannot access the system's configuration files.

Why this answer

In rescue mode, the root filesystem is not mounted by default. The first step is to mount the logical volume containing the root filesystem (e.g., /dev/mapper/rhel-root) to a temporary mount point like /mnt/sysimage so that you can access and repair the corrupted /etc/fstab file. Option A correctly uses the mount command with the device and mount point, which is the standard procedure for RHEL rescue environments.

Exam trap

The trap here is that candidates confuse the rescue mode mount point (/mnt/sysimage) with the emergency mode mount point (/sysroot) or attempt to use chroot before mounting, leading them to select options B or C.

How to eliminate wrong answers

Option B is wrong because /sysroot is not a standard mount point in rescue mode; the correct temporary mount point is /mnt/sysimage, and the -o rw,remount option is used to remount an already mounted filesystem, not to mount one from scratch. Option C is wrong because chroot /mnt/sysimage changes the root directory into the mounted filesystem, but it cannot be run before the filesystem is actually mounted; it is a subsequent step after mounting. Option D is wrong because systemctl rescue switches the system to rescue mode (a systemd target), but the system is already booted into rescue mode from the ISO, and this command does not mount the root filesystem.

70
MCQeasy

A system administrator needs to create a shell script that processes a list of hostnames stored in a file, one per line, and runs a command on each host. Which loop construct is most appropriate?

A.while read host; do ... done < hosts
B.for i in $(seq 1 $(wc -l < hosts)); do ... done
C.for host in $(cat hosts); do ... done
D.until read host; do ... done < hosts
AnswerA

The `while read host; do ... done < hosts` construct is the correct approach because it reads the file line by line. On each iteration, `read` assigns the entire line (minus trailing newline) to the variable `host`, so the content is not subjected to word splitting or pathname expansion. This makes it robust for hostnames that might contain unusual characters, though for exact preservation one should add `IFS=` and `-r` to `read`. Additionally, the redirection `< hosts` attaches the file to the loop's standard input, and the loop runs in the current shell, so any variable updates inside the loop remain available afterward.

Why this answer

The `while read host; do ... done < hosts` construct reads the file line by line, preserving each hostname exactly as it appears, including spaces or special characters. This is the safest and most idiomatic way to process a list of hostnames in a shell script, as it avoids word splitting and glob expansion issues that can occur with other methods.

Exam trap

The trap here is that candidates often choose `for host in $(cat hosts)` because it looks simpler, but they overlook how word splitting and glob expansion can break the script when hostnames contain spaces, tabs, or wildcard characters.

How to eliminate wrong answers

Option B is wrong because it uses a for loop with `seq` and `wc -l`, which is unnecessarily complex and fragile; it requires counting lines first and then indexing into the file, which is error-prone and not a standard pattern for reading lines. Option C is wrong because `for host in $(cat hosts)` subjects the file content to word splitting and glob expansion, so hostnames with spaces or wildcard characters would be incorrectly split or expanded. Option D is wrong because `until read host` is syntactically invalid; `until` tests a condition at the top of the loop, but `read` returns a non-zero exit status at end-of-file, making the loop never execute its body (or execute it incorrectly), and the redirection `< hosts` is misplaced.

71
MCQhard

A server has an LVM volume group vg01 with a physical volume /dev/sdb. The administrator wants to move all physical extents from /dev/sdb to /dev/sdd which is also in the same volume group. Which command sequence is correct?

A.pvmove /dev/sdb; vgreduce vg01 /dev/sdb
B.vgreduce vg01 /dev/sdb; pvmove
C.pvmove /dev/sdb; pvremove /dev/sdb
D.pvmove /dev/sdb /dev/sdd
AnswerA

The correct sequence starts with `pvmove /dev/sdb`, which relocates every allocated physical extent on that disk to any available free extent elsewhere in the same volume group (vg01). Once the source PV is completely empty, `vgreduce vg01 /dev/sdb` safely removes it from the volume group's metadata, allowing the disk to be repurposed or detached without risking data loss or LVM corruption.

Why this answer

The correct sequence is to first use `pvmove /dev/sdb` to relocate all physical extents from /dev/sdb to other physical volumes in the same volume group (vg01), and then use `vgreduce vg01 /dev/sdb` to remove the now-empty physical volume from the volume group. This ensures no data loss and that the volume group metadata is properly updated.

Exam trap

The trap here is that candidates often think `pvmove` requires a target PV or that `pvremove` can be used directly after moving extents, but they forget that the PV must first be removed from the VG with `vgreduce` before it can be fully decommissioned.

How to eliminate wrong answers

Option B is wrong because `vgreduce` before `pvmove` would attempt to remove /dev/sdb from the volume group while it still contains data, causing an error or data loss. Option C is wrong because after `pvmove`, the physical volume /dev/sdb is empty but still part of the volume group; `pvremove` would fail because the PV is still in a VG, and it does not remove the PV from the VG metadata. Option D is wrong because `pvmove /dev/sdb /dev/sdd` attempts to move extents directly to a specific target PV, but if /dev/sdd does not have enough free extents, the command will fail; the correct approach is to use `pvmove` without a target to let LVM distribute extents across all available PVs in the VG.

72
Multi-Selectmedium

Which TWO commands can be used to add a user to a secondary group without removing existing supplementary group memberships? (Choose exactly 2)

Select 2 answers
A.usermod -aG group user
B.usermod -AG group user
C.adduser user group
D.gpasswd -a user group
E.groupadd -a user group
AnswersA, D

The `-a` flag in `usermod -aG group user` is the critical component: it stands for 'append', meaning the specified user is added to the supplementary group listed after `-G` without removing the user from any existing supplementary groups. Omitting `-a` would replace the user's entire supplementary group membership list with just the one group, which can unexpectedly strip access to other groups. This command directly edits /etc/group and /etc/passwd to update group membership.

Why this answer

`usermod -aG` appends the user to the specified supplementary group(s) without affecting any existing supplementary group memberships. The `-a` flag (append) must be used with `-G` to avoid overwriting the current list of supplementary groups. This is the standard method in Red Hat Enterprise Linux for adding a user to an additional group while preserving all other group memberships.

Exam trap

The trap here is that candidates often confuse `usermod -G` (which replaces all supplementary groups) with `usermod -aG` (which appends), and may also mistakenly think `groupadd` or `adduser` can modify group memberships, when in fact only `usermod -aG` and `gpasswd -a` are the correct tools for this task.

73
MCQeasy

A container named 'web1' was created and ran briefly before exiting with status 0. The administrator needs to restart it and attach to the running container's console. Which command should be used?

A.podman run --name web1 -it registry.access.redhat.com/ubi8/httpd-24
B.podman start web1
C.podman restart web1 && podman attach web1
D.podman start web1 && podman attach web1
AnswerD

This combination first uses podman start web1 to take the existing stopped container and transition it to the running state, preserving its filesystem and configuration. Then podman attach web1 connects your terminal to the container's primary process' STDIN and STDOUT, giving you the same interactive console session that existed when it was originally run. This is the correct lifecycle sequence for resuming an existing interactive container without recreating it.

Why this answer

`podman start web1` restarts the existing container that exited with status 0, and `podman attach web1` connects the current terminal to the container's main process console. The `&&` ensures the attach runs only after the container is successfully started, allowing the administrator to interact with the running container's console.

Exam trap

The primary trap is that candidates may think `podman restart` is required to resume an exited container, but `podman start` is the correct command. Additionally, candidates often forget to attach to the console after starting, leading them to choose option B. Note: `podman restart` does work on stopped containers, but it stops and starts the container unnecessarily; `podman start` is the appropriate command for resuming a container that exited with status 0.

How to eliminate wrong answers

Option A is wrong because `podman run` creates and runs a new container with the name 'web1', which will fail since a container named 'web1' already exists, and it does not restart the existing container. Option B is wrong because `podman start web1` only starts the container but does not attach to its console, so the administrator cannot interact with the running container. Option C is wrong because `podman restart web1` stops and then starts the container, which is unnecessary for a container that exited with status 0 and can be started directly; additionally, the `&&` syntax is valid but the restart is redundant and may cause a brief interruption.

74
MCQhard

A system fails to boot and drops into an emergency shell. The administrator suspects a misconfigured /etc/fstab. Which command should be used to determine which filesystem is causing the boot issue?

A.systemctl status local-fs.target
B.journalctl -xb -p err
C.fsck -A
D.mount -a
AnswerB

Running journalctl -xb -p err reads the persistent journal from the current boot (-b), applies extended explanatory hints (-x) that describe what each message means, and filters to error priority and above (-p err). This will surface kernel driver errors, systemd mount failures, and device not found messages that directly explain why local-fs.target failed. Because the emergency shell runs early in the boot process, the journal still contains the relevant log entries, making this the most reliable diagnostic command.

Why this answer

When a system fails to boot due to a misconfigured /etc/fstab, the emergency shell is entered. The `journalctl -xb -p err` command displays the systemd journal from the current boot (`-b`) with extended information (`-x`) and filters for error-level messages (`-p err`). This will show the exact mount failure and the offending filesystem entry, making it the correct diagnostic tool.

Exam trap

The trap here is that candidates often choose `mount -a` (option D) thinking it will show the error, but it only attempts the mount again without providing the specific fstab line or error context, whereas `journalctl -xb -p err` reveals the exact failure from the boot process.

How to eliminate wrong answers

Option A is wrong because `systemctl status local-fs.target` shows the status of the local-fs target unit, but it does not provide detailed error messages about which specific filesystem failed to mount; it only indicates whether the target is active or failed. Option C is wrong because `fsck -A` checks all filesystems listed in /etc/fstab for consistency, but it does not report which filesystem caused the boot failure—it may run checks on healthy filesystems and does not parse mount errors. Option D is wrong because `mount -a` attempts to mount all filesystems in /etc/fstab, but if the system is already in an emergency shell, this command may fail again without providing clear diagnostic output about the specific misconfiguration.

75
MCQeasy

A new employee named asmith needs a user account with a home directory and a specific UID of 1500. Which command accomplishes this?

A.useradd -m -u 1500 asmith
B.adduser -uid 1500 asmith
C.useradd -h /home/asmith -u 1500 asmith
D.useradd -d /home/asmith -U 1500 asmith
AnswerA

The `-m` flag tells `useradd` to create the user's home directory (`/home/asmith`) immediately, and `-u 1500` explicitly assigns UID 1500. This is the correct way to create a new account for asmith with both a usable home directory and a known UID for ownership purposes.

Why this answer

`useradd -m -u 1500 asmith` creates the user asmith with a home directory (via `-m`) and assigns a specific UID of 1500 (via `-u`). The `-m` flag ensures the home directory is created if it does not exist, which is required by the question.

Exam trap

The trap here is confusing `-u` (UID) with `-U` (create user group) and mistaking `-h` for home directory instead of the correct `-d` flag.

How to eliminate wrong answers

Option B is wrong because `adduser` is a Perl script (not a standard command on RHEL/CentOS) and `-uid` is not a valid flag; the correct flag for UID with `adduser` would be `--uid`, but the question expects the standard `useradd` command. Option C is wrong because `-h` is not a valid flag for `useradd`; the flag to specify a home directory is `-d`, and `-h` is used for help. Option D is wrong because `-U` creates a user group with the same name as the user (not a UID), and the UID should be specified with `-u` (lowercase), not `-U`.

Page 1 of 2

Page 2

All pages