RHCSA RHCSA EX200 5 — Questions and Answers
Question 1: Which command adds a swap partition at /dev/sdb2 and activates it immediately without a reboot?
- mkswap /dev/sdb2 && swapon /dev/sdb2 (Correct answer)
- fdisk --swap /dev/sdb2
- mkfs.swap /dev/sdb2 && mount -t swap /dev/sdb2
- swapon --create /dev/sdb2
Correct answer: mkswap /dev/sdb2 && swapon /dev/sdb2
mkswap formats the partition as swap space, and swapon activates it immediately for use by the kernel.
Question 2: Which configuration file defines system-wide resource limits (e.g., max open files) for PAM-authenticated sessions?
- /etc/sysctl.conf
- /etc/security/limits.conf (Correct answer)
- /etc/pam.d/common-session
- /etc/systemd/system.conf
Correct answer: /etc/security/limits.conf
/etc/security/limits.conf sets per-user and per-group limits enforced by the pam_limits module at login.
Question 3: You need to redirect all port 80 traffic to port 8080 on the local machine using firewalld. Which command does this?
- firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080 --permanent (Correct answer)
- firewall-cmd --add-masquerade=80:8080
- iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
- firewall-cmd --port=80 --redirect=8080 --permanent
Correct answer: firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080 --permanent
The --add-forward-port option in firewalld handles local port redirection; --permanent makes it survive reboots.
Question 4: Which command lists all active and inactive systemd unit files along with their enabled/disabled state?
- systemctl status --all
- systemctl list-unit-files (Correct answer)
- systemctl show --all
- journalctl --list-units
Correct answer: systemctl list-unit-files
'systemctl list-unit-files' shows all installed unit files and whether they are enabled, disabled, or static.
Question 5: When configuring autofs to automount an NFS share, which file defines the mount point directory and points to the map file?
- /etc/fstab
- /etc/auto.master (Correct answer)
- /etc/autofs.conf
- /etc/nfs.conf
Correct answer: /etc/auto.master
/etc/auto.master (or /etc/auto.master.d/) is the master map that links mount point directories to their indirect or direct map files.
Question 6: A script requires JAVA_HOME to be set for all users at login. Which file is the best place to define this environment variable system-wide?
- ~/.bashrc
- /etc/profile.d/java.sh (Correct answer)
- /etc/bashrc
- /etc/environment.d/java.conf
Correct answer: /etc/profile.d/java.sh
Files in /etc/profile.d/ with a .sh extension are sourced for all users during login, making it the standard place for system-wide environment variables.
Question 7: Which command verifies that a container image will run correctly as a systemd service by checking the generated unit file before enabling it?
- podman inspect --systemd
- podman generate systemd --name container_name (Correct answer)
- systemctl verify container_name
- podman service --check container_name
Correct answer: podman generate systemd --name container_name
'podman generate systemd --name' outputs the unit file content to stdout so you can review it before placing it in the systemd directory.
Which command adds a swap partition at /dev/sdb2 and activates it immediately without a reboot?