RedHat Red Hat Certified System Administrator - RHCSA - EX200무료 덤프문제 풀어보기
Configure Cron Job
Configure a cron job to automatically execute /usr/bin/echo hello every day at 14:23 for the user harry.
Configure a cron job to automatically execute /usr/bin/echo hello every day at 14:23 for the user harry.
정답:
Solution:
[root@node1 ~]# systemctl status crond
[root@node1 ~]# systemctl enable crond
[root@node1 ~]# crontab -e -u harry
23 14 * * * /usr/bin/echo hello
# Verification
[root@node1 ~]# crontab -l -u harry
[root@node1 ~]# systemctl status crond
[root@node1 ~]# systemctl enable crond
[root@node1 ~]# crontab -e -u harry
23 14 * * * /usr/bin/echo hello
# Verification
[root@node1 ~]# crontab -l -u harry
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.
Configure Container as a Service
As the user "wallah," configure a systemd service for the container:
- Container name: ascii2pdf
- Use the image named pdf created earlier.
- Service name: container-ascii2pdf
- Automatically start the service on system reboot without manual intervention.
- Configure the service to automatically mount /opt/file to /dir1 and /opt/progress to /dir2 in the container upon startup.
As the user "wallah," configure a systemd service for the container:
- Container name: ascii2pdf
- Use the image named pdf created earlier.
- Service name: container-ascii2pdf
- Automatically start the service on system reboot without manual intervention.
- Configure the service to automatically mount /opt/file to /dir1 and /opt/progress to /dir2 in the container upon startup.
정답:
Solution:
# Note: Perform the following operations by SSHing into localhost as the user "wallah"
[root@node1 ~]# ssh wallah@localhost
# Prepare the relevant mapping directories
[wallah@node1 ~]$ sudo mkdir /opt/{file,progress}
[wallah@node1 ~]$ sudo chown wallah:wallah /opt/{file,progress}
# Start the container and map directories
# :Z changes the SELinux security context of the directory to allow container access.
[wallah@node1 ~]$ podman run -d --name ascii2pdf -v /opt/file:/dir1:Z -v /opt/progress:/dir2:Z pdf
[wallah@node1 ~]$ podman ps -a
# Create systemd service file
[wallah@node1 ~]$ mkdir -p ~/.config/systemd/user
[wallah@node1 ~]$ cd ~/.config/systemd/user/
[wallah@node1 ~]$ podman generate systemd -n ascii2pdf -f --new
[wallah@node1 user]$ ll
total 4
-rw-r--r--. 1 wallah wallah 770 Dec 13 01:07 container-ascii2pdf.service
# Stop and remove the existing ascii2pdf container
[wallah@node1 ~]$ podman stop ascii2pdf
[wallah@node1 ~]$ podman rm ascii2pdf
[wallah@node1 ~]$ podman ps -a
# Enable and start the container-ascii2pdf service
[wallah@node1 ~]$ systemctl --user daemon-reload
[wallah@node1 ~]$ systemctl --user enable --now container-ascii2pdf
# Check container status
[wallah@node1 ~]$ systemctl --user status container-ascii2pdf
[wallah@node1 ~]$ podman ps
# On node1, switch to the root user to perform the following operations
# Ensure that the services for the wallah user start automatically at system boot
[root@node1 ~]# loginctl enable-linger
[root@node1 ~]# loginctl show-user wallah
# Check to ensure the container starts on boot (mandatory operation)
[root@node1 ~]# reboot
[root@node1 ~]# ssh wallah@node1
[wallah@node1 ~]# podman ps
# Note: Perform the following operations by SSHing into localhost as the user "wallah"
[root@node1 ~]# ssh wallah@localhost
# Prepare the relevant mapping directories
[wallah@node1 ~]$ sudo mkdir /opt/{file,progress}
[wallah@node1 ~]$ sudo chown wallah:wallah /opt/{file,progress}
# Start the container and map directories
# :Z changes the SELinux security context of the directory to allow container access.
[wallah@node1 ~]$ podman run -d --name ascii2pdf -v /opt/file:/dir1:Z -v /opt/progress:/dir2:Z pdf
[wallah@node1 ~]$ podman ps -a
# Create systemd service file
[wallah@node1 ~]$ mkdir -p ~/.config/systemd/user
[wallah@node1 ~]$ cd ~/.config/systemd/user/
[wallah@node1 ~]$ podman generate systemd -n ascii2pdf -f --new
[wallah@node1 user]$ ll
total 4
-rw-r--r--. 1 wallah wallah 770 Dec 13 01:07 container-ascii2pdf.service
# Stop and remove the existing ascii2pdf container
[wallah@node1 ~]$ podman stop ascii2pdf
[wallah@node1 ~]$ podman rm ascii2pdf
[wallah@node1 ~]$ podman ps -a
# Enable and start the container-ascii2pdf service
[wallah@node1 ~]$ systemctl --user daemon-reload
[wallah@node1 ~]$ systemctl --user enable --now container-ascii2pdf
# Check container status
[wallah@node1 ~]$ systemctl --user status container-ascii2pdf
[wallah@node1 ~]$ podman ps
# On node1, switch to the root user to perform the following operations
# Ensure that the services for the wallah user start automatically at system boot
[root@node1 ~]# loginctl enable-linger
[root@node1 ~]# loginctl show-user wallah
# Check to ensure the container starts on boot (mandatory operation)
[root@node1 ~]# reboot
[root@node1 ~]# ssh wallah@node1
[wallah@node1 ~]# podman ps
Enable periodic TRIM operations for supported file systems.
정답:
See the solution below in Explanation.
Explanation:
Solution:
systemctl enable --now fstrim.timer
systemctl status fstrim.timer
Detailed Explanation:
* fstrim.timer schedules discard of unused blocks.
* This is useful on SSD-backed storage and thin-provisioned environments.
* RHEL 10 storage documentation explicitly documents enabling fstrim.timer. ( Red Hat Documentation )
Explanation:
Solution:
systemctl enable --now fstrim.timer
systemctl status fstrim.timer
Detailed Explanation:
* fstrim.timer schedules discard of unused blocks.
* This is useful on SSD-backed storage and thin-provisioned environments.
* RHEL 10 storage documentation explicitly documents enabling fstrim.timer. ( Red Hat Documentation )
Configure AutoFS so that accessing /shares/projects mounts server1:/srv/nfs/projects.
정답:
See the solution below in Explanation.
Explanation:
Solution:
dnf install -y autofs
mkdir -p /shares
echo "/shares /etc/auto.shares" > > /etc/auto.master
echo "projects -fstype=nfs,rw server1:/srv/nfs/projects" > /etc/auto.shares
systemctl enable --now autofs
ls /shares/projects
Detailed Explanation:
* /etc/auto.master defines the main map.
* /etc/auto.shares defines the indirect mount entry.
* The mount happens on demand when /shares/projects is accessed.
* RHEL 10 file-system documentation includes AutoFS for on-demand mounts. ( Red Hat
Documentation )
Explanation:
Solution:
dnf install -y autofs
mkdir -p /shares
echo "/shares /etc/auto.shares" > > /etc/auto.master
echo "projects -fstype=nfs,rw server1:/srv/nfs/projects" > /etc/auto.shares
systemctl enable --now autofs
ls /shares/projects
Detailed Explanation:
* /etc/auto.master defines the main map.
* /etc/auto.shares defines the indirect mount entry.
* The mount happens on demand when /shares/projects is accessed.
* RHEL 10 file-system documentation includes AutoFS for on-demand mounts. ( Red Hat
Documentation )
Add sudo Permission Configuration
Allow members of the sysmgrs group to use sudo without entering a password.
Allow members of the sysmgrs group to use sudo without entering a password.
정답:
Solution:
[root@node1 ~]# visudo
...
%wheel ALL=(ALL) NOPASSWD: ALL
%sysmgrs ALL=(ALL) NOPASSWD: ALL
# Verification (mandatory operation)
[root@node1 ~]# su - natasha
[natasha@node1 ~]# sudo cat /etc/shadow
[root@node1 ~]# visudo
...
%wheel ALL=(ALL) NOPASSWD: ALL
%sysmgrs ALL=(ALL) NOPASSWD: ALL
# Verification (mandatory operation)
[root@node1 ~]# su - natasha
[natasha@node1 ~]# sudo cat /etc/shadow
Add Swap Partition
Add an additional swap partition of 512 MiB to your system. The swap partition should be automatically mounted at system startup. Do not delete or modify any
existing swap partitions on the system.
Add an additional swap partition of 512 MiB to your system. The swap partition should be automatically mounted at system startup. Do not delete or modify any
existing swap partitions on the system.
정답:
Solution:
[root@node2 ~]# lsblk
[root@node2 ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.
Command (m for help): n
Partition number (3-128, default 3):
First sector (1476608-10485726, default 1476608):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1476608-10485726, default 10485726): +512M
Created a new partition 3 of type 'Linux filesystem' and of size 512 MiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
[root@node2 ~]# mkswap /dev/vdb3
[root@node2 ~]# vim /etc/fstab
/dev/vdb3 swap swap defaults 0 0
[root@node2 ~]# swapon -a
[root@node2 ~]# swapon
NAME TYPE SIZE USED PRIO
/dev/vdb2 partition 243M 0B -2
/dev/vdb3 partition 512M 0B -3
[root@node2 ~]# lsblk
[root@node2 ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.37.4).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.
Command (m for help): n
Partition number (3-128, default 3):
First sector (1476608-10485726, default 1476608):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1476608-10485726, default 10485726): +512M
Created a new partition 3 of type 'Linux filesystem' and of size 512 MiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
[root@node2 ~]# mkswap /dev/vdb3
[root@node2 ~]# vim /etc/fstab
/dev/vdb3 swap swap defaults 0 0
[root@node2 ~]# swapon -a
[root@node2 ~]# swapon
NAME TYPE SIZE USED PRIO
/dev/vdb2 partition 243M 0B -2
/dev/vdb3 partition 512M 0B -3