RedHat Red Hat Certified System Administrator - RHCSA (EX200日本語版) (EX200日本語) Free Practice Test
Question 1
HTTPサービスを永続的に許可するようファイアウォールルールを設定してください。
Correct Answer:
See the solution below in Explanation.
Explanation:
Solution:
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
firewall-cmd --list-services
Detailed Explanation:
* --permanent saves the rule.
* --reload applies it.
* --list-services verifies the active configuration.
* Firewalld remains the standard firewall interface in RHEL 10. ( Red Hat Documentation )
Explanation:
Solution:
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
firewall-cmd --list-services
Detailed Explanation:
* --permanent saves the rule.
* --reload applies it.
* --list-services verifies the active configuration.
* Firewalld remains the standard firewall interface in RHEL 10. ( Red Hat Documentation )
Question 2
ops グループのメンバーに対して、/usr/bin/systemctl restart httpd のみを実行できるように、パスワードなしの sudo アクセスを設定します。
Correct Answer:
See the solution below in Explanation.
Explanation:
Solution:
groupadd ops
visudo -f /etc/sudoers.d/ops-restart-httpd
Add this line to the file:
%ops ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart httpd
Set correct permissions:
chmod 440 /etc/sudoers.d/ops-restart-httpd
visudo -cf /etc/sudoers.d/ops-restart-httpd
Detailed Explanation:
* Using /etc/sudoers.d/ is the standard safe approach.
* visudo validates syntax and helps prevent syntax errors.
* %ops applies the rule to the whole group.
* Restricting the exact command is better than granting broad sudo access. Red Hat's RHEL 10 security
hardening guide documents sudo configuration through sudoers. ( Red Hat Documentation )
Explanation:
Solution:
groupadd ops
visudo -f /etc/sudoers.d/ops-restart-httpd
Add this line to the file:
%ops ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart httpd
Set correct permissions:
chmod 440 /etc/sudoers.d/ops-restart-httpd
visudo -cf /etc/sudoers.d/ops-restart-httpd
Detailed Explanation:
* Using /etc/sudoers.d/ is the standard safe approach.
* visudo validates syntax and helps prevent syntax errors.
* %ops applies the rule to the whole group.
* Restricting the exact command is better than granting broad sudo access. Red Hat's RHEL 10 security
hardening guide documents sudo configuration through sudoers. ( Red Hat Documentation )
Question 3
/usr/local/bin/backup-now.sh を実行する backup-now.service という名前の systemd サービスを作成します。
Correct Answer:
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 )
Question 4
/etc の圧縮アーカイブを作成し、そのファイルの種類を確認してください。
Correct Answer:
See the solution below in Explanation.
Explanation:
Solution:
tar -zvcf /root/etc_backup.tar.gz /etc
file /root/etc_backup.tar.gz
Detailed Explanation:
* tar creates the archive.
* -z uses gzip compression.
* -v is verbose.
* -c creates the archive.
* -f names the output file.
* file confirms the resulting archive type.
Explanation:
Solution:
tar -zvcf /root/etc_backup.tar.gz /etc
file /root/etc_backup.tar.gz
Detailed Explanation:
* tar creates the archive.
* -z uses gzip compression.
* -v is verbose.
* -c creates the archive.
* -f names the output file.
* file confirms the resulting archive type.
Question 5
ファイルを探す
ユーザー「jacques」に属するすべてのファイルを検索し、それらをルートディレクトリの下にあるディレクトリ /root/findfiles に移動します。
ユーザー「jacques」に属するすべてのファイルを検索し、それらをルートディレクトリの下にあるディレクトリ /root/findfiles に移動します。
Correct Answer:
Solution:
[root@node1 ~]# mkdir /root/findfiles
[root@node1 ~]# find / -user jacques
[root@node1 ~]# find / -user jacques -exec cp -a {} /root/findfiles \;
# Verification
[root@node1 ~]# ll /root/findfiles/
[root@node1 ~]# mkdir /root/findfiles
[root@node1 ~]# find / -user jacques
[root@node1 ~]# find / -user jacques -exec cp -a {} /root/findfiles \;
# Verification
[root@node1 ~]# ll /root/findfiles/
Question 6
共同ディレクトリを作成する
以下の特性を持つ共有ディレクトリ /home/managers を作成します。
- /home/managers のグループ所有者は sysmgrs です。
- ディレクトリは sysmgrs グループのメンバーに対して読み取り、書き込み、実行可能である必要がありますが、他のユーザーには読み取りまたは書き込み権限を与えてはいけません。
(もちろん、rootユーザーはすべてのファイルとフォルダにアクセスできます。)
- /home/managers 内に作成されたファイルはすべて、sysmgrs グループに設定されたグループ所有権を自動的に継承する必要があります。
以下の特性を持つ共有ディレクトリ /home/managers を作成します。
- /home/managers のグループ所有者は sysmgrs です。
- ディレクトリは sysmgrs グループのメンバーに対して読み取り、書き込み、実行可能である必要がありますが、他のユーザーには読み取りまたは書き込み権限を与えてはいけません。
(もちろん、rootユーザーはすべてのファイルとフォルダにアクセスできます。)
- /home/managers 内に作成されたファイルはすべて、sysmgrs グループに設定されたグループ所有権を自動的に継承する必要があります。
Correct Answer:
Solution:
[root@node1 ~]# mkdir /home/managers
[root@node1 ~]# chgrp sysmgrs /home/managers
[root@node1 ~]# chmod 2770 /home/managers
# Verification
[root@node1 ~]# ll -d /home/managers
[root@node1 ~]# mkdir /home/managers
[root@node1 ~]# chgrp sysmgrs /home/managers
[root@node1 ~]# chmod 2770 /home/managers
# Verification
[root@node1 ~]# ll -d /home/managers
Question 7
論理ボリュームを作成する
指定された要件に従って、新しい論理ボリュームを作成します。
- ボリュームグループ「myvg」に属する「mylv」という名前の論理ボリューム。サイズは50エクステント。
- ボリュームグループ「myvg」内の論理ボリュームのエクステントサイズは16 MiBである必要があります。
- 新しい論理ボリュームをVFATファイルシステムでフォーマットします。
- 論理ボリュームは、システム起動時に/mnt/mydataに自動的にマウントされる必要があります。
指定された要件に従って、新しい論理ボリュームを作成します。
- ボリュームグループ「myvg」に属する「mylv」という名前の論理ボリューム。サイズは50エクステント。
- ボリュームグループ「myvg」内の論理ボリュームのエクステントサイズは16 MiBである必要があります。
- 新しい論理ボリュームをVFATファイルシステムでフォーマットします。
- 論理ボリュームは、システム起動時に/mnt/mydataに自動的にマウントされる必要があります。
Correct Answer:
Solution:
# Check the disk layout
[root@node2 ~]# lsblk
# Partition the disk
[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.
Command (m for help): n # Add a new partition
Partition type
p primary (1 primary, 0 extended, 3 free) # Primary partition
e extended (container for logical partitions) # Extended partition
Select (default p): p
Partition number (2-4, default 2): # Press Enter
First sector (1026048-20971519, default 1026048): # Press Enter
***Note: The partition size must be larger than the total size, it should not be exactly equal to. It is recommended to add an extra 200M.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1026048-20971519, default 20971519): +1200M # Partition size
Created a new partition 2 of type 'Linux' and of size 512 MiB.
Command (m for help): w # Save and exit
The partition table has been altered.
Syncing disks.
# Create volume group and logical volume
[root@node2 ~]# vgcreate -s 16M myvg /dev/vdb4
[root@node2 ~]# lvcreate -l 50 -n mylv myvg
# Install vfat support
[root@node2 ~]# yum provides */mkfs.vfat
[root@node2 ~]# yum -y install dosfstools
# Format the logical volume with vfat filesystem
[root@node2 ~]# mkfs.vfat /dev/myvg/mylv
# Create mount point
[root@node2 ~]# mkdir /mnt/mydata
# Update /etc/fstab for automatic mounting
[root@node2 ~]# vim /etc/fstab
/dev/myvg/mylv /mnt/mydata vfat defaults 0 0
# Mount the logical volume
[root@node2 ~]# mount -a
# Check the disk layout
[root@node2 ~]# lsblk
# Partition the disk
[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.
Command (m for help): n # Add a new partition
Partition type
p primary (1 primary, 0 extended, 3 free) # Primary partition
e extended (container for logical partitions) # Extended partition
Select (default p): p
Partition number (2-4, default 2): # Press Enter
First sector (1026048-20971519, default 1026048): # Press Enter
***Note: The partition size must be larger than the total size, it should not be exactly equal to. It is recommended to add an extra 200M.
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1026048-20971519, default 20971519): +1200M # Partition size
Created a new partition 2 of type 'Linux' and of size 512 MiB.
Command (m for help): w # Save and exit
The partition table has been altered.
Syncing disks.
# Create volume group and logical volume
[root@node2 ~]# vgcreate -s 16M myvg /dev/vdb4
[root@node2 ~]# lvcreate -l 50 -n mylv myvg
# Install vfat support
[root@node2 ~]# yum provides */mkfs.vfat
[root@node2 ~]# yum -y install dosfstools
# Format the logical volume with vfat filesystem
[root@node2 ~]# mkfs.vfat /dev/myvg/mylv
# Create mount point
[root@node2 ~]# mkdir /mnt/mydata
# Update /etc/fstab for automatic mounting
[root@node2 ~]# vim /etc/fstab
/dev/myvg/mylv /mnt/mydata vfat defaults 0 0
# Mount the logical volume
[root@node2 ~]# mount -a