Red Hat Certification

EX200 — RHCSA System Administrator Study Guide

63 practice questions with correct answers and detailed explanations. Use this guide to review concepts before taking the practice exam.

▶ Take Practice Exam 63 questions  ·  Free  ·  No registration

About the EX200 Exam

The Red Hat RHCSA System Administrator (EX200) certification validates professional expertise in Red Hat technologies. This study guide covers all 63 practice questions from our EX200 practice test, complete with correct answers and explanations to help you understand each concept thoroughly.

Review each question and explanation below, then test yourself with the full interactive practice exam to measure your readiness.

63 Practice Questions & Answers

Q1 Easy

You need to configure a static IP address on a system using NetworkManager. Which file should you edit to make persistent changes?

  • A /etc/resolv.conf
  • B /etc/sysconfig/network-scripts/ifcfg-eth0 ✓ Correct
  • C /etc/network/interfaces
  • D /proc/net/dev
Explanation

RHEL systems use /etc/sysconfig/network-scripts/ for persistent network configuration. This is the standard location for network interface configuration files.

Q2 Easy

A user reports they cannot execute a script located at /home/user/script.sh even though it is readable. What is the most likely issue and how would you fix it?

  • A The file ownership is incorrect; use chown root:root /home/user/script.sh
  • B The execute permission is missing; use chmod +x /home/user/script.sh ✓ Correct
  • C The script lacks a proper shebang line; add #!/bin/bash at the beginning and rewrite the entire script with proper error handling
  • D SELinux is blocking execution; use semanage fcontext to change the context
Explanation

The execute permission (x) is required to run a script. The chmod +x command grants this permission to the file.

Q3 Easy

You need to find all files larger than 100MB in the /home directory. Which command would you use?

  • A find /home -size +100M ✓ Correct
  • B ls -lR /home | awk '$5 > 104857600'
  • C locate /home -size +100M
  • D grep -r "size +100M" /home
Explanation

The find command with -size option is the standard tool for searching files by size. The +100M syntax finds files larger than 100 megabytes.

Q4 Easy

What is the correct syntax to create a logical volume named 'data' with a size of 10GB from the volume group 'vg0'?

  • A lvcreate -L 10G -n data vg0 ✓ Correct
  • B pvcreate -L 10G -n data vg0
  • C vgcreate data -L 10G vg0
  • D lvmcreate -size 10G data vg0
Explanation

The lvcreate command creates logical volumes. The -L flag specifies size, and -n specifies the name followed by the volume group name.

Q5 Medium

You are configuring firewall rules and need to allow SSH access only from a specific subnet 192.168.1.0/24. Which firewalld command would accomplish this?

  • A firewall-cmd --permanent --add-port=22/tcp --from-zone=192.168.1.0/24 && firewall-cmd --reload
  • B firewall-cmd --add-service ssh --source 192.168.1.0/24
  • C firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port protocol="tcp" port="22" accept' ✓ Correct
  • D iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 22 -j ACCEPT
Explanation

Rich rules in firewalld allow granular control over traffic based on source IP and port. The syntax shown uses the correct family, source, and port parameters to restrict SSH.

Q6 Medium

A cron job needs to run every weekday (Monday-Friday) at 2:30 AM. What is the correct cron expression?

  • A 30 2 * * 0-4 /path/to/script.sh
  • B 30 2 1-5 * * /path/to/script.sh
  • C 30 2 * * 1-5 /path/to/script.sh ✓ Correct
  • D 2:30 * * * 1-5 /path/to/script.sh
Explanation

Cron format is minute hour day month day-of-week. The value 1-5 represents Monday through Friday (1=Monday, 5=Friday). 30 2 sets it to 2:30 AM.

Q7 Medium

You need to configure a user to have sudo access without entering a password for specific commands. Where should this be configured?

  • A By adding the user to the wheel group with unrestricted access
  • B /etc/shadow file by setting the password field to empty or asterisk
  • C In the user's ~/.bashrc file with alias commands
  • D In the /etc/sudoers file using visudo ✓ Correct
Explanation

The sudoers file, edited with visudo, is the proper location to grant sudo privileges and configure passwordless access for specific commands. This is safer than directly editing /etc/sudoers.

Q8 Medium

