最新的RedHat Red Hat Certified System Administrator - RHCSA - EX200免費考試真題
問題1
Create a script to search for files
* Create a script named myresearch
* Place the script under /usr/local/bin
* The script is used to search for all files under /usr that are smaller than 10 MB and have group write permission, and place these files into /root/myfiles
* Create a script named myresearch
* Place the script under /usr/local/bin
* The script is used to search for all files under /usr that are smaller than 10 MB and have group write permission, and place these files into /root/myfiles
正確答案:
Solution:
mkdir /root/myfiles
vim /usr/local/bin/myresearch
#!/bin/bash
find /usr -type f -and -size -10M -and -perm -2000 -exec cp -a {} /root/myfiles \;
:wq
chmod +x /usr/local/bin/myresearch
bash /usr/local/bin/myresearch
ll -h /root/myfiles
Script explanation:
(#!/bin/bash): #! is a conventional marker that tells the system which interpreter should be used to execute the script.
/bin/bash means the script is executed using the default Bash shell.
Here, a for loop is needed to iterate over the found GIDs (group IDs) for processing.
(awk -F':' '{print $3}' /etc/group):
awk is used to split and process text.
-F specifies the field separator.
":" indicates that the colon is used as the delimiter.
{print $3} prints the third field (the group ID).
mkdir /root/myfiles
vim /usr/local/bin/myresearch
#!/bin/bash
find /usr -type f -and -size -10M -and -perm -2000 -exec cp -a {} /root/myfiles \;
:wq
chmod +x /usr/local/bin/myresearch
bash /usr/local/bin/myresearch
ll -h /root/myfiles
Script explanation:
(#!/bin/bash): #! is a conventional marker that tells the system which interpreter should be used to execute the script.
/bin/bash means the script is executed using the default Bash shell.
Here, a for loop is needed to iterate over the found GIDs (group IDs) for processing.
(awk -F':' '{print $3}' /etc/group):
awk is used to split and process text.
-F specifies the field separator.
":" indicates that the colon is used as the delimiter.
{print $3} prints the third field (the group ID).
問題2
Find all files owned by user tom and copy them into /root/tomfiles.
正確答案:
See the solution below in Explanation.
Explanation:
Solution:
* Create the destination directory if needed:
mkdir -p /root/tomfiles
* Find and copy:
find / -type f -user tom -exec cp -pvf {} /root/tomfiles/ \;
Detailed Explanation:
* find / searches the whole filesystem.
* -type f restricts results to files.
* -user tom matches owner tom.
* -exec cp -pvf copies each file with verbose and force options.
* mkdir -p is added as a safe preparation step.
Explanation:
Solution:
* Create the destination directory if needed:
mkdir -p /root/tomfiles
* Find and copy:
find / -type f -user tom -exec cp -pvf {} /root/tomfiles/ \;
Detailed Explanation:
* find / searches the whole filesystem.
* -type f restricts results to files.
* -user tom matches owner tom.
* -exec cp -pvf copies each file with verbose and force options.
* mkdir -p is added as a safe preparation step.
問題3
Create a systemd service named backup-now.service that runs /usr/local/bin/backup-now.sh.
正確答案:
See the solution below in Explanation.
Explanation:
Solution:
Create the script:
mkdir -p /usr/local/bin
cat > /usr/local/bin/backup-now.sh < < 'EOF'
#!/bin/bash
tar -czf /root/etc-$(date +%F).tar.gz /etc
EOF
chmod +x /usr/local/bin/backup-now.sh
Create the unit file:
cat > /etc/systemd/system/backup-now.service < < 'EOF'
[Unit]
Description=Run manual etc backup
[Service]
Type=oneshot
ExecStart=/usr/local/bin/backup-now.sh
[Install]
WantedBy=multi-user.target
EOF
Reload and test:
systemctl daemon-reload
systemctl start backup-now.service
systemctl status backup-now.service
Detailed Explanation:
* Type=oneshot is correct for a task that runs and exits.
* ExecStart points to the script.
* systemctl daemon-reload is required after adding a new unit file.
* RHEL 10 systemd documentation covers manual unit creation and management. ( Red Hat
Documentation )
Explanation:
Solution:
Create the script:
mkdir -p /usr/local/bin
cat > /usr/local/bin/backup-now.sh < < 'EOF'
#!/bin/bash
tar -czf /root/etc-$(date +%F).tar.gz /etc
EOF
chmod +x /usr/local/bin/backup-now.sh
Create the unit file:
cat > /etc/systemd/system/backup-now.service < < 'EOF'
[Unit]
Description=Run manual etc backup
[Service]
Type=oneshot
ExecStart=/usr/local/bin/backup-now.sh
[Install]
WantedBy=multi-user.target
EOF
Reload and test:
systemctl daemon-reload
systemctl start backup-now.service
systemctl status backup-now.service
Detailed Explanation:
* Type=oneshot is correct for a task that runs and exits.
* ExecStart points to the script.
* systemctl daemon-reload is required after adding a new unit file.
* RHEL 10 systemd documentation covers manual unit creation and management. ( Red Hat
Documentation )
問題4
Create a snapshot of the Stratis file system fs1 in pool pool1 named fs1-snap.
正確答案:
See the solution below in Explanation.
Explanation:
Solution:
stratis filesystem snapshot pool1 fs1 fs1-snap
stratis filesystem list
Detailed Explanation:
* This creates a snapshot of the existing Stratis file system.
* Snapshots are useful for rollback, backup, and testing operations.
* Stratis features, including pool and file-system management, are part of RHEL 10 file-system
administration. ( Red Hat Documentation )
Explanation:
Solution:
stratis filesystem snapshot pool1 fs1 fs1-snap
stratis filesystem list
Detailed Explanation:
* This creates a snapshot of the existing Stratis file system.
* Snapshots are useful for rollback, backup, and testing operations.
* Stratis features, including pool and file-system management, are part of RHEL 10 file-system
administration. ( Red Hat Documentation )
問題5
Create a collaborative administrative directory /common/admin with group ownership admin and SGID permissions.
正確答案:
See the solution below in Explanation.
Explanation:
Solution:
groupadd admin
mkdir -p /common/admin
chgrp admin /common/admin
chmod 2770 /common/admin
Detailed Explanation:
* groupadd admin creates the group.
* chgrp admin assigns the group ownership.
* 2770 means:
* 2 = SGID
* 7 = owner rwx
* 7 = group rwx
* 0 = others no access
* This is a standard shared group-admin directory design.
Explanation:
Solution:
groupadd admin
mkdir -p /common/admin
chgrp admin /common/admin
chmod 2770 /common/admin
Detailed Explanation:
* groupadd admin creates the group.
* chgrp admin assigns the group ownership.
* 2770 means:
* 2 = SGID
* 7 = owner rwx
* 7 = group rwx
* 0 = others no access
* This is a standard shared group-admin directory design.
問題6
Pull the registry.access.redhat.com/ubi10/ubi image and run a rootless container named webtest that executes
sleep 3600.
sleep 3600.
正確答案:
See the solution below in Explanation.
Explanation:
Solution:
podman pull registry.access.redhat.com/ubi10/ubi
podman run -d --name webtest registry.access.redhat.com/ubi10/ubi sleep 3600
podman ps
Detailed Explanation:
* podman pull downloads the image.
* podman run -d starts the container in the background.
* Rootless Podman is a normal RHEL container workflow.
* RHEL 10 container documentation continues to center on Podman for image and container
management. ( Red Hat Documentation )
Explanation:
Solution:
podman pull registry.access.redhat.com/ubi10/ubi
podman run -d --name webtest registry.access.redhat.com/ubi10/ubi sleep 3600
podman ps
Detailed Explanation:
* podman pull downloads the image.
* podman run -d starts the container in the background.
* Rootless Podman is a normal RHEL container workflow.
* RHEL 10 container documentation continues to center on Podman for image and container
management. ( Red Hat Documentation )
問題7
Create a systemd timer that runs backup-now.service every day at 02:00.
正確答案:
See the solution below in Explanation.
Explanation:
Solution:
Create timer unit:
cat > /etc/systemd/system/backup-now.timer < < 'EOF'
[Unit]
Description=Daily backup timer
[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true
[Install]
WantedBy=timers.target
EOF
Enable it:
systemctl daemon-reload
systemctl enable --now backup-now.timer
systemctl list-timers --all | grep backup-now
Detailed Explanation:
* OnCalendar=*-*-* 02:00:00 means daily at 02:00.
* Persistent=true runs missed jobs after boot if the system was off.
* timers.target is the normal target for timer units.
* RHEL 10 documentation includes systemd timer units as a standard scheduling mechanism. ( Red Hat
Documentation )
Explanation:
Solution:
Create timer unit:
cat > /etc/systemd/system/backup-now.timer < < 'EOF'
[Unit]
Description=Daily backup timer
[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true
[Install]
WantedBy=timers.target
EOF
Enable it:
systemctl daemon-reload
systemctl enable --now backup-now.timer
systemctl list-timers --all | grep backup-now
Detailed Explanation:
* OnCalendar=*-*-* 02:00:00 means daily at 02:00.
* Persistent=true runs missed jobs after boot if the system was off.
* timers.target is the normal target for timer units.
* RHEL 10 documentation includes systemd timer units as a standard scheduling mechanism. ( Red Hat
Documentation )

