# Mock RHCSA (EX200) Practice Exam - Version 2 ## Introduction This is the second version of our mock RHCSA exam, featuring new tasks to further test your Red Hat system administration skills. Like the first version, it covers the key objectives of the official RHCSA exam (EX200). **Exam Guidelines:** - Duration: 2.5 hours - All configurations must persist after system reboot - Complete as many tasks as possible - 70% is the passing score - You may use Red Hat documentation available on the system **Exam Environment:** - Red Hat Enterprise Linux 9 - Virtual machine with 4GB RAM, 40GB disk space - Internet access is NOT available - Root access is available ## Exam Tasks ### Task 1: User and Group Management 1. Create a user named `devops` with UID 3030 2. Set the password for `devops` to `DevOps2023` 3. Configure the `devops` account to expire on December 31, 2023 4. Create a group named `developers` with GID 4040 5. Create 3 users: `dev1`, `dev2`, and `dev3`, all belonging to the `developers` group as their primary group 6. Ensure the primary group for all new users created in the system is `developers` 7. Configure all members of the `developers` group to have a password change required every 60 days ### Task 2: File System Management 1. Create a directory `/projects` owned by `devops` with `developers` as the group owner 2. Set special permissions on the `/projects` directory so all new files created within it inherit the `developers` group ownership 3. Configure permissions so that: - Members of the `developers` group can create files in the directory - Only file owners can delete their own files (using the sticky bit) - Users outside the `developers` group cannot access the directory 4. Create a file `/projects/readme.md` with the content "Development Projects Directory" 5. Set ACLs on the `/projects` directory to give user `dev1` full control, while `dev2` and `dev3` have read and execute permissions only ### Task 3: LVM Storage Configuration 1. Create a 2GB partition on an available disk 2. Create a volume group named `vg_projects` using this partition 3. Create two logical volumes in the `vg_projects` volume group: - `lv_data` (800MB) - `lv_backup` (400MB) 4. Format `lv_data` with XFS filesystem and `lv_backup` with ext4 filesystem 5. Mount `lv_data` at `/projects/data` and `lv_backup` at `/projects/backup` permanently 6. Configure the system to automatically snapshot `lv_data` daily (hint: you'll need to leave free space in the volume group) ### Task 4: Storage with VDO and Stratis 1. Install the necessary packages for VDO (Virtual Data Optimizer) 2. Create a 1GB partition on an available disk 3. Configure VDO on this partition with a logical size of 3GB 4. Format the VDO volume with XFS and mount it at `/vdo` permanently 5. Install the Stratis storage management tools 6. Create a Stratis pool named `stratis_pool` using another 1GB partition 7. Create a Stratis filesystem named `stratis_fs` and mount it at `/stratis` permanently ### Task 5: Advanced Container Management 1. Install the container tools (podman) 2. Configure a persistent container storage location at `/container_storage` 3. Pull the MariaDB container image 4. Run a MariaDB container named `db_server` with: - The container accessible on port 3306 - A root password of `dbpassword` - A persistent volume at `/container_storage/mysql_data` mounted to the container's `/var/lib/mysql` - Environment variables set for a database named `webapp` and a database user `webuser` with password `webpass` 5. Configure the container to start automatically at system boot using systemd 6. Create a simple bash script `/usr/local/bin/db_backup.sh` that creates a backup of the MariaDB container data ### Task 6: Automating System Tasks 1. Create a systemd timer that runs a filesystem usage check every 4 hours and logs the results to `/var/log/disk_usage.log` 2. Configure a cron job for the `devops` user to run every Monday at 2:30 AM that: - Archives files older than 30 days in `/projects/data` - Moves the archives to `/projects/backup` 3. Configure a systemd service called `project-backup` that: - Creates a tar archive of the `/projects` directory - Runs automatically at system shutdown - Places the backup in `/var/backups` with a timestamp in the filename ### Task 7: System Boot Configuration 1. Configure the system to boot into emergency mode with a 5-second timeout 2. Create a new GRUB menu entry that boots the system with the kernel parameter `enforcing=0` 3. Set the default boot target to multi-user (non-graphical) 4. Create a custom systemd target called `developer-mode.target` that: - Starts all the services of multi-user target - Additionally starts the MariaDB container - Mounts all project-related filesystems ### Task 8: Network Configuration and Services 1. Configure the primary network interface with: - Static IP: 192.168.10.200/24 - Gateway: 192.168.10.1 - DNS servers: 192.168.10.1 and 8.8.8.8 2. Configure the hostname as `rhcsa-server` 3. Add a second IP address (192.168.10.201/24) to the same interface 4. Install and configure an NFS server that: - Exports `/projects/data` as read-write to 192.168.10.0/24 - Exports `/projects/backup` as read-only to 192.168.10.0/24 5. Configure the firewall to allow NFS and MariaDB traffic from the local network only ### Task 9: Security Configuration 1. Configure SELinux contexts so that: - The web server can access files in `/projects/data` - The MariaDB container can access `/container_storage/mysql_data` 2. Configure SSH to: - Allow access only for the `devops` user - Disable password authentication (key-based only) - Listen on an alternate port (2222) 3. Set up key-based authentication for the `devops` user 4. Configure the firewall to allow SSH on the new port 5. Create a sudo configuration that allows `devops` to run commands as root without a password, but logs all commands ### Task 10: System Analysis and Troubleshooting 1. Configure system logging to: - Keep logs for 90 days - Forward system and audit logs to the `rsyslog` service - Create separate log files for container operations 2. Create a script `/usr/local/bin/system_health.sh` that: - Checks system load average - Monitors memory usage - Verifies connectivity to the gateway - Reports if any key services are down - Emails the report to `root@localhost` 3. Create a systemd service and timer to run this health check script every hour ### Task 11: Advanced Shell Scripting 1. Create a script `/usr/local/bin/user_report.sh` that: - Finds all users in the `developers` group - Reports their last login time - Lists all files owned by each user in the `/projects` directory - Sorts the output by file size - Saves a formatted report to `/var/reports/user_report.txt` 2. Make the script executable and set up a weekly cron job to run it 3. Create a directory `/var/reports` with appropriate permissions for storing reports ### Task 12: Advanced FileSystem Management 1. Create a 500MB file using `dd` to serve as a loopback device 2. Configure this file as a loopback device 3. Create a LUKS encrypted container on the loopback device 4. Format the encrypted container with XFS 5. Configure the system to automatically unlock the encrypted container at boot using a key file 6. Mount the encrypted filesystem at `/projects/secure` permanently ## Scoring Guide Each task has approximately equal weight. To pass this mock exam, you need to successfully complete 70% of the tasks. After completing the exam, test your configurations by: 1. Rebooting the system to verify persistence 2. Logging in as the created users to verify access 3. Testing that services start correctly 4. Verifying container operation 5. Checking encrypted storage and mounts Good luck with your practice exam!