When configuring SELinux, what is the difference between Enforcing and Permissive modes?

  • A Enforcing only applies to file contexts; Permissive only applies to process contexts
  • B Permissive is for development; Enforcing requires a system reboot to activate
  • C Enforcing requires setting all file contexts manually; Permissive auto-configures contexts automatically
  • D Enforcing blocks violations and logs them; Permissive logs violations but allows access ✓ Correct
Explanation

Enforcing mode denies operations that violate policy and logs them. Permissive mode logs policy violations but allows the operations to proceed, useful for troubleshooting.

Q9 Easy

You need to enable a service to start automatically on boot. Which systemctl command accomplishes this?

  • A systemctl start servicename --boot
  • B systemctl set-default servicename
  • C systemctl enable servicename ✓ Correct
  • D chkconfig servicename on
Explanation

The systemctl enable command creates symbolic links to start a service at boot time. This is the modern RHEL replacement for chkconfig.

Q10 Medium

A system is experiencing high disk I/O. Which tool would be best for monitoring I/O statistics per device?

  • A top
  • B vmstat
  • C netstat
  • D iostat ✓ Correct
Explanation

iostat provides detailed input/output statistics by device, including read/write rates and utilization. It's specifically designed for I/O analysis.

Q11 Medium

You need to change the default runlevel (target) to multi-user mode without graphical interface. What command would you use?

  • A systemctl isolate runlevel3.target
  • B systemctl set-default multi-user.target ✓ Correct
  • C echo 'RUNLEVEL=3' >> /etc/inittab
  • D init 3
Explanation

systemctl set-default sets the default target for boot. multi-user.target is the non-graphical multi-user mode. The set-default command persists across reboots.

Q12 Medium

You need to audit file access on a sensitive system file /etc/passwd. Which tool should you use to configure auditing rules?

  • A auditctl ✓ Correct
  • B systemtap
  • C strace
  • D ltrace
Explanation

auditctl is used to configure the Linux Audit framework for monitoring file and system access. It creates rules that log activities to the audit daemon.

Q13 Hard

A user accidentally deleted important files from their home directory. How would you recover them from a backup using tar?

  • A tar -xf backup.tar.gz --wildcards --no-anchored 'deleted_filename'
  • B tar -tvf backup.tar.gz | grep 'deleted' && tar -xvf backup.tar.gz --strip-components=1
  • C tar -xvf backup.tar.gz -C / 'path/to/deleted/files' ✓ Correct
  • D tar -xvf backup.tar.gz -C /home/user --transform='s/^.*deleted//'
Explanation

To extract specific files from a tar archive, use tar -xvf followed by the archive name, -C to specify extraction directory, and the file path. The path must match what's in the archive.

Q14 Hard

You need to set up SSH key-based authentication for a user. After generating the key pair, which file permissions are critical for security?

  • A ~/.ssh/id_rsa must be 600; ~/.ssh/authorized_keys must be 600; ~/.ssh directory must be 700 ✓ Correct
  • B ~/.ssh/id_rsa.pub must be 600 and stored in ~/.ssh/id_rsa for security purposes
  • C ~/.ssh/id_rsa must be 644; ~/.ssh/authorized_keys must be 644; ~/.ssh directory must be 755
  • D All files in ~/.ssh must be 700 for maximum security
Explanation

SSH requires strict permissions: private keys (600), authorized_keys file (600), and the .ssh directory (700). Incorrect permissions will cause authentication failures or security warnings.

Q15 Medium

A service is failing to start and you suspect a syntax error in its configuration file. How would you validate the syntax before restarting?

  • A Use the service-specific syntax check command, e.g., 'nginx -t' for nginx or 'sshd -t' for SSH ✓ Correct
  • B View the journal and check for error messages without validating first
  • C Create a test environment and copy the configuration file to validate through trial and error
  • D Start the service with verbose flags: 'systemctl start servicename -v'
Explanation

Most services provide built-in configuration validation commands. For example, nginx -t, sshd -t, and httpd -t check syntax without starting the service.

Q16 Medium

You need to create a backup of the entire system using tar, excluding certain directories like /proc, /sys, and /dev. What would be the correct command?

  • A tar -czf backup.tar.gz / -path '*/proc' -prune -o -path '*/sys' -prune -o -path '*/dev' -prune
  • B tar -czf backup.tar.gz / && tar --delete '/proc' '/sys' '/dev' backup.tar.gz
  • C tar --exclude='/proc' --exclude='/sys' --exclude='/dev' -czf backup.tar.gz / ✓ Correct
  • D tar -czf backup.tar.gz / --ignore='proc|sys|dev'
