RHCSA9 dump-1과 비교하여, 신 유형만 정리
Enable IPv4 packet forwarding on ServerB persistently.
answere)
sysctl -a | grep ipv4 | grep forwardsysctl net.ipv4.ip_forward0: disable1: enablevi /etc/sysctl.confnet.ipv4.ip_forward=1
sysctl --loadvalidation
sysctl net.ipv4.ip_forwardOn ServerB, enable IPv6 packet forwarding and ensure the configuration persists after a reboot.
answere)
sysctl -a | grep ipv6 | grep forwardsysctl net.ipv6.conf.all.forwarding0: disable1: enablevi /etc/sysctl.confnet.ipv6.conf.all.forwarding=1
sysctl --loadvalidation
sysctl net.ipv6.conf.all.forwardingWrite a script named /yes-no.sh on ServerB that:
Echoes “that’s nice if the argument is ‘yes’.
Echoes “I am sorry to hear that” if the argument is ‘no’.
Echoes “unknown argument provided” if the argument is anything else.
answere)
vi /yes-no.sh#!/bin/bash
if [[ "$1" = "yes" ]]; then
echo "that's nice"
elif [[ "$1" = "no" ]]; then
echo "I am sorry to hear that"
else
echo "unknown argument provided"
fi
-eq: 정수형 숫자 비교
=: 문자열 비교
validation
cd /./yes-no.sh yes./yes-no.sh no./yes-no.sh testOn ServerB, install the appropriate kernel update. Ensure the following criteria are met:
answere)
dnf update -ydnf update -y kernelrebootvalidation
rpm -q kerneluname -rOn ServerB, copy the file “/etc/fstab” to “/var/tmp”, then do the following:
“/var/tmp/fstab” so that the file is owned by the root user, belongs to the group root, and is not executable by anyone."stewart" can read and write to “/var/tmp/fstab”."kevin" can neither read nor write “/var/tmp/fstab”.answere)
cp -rp /etc/fstab /var/tmpcd /var/tmpchown root.root fstabchmod a-x fstabsetfacl -m u:stewart:rw- fstabsetfacl -m u:kevin:--- fstabman setfacl에서 예문 확인 가능validation
getfacl fstabOn ServerB, optimize the system to run in a virtual machine for the best performance and concurrently tune it for low power consumption, with low power consumption as the priority.
answere)
dnf install -y tunedsystemctl enable --now tunedsystemctl status tunedtuned-adm listtuned-adm profile virtual-guest powersavevirtual-guest, powersave라는 2개의 profile을 적용하는 것validation
tuned-adm actvieConfigure recommended tuned profile
answere)
dnf install -y tunedsystemctl enable --now tunedsystemctl status tunedtuned-adm listtuned-adm recommendtuned-adm profile virtual-guestvirtual-guest가 나올 확률이 높다.validation
tuned-adm activeOn rhel.server.com, set SELinux to “enforcing” mode.
answere)
getenforcevi /etc/selinux/configSELINUX=enforcing
rebootvalidation
getenforceRestrict root login on rhel.server.com.
answere)
vi /etc/ssh/sshd_configPermitRootLogin no
systemctl restart sshdvalidation
ssh root@localhostRun "sleep 100" in the background with a priority value of "30".
answere)
nice -n 10 sleep 100 &priority 값 = nice 값 + 10. 따라서 nice 값은 20이 되어야 한다.-n 10validation
ps -eo pid,comm,ni | grep sleepConfigure ServerB (the NFS client) to automatically mount the share ServerA:/share on the /nfs directory.
answere)
showmount -e serveraservera가 nfs-server로서 외부에 공유(export)하고 있는 볼륨이 있는지 확인-e: exportmkdir /nfsvi /etc/fstabservera:/share /nfs nfs defaults 0 0
mount -avalidation
df -Th On ServerB, build an image named "hello_world" from a Containerfile that installs and configures a web server (httpd) to start automatically by the systemd service (/sbin/init) when the container is running on your host system.
Then run a new container from the "hello_world" image and name it "hello_world_run". The Containerfile should follow these instructions:
ubi8/ubi-init)."Hello World!" Once you connect to it.80.answere)
dnf install -y container-toolspodman search ubi-initvi ContainerfileFROM registry.redhat.io/ubi8/ubi-init
RUN dnf install -y httpd
RUN mkdir -p /var/www/html
RUN echo "Hello World!" > /var/www/html/index.html
RUN systemctl enable httpd
EXPOSE 80
CMD ["/sbin/init"]
CMD ["/sbin/init"] systemd 실행
podman build -t hello_world -f Containerfile .-t: tag-f: file. 현재 디렉토리 기준podman imagespodman run -d \
--name hello_world_run \
--restart=on-failure \
--systemd=always \
-p 80:80 \
hello_world
validation
podman psss -lntp | grep 80curl 0.0.0.0:80On ServerB, prevent all users from using the crontab command except the user tom.
answere)
vi /etc/cron.allowtom
validation
useradd tomcrontab -euseradd testcrontab -eOn rhel.server.com, create a directory hierarchy /V1/V2/V3/, and apply the SELinux context of the /etc directory to the new hierarchy recursively.
answere)
mkdir -p /V1/V2/V3ls -dZ /etcetc_t인 것 확인semanage fcontext -a -t etc_t "/V1(/.*)?"man semanage fcontextrestorecon -Rv /V1validation
ls -dZ /V1ls -dZ /V1/V2ls -dZ /V1/V2/V3On rhel.server.com, install the package zsh which is located on the FTP server ftp://server.example.com under the /pub/updates directory. The FTP server credentials are:
adminadminanswere)
ftp server.example.comadminadmincd /pub/updatesbinarybinary 모드로 변경get zsh.rpmexitrpm -ivh zsh.rpm-i: install-v: verbose-h: 설치 단계를 hash로 표시validation
rpm -qa | grep zsh-q: query-a: allCreate a hard and symbolic link to a file named data.txt. The original file is located in the /home/$USER/ directory. The hard link should be created in the same directory, while the symbolic link should be created in the /var/tmp/ directory.
answere)
cd ~touch data.txtln data.txt hard-linkman lnln -s data.txt /var/tmp/soft-linkvalidation
ls -li ~ls -al /var/tmp