Table of Contents
RHCSA Exam Questions – Part 3
Practice questions for RHCSA EX200. File operations, user management, and scripting – all tested on RHEL 9.
File Operations
Q1. Find .pl Files
Find all .pl files and copy to /root/pl.found
# mkdir -p /root/pl.found
# find / -type f -name "*.pl" -exec cp {} /root/pl.found \;
Q2. Find Student User Files
# mkdir /root/student.found
# find / -user student -exec cp {} /root/student.found \;
Q3. Search Words
# grep "ich" /usr/share/dict/words > /root/lines
User Management
Q4. Set Password Expiry
Default password expiry to 20 days
# vi /etc/login.defs PASS_MAX_DAYS 20
Q5. Sudo Permission
Give group1 sudo access without password
# visudo %group1 ALL=(ALL) NOPASSWD:ALL
Q6. Set Default Umask
For user joe
# su - joe $ echo "umask 077" >> ~/.bashrc
Scripting
Q7. Script with SGID
Create script with SGID permission
# vi /root/adhoc.sh
#!/bin/bash
find /var -type f -size -2M -exec cp {} /root/backup \;
# chmod 2775 /root/adhoc.sh
# /root/adhoc.sh
Q8. Find Harry Files
# find / -user harry -exec cp {} /root/harry-files \;
Q9. Create Archive
# tar -cvzf /root/backup.tar.bz2 /usr/local
Q10. Cron for Natasha
Run echo at 14:23 daily
# su - natasha $ crontab -e 23 14 * * * /bin/echo "file"