Explanation

The --exclude option in tar prevents directories from being added to the archive. Multiple --exclude flags can be used for each directory to skip.

Q17 Hard

A system has multiple network interfaces. How would you configure routing so that traffic destined for 10.0.0.0/24 goes through eth1?

  • A route add -net 10.0.0.0/24 gw <gateway_ip> dev eth1 && route save
  • B iptables -t nat -A PREROUTING -d 10.0.0.0/24 -o eth1 -j ACCEPT
  • C echo '10.0.0.0/24 dev eth1' >> /etc/sysconfig/network-scripts/route-eth1
  • D ip route add 10.0.0.0/24 via <gateway_ip> dev eth1 ✓ Correct
Explanation

The 'ip route add' command is the modern way to add persistent routing rules. It specifies the destination network, gateway, and output interface.

Q18 Medium

You need to find and remove all empty files in the /tmp directory. Which command would be most efficient?

  • A find /tmp -type f -size 0 | xargs rm -f
  • B find /tmp -type f -empty -exec rm {} \;
  • C find /tmp -type f -empty -delete ✓ Correct
  • D ls -la /tmp | grep ' 0 ' | awk '{print $NF}' | xargs rm -f
Explanation

The find command with -type f -empty -delete is the most efficient method. The -delete option directly removes files matching the criteria without piping to rm.

Q19 Easy

A directory has mixed ownership with some files belonging to different users. You need to recursively change ownership of all files to a specific user and group. What is the correct command?

  • A chmod -R username:groupname /path/to/directory
  • B chown -r username:groupname /path/to/directory
  • C chgrp -R username /path/to/directory && chown -R groupname /path/to/directory
  • D chown -R username:groupname /path/to/directory ✓ Correct
Explanation

The chown command with -R flag recursively changes ownership. The syntax is chown user:group directory. The -R flag must be uppercase.

Q20 Medium

You need to search for a specific string in compressed log files without decompressing them. Which command would be appropriate?

  • A gunzip /var/log/compressed.log.gz && grep 'search_string' /var/log/compressed.log
  • B grep 'search_string' < /var/log/compressed.log.gz
  • C strings /var/log/compressed.log.gz | grep 'search_string'
  • D zgrep 'search_string' /var/log/compressed.log.gz ✓ Correct
Explanation

zgrep is specifically designed to search within gzip-compressed files without requiring decompression. It's efficient and preserves the original compressed file.

Q21 Medium

A process is consuming excessive memory and needs to be terminated. What is the safest approach to stop it gracefully before using SIGKILL?

  • A Use 'pkill -f processname' which automatically sends the correct signal
  • B Send SIGTERM first with 'kill -15 <pid>', wait a moment, then use 'kill -9 <pid>' if necessary ✓ Correct
  • C Stop the service through systemctl which properly stops all related processes gracefully and completely
  • D Send SIGKILL immediately with 'kill -9 <pid>' to ensure it stops quickly
Explanation

SIGTERM (15) allows processes to clean up resources gracefully. SIGKILL (9) forces termination immediately. Best practice is to try SIGTERM first and only escalate if needed.

Q22 Hard

You need to configure a system to log all authentication attempts to a centralized server. Which service would you configure and what protocol would typically be used?

  • A journald service which automatically sends logs to all connected systems via broadcast
  • B logrotate service to compress and archive authentication logs for centralized storage, then scp them daily
  • C auditd service which only logs local audit events and cannot forward to remote servers
  • D rsyslog service using UDP or TCP to forward logs to a remote syslog server ✓ Correct
Explanation

rsyslog is the system logging daemon that can forward logs to remote servers. It uses UDP port 514 or TCP 514 to send syslog messages to a centralized logging server.

Q23 Medium

A disk is running out of space and you need to identify which files are consuming the most disk space in a specific directory. What command combination would be most helpful?

  • A find /directory -type f -printf '%s %p\n' | sort -rn | head -20
  • B df -h /directory && du -h /directory | sort -rh
  • C du -sh /* | sort -rh | head -20 ✓ Correct
  • D ls -lRh /directory | sort -k5 -rh | head -20
Explanation

du -sh shows disk usage of directories in human-readable format. Piping to sort -rh (sort by size, reverse, human-readable) and head shows the largest directories.

Q24 Medium

You need to configure automatic package updates on a RHEL system. Which daemon should be enabled for unattended updates?

  • A pacman-update-daemon or zypper-auto
  • B yum-cron or dnf-automatic ✓ Correct
  • C update-manager or synaptic running as a system service
  • D apt-get daemon or auto-updater
Explanation

yum-cron and dnf-automatic are the appropriate tools for RHEL/CentOS systems to perform unattended package updates. The choice depends on whether the system uses yum or dnf.

Q25 Medium

A system uses GPT partitioning and you need to create a new partition on a disk. Which tool should you use instead of fdisk?

  • A sfdisk which handles both MBR and GPT automatically
  • B fdisk with the -g flag for GPT mode
  • C gdisk or parted ✓ Correct
  • D cfdisk which automatically detects partition table type and adapts accordingly
Explanation

gdisk and parted are the appropriate tools for GPT partition management. fdisk is limited to MBR partition tables and cannot properly manage GPT disks.

Q26 Hard

You need to monitor real-time system performance including CPU, memory, and I/O. Which single command would provide comprehensive monitoring?

  • A top
  • B dstat ✓ Correct
  • C htop
  • D ps aux
Explanation

dstat combines functionality of vmstat, iostat, and netstat into one tool, providing real-time statistics on CPU, memory, disk I/O, and network in a single view.

Q27 Hard

A user's password has expired and they cannot log in. As root, how would you reset their password and force them to change it on next login?

  • A Use 'usermod --expiredate 1 username' to lock the account and force password change
  • B /usr/bin/passwd-reset username with --force-change flag in the next login configuration
  • C Edit /etc/shadow directly to set the password field and last change date to force expiration
  • D passwd username to set new password, then 'chage -d 0 username' to expire it immediately ✓ Correct
Explanation

The passwd command changes the password. Using 'chage -d 0' sets the last password change date to epoch, forcing a password change on next login.

Q28 Medium

Which command is used to display the current runlevel of a RHEL 8 system?

  • A cat /etc/inittab
  • B systemctl get-default ✓ Correct
  • C runlevel
  • D who -r
Explanation

In RHEL 8 with systemd, 'systemctl get-default' shows the current target (equivalent to runlevel). The 'runlevel' command still works but is deprecated; /etc/inittab doesn't exist in systemd-based systems.

Q29 Easy

What is the purpose of the /etc/sudoers file?

  • A Store encrypted passwords for sudo authentication
  • B List all users currently using sudo on the system
  • C Define which users can execute commands with sudo privileges and what restrictions apply ✓ Correct
  • D Configure sudo timeout and session settings globally
Explanation

/etc/sudoers defines sudo access rules and permissions. It should only be edited with 'visudo' to prevent syntax errors that could lock out administrative access.

Q30 Medium

You need to create a new logical volume with 5GB size. Which sequence of commands is correct?

  • A vgcreate vg0 /dev/sda1; pvcreate -L 5G /dev/sda1; lvcreate /dev/vg0/lvol0
  • B lvcreate -L 5G vg0 -n lvol0; mkfs.xfs /dev/vg0/lvol0; mount /dev/vg0/lvol0 /mnt/data ✓ Correct
  • C pvdisplay /dev/sda1; lvcreate -L 5G vg0 -n lvol0; fsck -t xfs /dev/vg0/lvol0
  • D lvcreate vg0 -n lvol0 5G; mkswap /dev/vg0/lvol0; swapon /dev/vg0/lvol0
Explanation

The correct sequence is: create the logical volume with lvcreate, format it with mkfs.xfs, then mount it. Option A follows this proper order for LVM logical volume creation.

Q31 Medium

A user reports they cannot access a file despite having read permission on the parent directory. Which permission is likely missing?

  • A Execute permission on the file itself
  • B Write permission on the parent directory
  • C Execute permission on the parent directory ✓ Correct
  • D Read permission on the file itself
Explanation

Execute permission on a directory allows traversal into it. Without execute permission on the parent directory, users cannot access any files within it, regardless of file permissions.

Q32 Medium

Which file contains the list of packages that should not be updated by the package manager?

  • A /var/lib/yum/protected-packages
  • B /etc/dnf/dnf.conf with 'skip-broken' option
  • C /etc/rpm/macros.d/exclude-list
  • D /etc/yum.conf with the 'exclude' directive ✓ Correct
Explanation

The 'exclude' directive in /etc/yum.conf (or /etc/dnf/dnf.conf in RHEL 8+) specifies packages to exclude from updates. This prevents automatic updates of critical packages.

Q33 Medium

What is the effect of setting SELINUX=disabled in /etc/selinux/config?

  • A SELinux is completely disabled, though the kernel module remains loaded
  • B SELinux is disabled and the kernel module is not loaded; requires a system reboot to take effect ✓ Correct
  • C SELinux is put into permissive mode and logs violations without enforcing them
  • D SELinux processes are suspended but can be resumed with 'semanage' commands
Explanation

Setting SELINUX=disabled completely disables SELinux including the kernel module, requiring a reboot. This differs from permissive mode, which still loads the module but doesn't enforce rules.

Q34 Easy

You want to schedule a command to run every weekday at 2:30 PM. Which crontab entry is correct?

  • A 30 14 * * 1-5 /path/to/command ✓ Correct
  • B 30 14 * 1-5 * /path/to/command
  • C 14:30 weekdays /path/to/command
  • D 2:30 PM mon-fri /path/to/command
Explanation

Cron syntax is minute hour day month day-of-week. Entry '30 14 1-5' means minute 30, hour 14 (2 PM), any day/month, Monday-Friday (1-5 represents weekdays).

Q35 Medium

A service fails to start and logs indicate 'Address already in use'. Which command would help diagnose which process is using the required port?

  • A systemctl status service-name to see detailed error messages
  • B netstat -tlnp | grep :PORT or ss -tlnp | grep :PORT ✓ Correct
  • C lsof -i :PORT to see what process is bound to the port
  • D ps aux | grep service-name to find the process
Explanation

Both 'netstat -tlnp' and 'ss -tlnp' show listening ports and associated processes. This directly identifies which service is using the port causing the conflict.

Q36 Hard

Which statement correctly describes the difference between hard and soft links?

  • A Both hard and soft links span filesystems equally, but hard links are faster
  • B Soft links cannot span filesystems; hard links can and point directly to file content
  • C Hard links cannot span filesystems but soft links can; both point to the same inode
  • D Hard links cannot span filesystems; soft links can but become invalid if the original file is deleted ✓ Correct
Explanation

Hard links cannot cross filesystem boundaries and share the same inode. Soft (symbolic) links can cross filesystems but are broken if the target is deleted, as they contain a path, not an inode reference.

Q37 Medium

How would you view the contents of a compressed tar archive without extracting it?

  • A gunzip -c archive.tar.gz | tar -t | less
  • B tar -tzf archive.tar.gz | less
  • C All of the above are correct methods ✓ Correct
  • D zcat archive.tar.gz | tar -t | less
Explanation

All three methods list contents of compressed tar files: '-tzf' lists gzip content, 'zcat' decompresses to stdout piped to tar -t, and 'gunzip -c' does the same. All are valid approaches.

Q38 Medium

A user's home directory has ownership 'root:root' and permissions '700'. The user cannot access their own files. What is the correct remediation?

  • A chmod u+rw /home/username; chown username:root /home/username
  • B setfacl -m u:username:rwx /home/username
  • C chown username:username /home/username; chmod 700 /home/username ✓ Correct
  • D chmod 755 /home/username; chown username:username /home/username
Explanation

The directory must be owned by the user (chown) before applying standard permissions. chmod 700 gives the owner full access while restricting others, which is the standard for home directories.

Q39 Hard

Which of the following accurately describes the effect of the umask value 0077?

  • A Users can only create files, not directories, in their home directory
  • B New files are created with permissions 644 and directories with 755
  • C Default permissions are reduced by 77 octal values from the system default
  • D New files are created with permissions 600 and directories with 700 ✓ Correct
Explanation

umask 0077 removes all group and other permissions. Files default to 666, minus 077 = 600; directories default to 777, minus 077 = 700.

Q40 Medium

You need to find all files modified in the last 24 hours in the /var/log directory. Which command is appropriate?

  • A find /var/log -mtime 1 -type f
  • B find /var/log -mtime +1 -type f
  • C find /var/log -mtime -1 -type f ✓ Correct
  • D find /var/log -mmin -1440 -type f
Explanation

The '-mtime -1' option finds files modified less than 1 day ago (within the last 24 hours). Alternatively, '-mmin -1440' (minus 1440 minutes) also works, but '-mtime -1' is simpler for daily searches.

Q41 Medium

What is the primary purpose of the /boot/grub2/grub.cfg file on a RHEL 8 system?

  • A It stores kernel parameters and can only be modified with the 'grub-mkconfig' command
  • B It is generated from /etc/default/grub and /etc/grub.d/ and should not be edited directly ✓ Correct
  • C It is the main GRUB configuration file and should be edited directly by administrators
  • D It is a temporary cache file that is regenerated on every boot
Explanation

grub.cfg is auto-generated from /etc/default/grub and scripts in /etc/grub.d/. Administrators should modify the source files and run 'grub2-mkconfig -o /boot/grub2/grub.cfg' to regenerate it.

Q42 Medium

A system administrator needs to temporarily prevent a user from logging in without deleting their account. Which approach is most appropriate?

  • A Set the user's shell to /sbin/nologin in /etc/passwd
  • B Use 'usermod -L username' to lock the account ✓ Correct
  • C Remove the user from all groups using 'usermod -G' with no arguments
  • D Delete the user's SSH keys from ~/.ssh/authorized_keys
Explanation

'usermod -L' locks the user account by adding '!' to the password hash, preventing login while preserving the account. Setting shell to /sbin/nologin is also valid but less standard for temporary lockout.

Q43 Easy

Which command correctly displays all currently mounted filesystems with their usage statistics?

  • A lsblk -o SIZE,FSTYPE,MOUNTPOINT
  • B du -h /
  • C mount | grep -E 'type|used'
  • D df -h ✓ Correct
Explanation

'df -h' shows all mounted filesystems with their total size, used space, and available space in human-readable format. 'du' shows directory usage, not filesystem mounts.

Q44 Medium

You need to configure a network interface to use a static IP address. Which file should be modified on RHEL 8?

  • A /etc/systemd/network/eth0.network
  • B /etc/sysconfig/network-scripts/ifcfg-eth0 (or equivalent interface name) ✓ Correct
  • C /etc/NetworkManager/dispatcher.d/
  • D /etc/network/interfaces
Explanation

RHEL uses /etc/sysconfig/network-scripts/ifcfg-INTERFACE files for network configuration. While NetworkManager is common on desktops, this file-based approach is standard for servers.

Q45 Hard

What does the 'a' flag in file attributes (viewed with 'lsattr') prevent?

  • A The file from appearing in directory listings without using 'lsattr'
  • B File deletion and modification, though root can still override this protection
  • C Truncation, but allows appending new data; root cannot override this restriction ✓ Correct
  • D The file from being deleted, but allows modification if you have write permissions
Explanation

The 'a' (append-only) attribute allows data to be appended but prevents truncation and modification of existing content. This restriction applies even to root, making it useful for log files and audit trails.

Q46 Medium

Which systemd unit type is used to define a mount point for a filesystem?

  • A .device
  • B .mount ✓ Correct
  • C .service
  • D .target
Explanation

systemd uses .mount unit files to define mount points and their properties, replacing traditional /etc/fstab entries. These can coexist with fstab entries but offer more control.

Q47 Easy

An administrator needs to view real-time system resource usage. Which command provides a dynamic, refreshing display?

  • A iostat -x 1
  • B vmstat 1
  • C top or htop ✓ Correct
  • D ps aux
Explanation

'top' and 'htop' provide interactive, real-time monitoring of processes and system resources with automatic refresh. 'ps', 'vmstat', and 'iostat' show snapshots or specific metrics but aren't interactive dashboards.

Q48 Medium

What is the primary function of the /etc/hosts.allow and /etc/hosts.deny files?

  • A They implement TCP Wrappers access control for network services ✓ Correct
  • B They define trusted hosts for SSH access and override firewall rules
  • C They configure hostname resolution for the network
  • D They maintain a cache of recently accessed hosts for faster DNS lookups
Explanation

TCP Wrappers uses hosts.allow and hosts.deny to control access to network services at the application layer. These are evaluated before firewall rules for wrapped services.

Q49 Hard

You want to permanently add a network route to reach 192.168.100.0/24 via gateway 10.0.0.1. Which approach is correct for RHEL 8?

  • A Create a .network file in /etc/systemd/network with Route= directive
  • B Use 'ip route add' command and restart networking
  • C Edit /etc/sysconfig/network and add GATEWAY=10.0.0.1
  • D Add a route file /etc/sysconfig/network-scripts/route-INTERFACE with the route definition ✓ Correct
Explanation

Persistent routes in RHEL are defined in /etc/sysconfig/network-scripts/route-INTERFACE files using the format 'DESTINATION/NETMASK via GATEWAY'. Option D is for systemd-networkd, not standard RHEL.

Q50 Easy

A log file is growing very large. What is the purpose of logrotate?

  • A It rotates administrator access to log files on a weekly schedule
  • B It converts log format from text to binary for faster searching
  • C It compresses old logs and removes very old entries according to configured policy ✓ Correct
  • D It redistributes logs across multiple storage devices to balance load
Explanation

logrotate automatically manages log files by rotating, compressing, and removing old logs based on size, age, or other criteria defined in /etc/logrotate.conf or /etc/logrotate.d/.

Q51 Easy

Which command would you use to check if a specific service will automatically start at the next boot?

  • A chkconfig servicename
  • B systemctl status servicename
  • C systemctl list-unit-files --type=service | grep servicename
  • D systemctl is-enabled servicename ✓ Correct
Explanation

'systemctl is-enabled' directly returns whether a service is configured to start at boot. While 'list-unit-files' shows this info too, 'is-enabled' is the specific command designed for this check.

Q52 Medium

You need to create a user account that cannot use an interactive shell but can receive mail. Which approach is correct?

  • A useradd -s /sbin/nologin -m username; this creates a home directory and mail spool ✓ Correct
  • B useradd username -s /dev/null; ensures no shell access and automatic mail directory
  • C useradd -s /bin/false username; mail delivery requires separate vmail user setup
  • D useradd -M -s /usr/sbin/nologin username; prevents home directory creation for security
Explanation

Using -s /sbin/nologin prevents shell login while allowing system processes like mail delivery. The -m flag creates a home directory, enabling mail delivery to a spool file.

Q53 Medium

A partition shows as /dev/mapper/cryptvolume. What does this indicate about the filesystem?

  • A It is encrypted using LUKS or device-mapper and requires a password to unlock ✓ Correct
  • B It is a snapshot of another volume and cannot be independently modified
  • C It is a virtual storage device created by LVM in a shared storage environment
  • D It is a RAID device managed by the mdadm utility
Explanation

Paths under /dev/mapper/ indicate logical volumes or encrypted devices managed by device-mapper. This typically means LUKS encryption is in use and the volume must be decrypted before use.

Q54 Medium

You need to configure a network interface to use a static IP address of 192.168.1.100/24 with gateway 192.168.1.1. Which file should you edit to make this configuration persistent across reboots on RHEL 8?

  • A /etc/netplan/01-netcfg.yaml
  • B /etc/NetworkManager/conf.d/99-static.conf
  • C /etc/sysconfig/network-scripts/ifcfg-eth0 ✓ Correct
  • D /etc/network/interfaces
Explanation

On RHEL/CentOS systems, network interface configurations are stored in /etc/sysconfig/network-scripts/ directory. The ifcfg-[interface-name] files contain persistent network settings.

Q55 Medium

What is the purpose of the 'umask' value in user login configuration files?

  • A It controls the user's memory allocation limits
  • B It specifies the maximum number of simultaneous user sessions allowed
  • C It defines the default file and directory permissions by subtracting from 666 (files) and 777 (directories) ✓ Correct
  • D It determines which groups a user can join after login
Explanation

The umask (user file-creation mask) is subtracted from default permission values to determine actual file and directory permissions created by that user.

Q56 Medium

You are tasked with finding all files modified in the last 7 days in the /home directory. Which command accomplishes this?

  • A find /home -mtime +7
  • B find /home -modified 7d
  • C find /home -mdays 7
  • D find /home -mtime -7 ✓ Correct
Explanation

The -mtime -7 option finds files modified less than 7 days ago (the minus sign means 'less than'). Without the minus, +7 would find files older than 7 days.

Q57 Medium

A user reports that they cannot create files in /tmp directory despite the directory being world-writable (777). The output of 'ls -ld /tmp' shows: drwxrwxrwt. What is preventing file creation?

  • A The execute bit is missing for the user in question
  • B The sticky bit is set, restricting file creation to the directory owner
  • C SELinux is preventing write access to temporary files
  • D The sticky bit is set, allowing users to delete only their own files in the directory ✓ Correct
Explanation

The 't' at the end of permissions indicates the sticky bit is set. This allows all users to write to /tmp but only permits them to delete their own files, not others' files.

Q58 Medium

You need to allow user 'john' to run the command '/usr/bin/systemctl restart httpd' without entering a password using sudo. Which line should you add to the sudoers file?

  • A john ALL=(ALL) /usr/bin/systemctl restart httpd NOPASSWD
  • B john NOPASSWD=(ALL) /usr/bin/systemctl restart httpd
  • C ALL john NOPASSWD: /usr/bin/systemctl restart httpd
  • D john ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart httpd ✓ Correct
Explanation

The correct sudoers syntax is: user hostname=(runas_user) NOPASSWD: command. The NOPASSWD tag must appear before the command specification.

Q59 Hard

You need to compress a directory '/data/archive' into a tar.gz file while excluding all files larger than 100MB. Which command is most appropriate?

  • A tar -czf archive.tar.gz --exclude-from=largefile.txt /data/archive
  • B tar -czf archive.tar.gz --exclude='*.tar.gz' /data/archive
  • C find /data/archive -size -100M -print0 | tar -czf archive.tar.gz --null -T - ✓ Correct
  • D tar --exclude='+(*/|)' -czf archive.tar.gz /data/archive | gzip
Explanation

The find command with -size -100M locates files smaller than 100MB, and piping to tar with -T - and --null allows tar to process the filtered file list while excluding larger files.

Q60 Easy

What is the primary purpose of the '/etc/fstab' file?

  • A To configure firewall rules and network filtering
  • B To manage cron jobs and scheduled tasks
  • C To define filesystems and how they should be mounted at boot time ✓ Correct
  • D To store encrypted passwords for system users
Explanation

/etc/fstab (filesystem table) contains entries that define which filesystems are mounted automatically at boot, including device, mount point, filesystem type, and mount options.

Q61 Hard

You notice that the systemd service 'nginx.service' is enabled but not running. You run 'systemctl start nginx' and it fails silently with no error message. What is the best way to diagnose this issue?

  • A Check /var/log/messages for any kernel-level errors related to nginx
  • B Reinstall the nginx package to reset configuration files
  • C Run 'strace systemctl start nginx' to trace all system calls
  • D Run 'systemctl status nginx' and check 'journalctl -xe' for detailed error information ✓ Correct
Explanation

The systemctl status command and journalctl -xe provide comprehensive service state information and recent journal entries showing why the service failed to start.

Q62 Easy

A user's home directory is /home/alice. When you run 'ls -la /home/alice', the first character of each line shows 'd' for directories and '-' for files. What is this character indicating?

  • A Whether the file is a device file or regular file
  • B The ownership permission level (user, group, or other)
  • C Whether the file has been modified since the last backup
  • D The file type (regular file, directory, symlink, character device, block device, socket, or FIFO pipe) ✓ Correct
Explanation

The first character in ls -l output represents file type: '-' for regular files, 'd' for directories, 'l' for symlinks, 'c' for character devices, 'b' for block devices, 's' for sockets, and 'p' for pipes.

Q63 Hard

You need to set up LVM on a system with three physical hard drives. You want to create a single logical volume across all three drives with redundancy. Which LVM segment type should you use?

  • A raid1 - to provide RAID 1 mirroring with automatic failover
  • B mirror - to replicate data across multiple physical volumes for redundancy ✓ Correct
  • C linear - to combine drives sequentially
  • D striped - to distribute data across drives for performance
Explanation

LVM mirroring (using -m flag in lvcreate) replicates logical volume data across multiple physical volumes for redundancy, while linear and striped are performance-oriented without redundancy.

Ready to test your knowledge?

You've reviewed all 63 questions. Take the interactive practice exam to simulate the real test environment.

▶ Start Practice Exam — Free