최신RedHat Red Hat Certified System Administrator - RHCSA - EX200무료샘플문제
문제1
Create /share/projects, make alex the owner, and configure the sticky bit so users cannot delete each other's files.
Create /share/projects, make alex the owner, and configure the sticky bit so users cannot delete each other's files.
정답:
See the solution below in Explanation.
Explanation:
Solution:
mkdir -p /share/projects
chown alex /share/projects/
chmod a+rwx,+t /share/projects/
ls -ld /share/projects/
Detailed Explanation:
* chmod a+rwx gives read, write, and execute to everyone.
* +t sets the sticky bit.
* Sticky bit on a shared directory means users can create files, but only the file owner, directory owner, or
root can delete them.
* This is the same model used on /tmp.
Explanation:
Solution:
mkdir -p /share/projects
chown alex /share/projects/
chmod a+rwx,+t /share/projects/
ls -ld /share/projects/
Detailed Explanation:
* chmod a+rwx gives read, write, and execute to everyone.
* +t sets the sticky bit.
* Sticky bit on a shared directory means users can create files, but only the file owner, directory owner, or
root can delete them.
* This is the same model used on /tmp.
문제2
Debugging SELinux
A web server running on non-standard port 82 encounters issues while serving content. Debug and resolve the problem to meet the following conditions:
- The web server on the system can serve HTML files hosted in /var/www/html (Note: Do not delete or modify existing file contents)
- The web server can serve content on port 82
- The web server can start automatically at system boot
Debugging SELinux
A web server running on non-standard port 82 encounters issues while serving content. Debug and resolve the problem to meet the following conditions:
- The web server on the system can serve HTML files hosted in /var/www/html (Note: Do not delete or modify existing file contents)
- The web server can serve content on port 82
- The web server can start automatically at system boot
정답:
Solution:
# Check which package provides the semanage command
[root@node1 ~]# yum provides "*/semanage"
# Install the semanage command
[root@node1 ~]# yum -y install policycoreutils-python-utils
[root@node1 ~]# semanage port -l |grep http
[root@node1 ~]# semanage port -a -t http_port_t -p tcp 82
# Alternatively, you can use man semanage port, then search for EXAMPLE.
[root@node1 ~]# systemctl restart httpd
[root@node1 ~]# systemctl enable httpd
# Verification, seeing the source code indicates correctness (mandatory operation)
[root@node1 ~]# curl http://node1.domain250.example.com:82
# Check which package provides the semanage command
[root@node1 ~]# yum provides "*/semanage"
# Install the semanage command
[root@node1 ~]# yum -y install policycoreutils-python-utils
[root@node1 ~]# semanage port -l |grep http
[root@node1 ~]# semanage port -a -t http_port_t -p tcp 82
# Alternatively, you can use man semanage port, then search for EXAMPLE.
[root@node1 ~]# systemctl restart httpd
[root@node1 ~]# systemctl enable httpd
# Verification, seeing the source code indicates correctness (mandatory operation)
[root@node1 ~]# curl http://node1.domain250.example.com:82
문제3
Extend swap by 400 MB using a new partition and make it persistent.
Extend swap by 400 MB using a new partition and make it persistent.
정답:
See the solution below in Explanation.
Explanation:
Solution:
* Create the swap partition:
fdisk /dev/sdb
partprobe /dev/sdb
* Format it for swap:
mkswap /dev/sdb2
* Enable it:
swapon /dev/sdb2
* Persist it in /etc/fstab:
echo "/dev/sdb2 swap swap defaults 0 0" > > /etc/fstab
* Verify:
swapon --show
Detailed Explanation:
* mkswap prepares the partition as swap space.
* swapon activates it immediately.
* Adding an /etc/fstab entry ensures it survives reboot.
* The lab uses a partition-based swap workflow.
Explanation:
Solution:
* Create the swap partition:
fdisk /dev/sdb
partprobe /dev/sdb
* Format it for swap:
mkswap /dev/sdb2
* Enable it:
swapon /dev/sdb2
* Persist it in /etc/fstab:
echo "/dev/sdb2 swap swap defaults 0 0" > > /etc/fstab
* Verify:
swapon --show
Detailed Explanation:
* mkswap prepares the partition as swap space.
* swapon activates it immediately.
* Adding an /etc/fstab entry ensures it survives reboot.
* The lab uses a partition-based swap workflow.
문제4
Configure autofs
Configure autofs to automatically mount the home directory of a remote user as described below:
- materials.example.com (172.25.254.254) exports /rhome via NFS to your system. This filesystem contains a pre-configured home directory for the user
remoteuser1.
- The home directory of remoteuser1 is materials.example.com:/rhome/remoteuser1.
- The home directory of remoteuser1 should be automatically mounted locally at /rhome/remoteuser1.
- The home directory must be writable by the user.
- The password for remoteuser1 is "flectrag".
Configure autofs
Configure autofs to automatically mount the home directory of a remote user as described below:
- materials.example.com (172.25.254.254) exports /rhome via NFS to your system. This filesystem contains a pre-configured home directory for the user
remoteuser1.
- The home directory of remoteuser1 is materials.example.com:/rhome/remoteuser1.
- The home directory of remoteuser1 should be automatically mounted locally at /rhome/remoteuser1.
- The home directory must be writable by the user.
- The password for remoteuser1 is "flectrag".
정답:
Solution:
# Preparations (not required for the exam)
# Go back to foundation0, remote into classroom, create the remoteuser1 user and directory.
# This step is necessary to avoid issues with autofs mounting during testing.
[kiosk@foundation0 ~]$ ssh root@classroom 'useradd -u 1010 remoteuser1 && mkdir -p /rhome/remoteuser1 && chown remoteuser1: /rhome/remoteuser1'
# Install nfs-utils and autofs
[root@node1 ~]# yum -y install nfs-utils autofs
[root@node1 ~]# vim /etc/auto.master
/rhome /etc/auto.rhome
[root@node1 ~]# vim /etc/auto.rhome
remoteuser1 -rw materials.example.com:/rhome/remoteuser1
[root@node1 ~]# systemctl enable --now autofs
# Verification
[root@node1 ~]# ll /rhome/
[root@node1 ~]# ssh remoteuser1@localhost
remoteuser1@localhost\'s password: `flectrag`
$ pwd
/rhome/remoteuser1
$ touch my.file
$ mount | grep rhome
...
materials.example.com:/rhome/remoteuser1 on /rhome/remoteuser1 type nfs4
(`rw`,relatime,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.25.250.100,local_lock=none,addr=1
72.25.254.254)
# Preparations (not required for the exam)
# Go back to foundation0, remote into classroom, create the remoteuser1 user and directory.
# This step is necessary to avoid issues with autofs mounting during testing.
[kiosk@foundation0 ~]$ ssh root@classroom 'useradd -u 1010 remoteuser1 && mkdir -p /rhome/remoteuser1 && chown remoteuser1: /rhome/remoteuser1'
# Install nfs-utils and autofs
[root@node1 ~]# yum -y install nfs-utils autofs
[root@node1 ~]# vim /etc/auto.master
/rhome /etc/auto.rhome
[root@node1 ~]# vim /etc/auto.rhome
remoteuser1 -rw materials.example.com:/rhome/remoteuser1
[root@node1 ~]# systemctl enable --now autofs
# Verification
[root@node1 ~]# ll /rhome/
[root@node1 ~]# ssh remoteuser1@localhost
remoteuser1@localhost\'s password: `flectrag`
$ pwd
/rhome/remoteuser1
$ touch my.file
$ mount | grep rhome
...
materials.example.com:/rhome/remoteuser1 on /rhome/remoteuser1 type nfs4
(`rw`,relatime,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.25.250.100,local_lock=none,addr=1
72.25.254.254)
문제5
Configure a restrictive umask for user natasha so new files become 400 and directories become 500.
Configure a restrictive umask for user natasha so new files become 400 and directories become 500.
정답:
See the solution below in Explanation.
Explanation:
Solution:
echo "umask 0277" > > /home/natasha/.bash_profile
Detailed Explanation:
* A umask of 0277 removes group and other permissions entirely.
* New files: base 666 minus mask 277 gives 400.
* New directories: base 777 minus mask 277 gives 500.
* Putting it in .bash_profile applies it for that user's login shell.
Explanation:
Solution:
echo "umask 0277" > > /home/natasha/.bash_profile
Detailed Explanation:
* A umask of 0277 removes group and other permissions entirely.
* New files: base 666 minus mask 277 gives 400.
* New directories: base 777 minus mask 277 gives 500.
* Putting it in .bash_profile applies it for that user's login shell.
문제6
Configure Your System to Use Default Repositories
The YUM repositories are available at http://content/rhel9.0/x86_64/dvd/BaseOS and http://content/rhel9.0/x86_64/dvd/AppStream. Configure your system to use
these locations as the default repositories.
Configure Your System to Use Default Repositories
The YUM repositories are available at http://content/rhel9.0/x86_64/dvd/BaseOS and http://content/rhel9.0/x86_64/dvd/AppStream. Configure your system to use
these locations as the default repositories.
정답:
Solution:
Method 1:
# Copy the yum configuration file from node1.
[root@node2 ~]# scp root@node1:/etc/yum.repos.d/rhcsa.repo /etc/yum.repos.d/
Method 2:
[root@node2 ~]# vim /etc/yum.repos.d/rhcsa.repo
[Base]
name=Base
baseurl=http://content/rhel9.0/x86_64/dvd/BaseOS
enabled=1
gpgcheck=no
[App]
name=App
baseurl=http://content/rhel9.0/x86_64/dvd/AppStream
enabled=1
gpgcheck=no
# Verification
[root@node2 ~]# yum repoinfo
[root@node2 ~]# yum -y install ftp
Method 1:
# Copy the yum configuration file from node1.
[root@node2 ~]# scp root@node1:/etc/yum.repos.d/rhcsa.repo /etc/yum.repos.d/
Method 2:
[root@node2 ~]# vim /etc/yum.repos.d/rhcsa.repo
[Base]
name=Base
baseurl=http://content/rhel9.0/x86_64/dvd/BaseOS
enabled=1
gpgcheck=no
[App]
name=App
baseurl=http://content/rhel9.0/x86_64/dvd/AppStream
enabled=1
gpgcheck=no
# Verification
[root@node2 ~]# yum repoinfo
[root@node2 ~]# yum -y install ftp
문제7
Find files in /usr/local larger than 3 KB and smaller than 5 KB, copy them to /root/d1, and set SGID on the target directory.
Find files in /usr/local larger than 3 KB and smaller than 5 KB, copy them to /root/d1, and set SGID on the target directory.
정답:
See the solution below in Explanation.
Explanation:
Solution:
mkdir -p /root/d1
find /usr/local -type f -size +3k -size -5k -exec cp -rvf {} /root/d1/ \;
chmod g+s /root/d1
ls -ld /root/d1
Detailed Explanation:
* -size +3k means greater than 3 KB.
* -size -5k means less than 5 KB.
* chmod g+s sets the SGID bit on the directory.
* SGID on a directory causes new files created there to inherit the directory's group.
Explanation:
Solution:
mkdir -p /root/d1
find /usr/local -type f -size +3k -size -5k -exec cp -rvf {} /root/d1/ \;
chmod g+s /root/d1
ls -ld /root/d1
Detailed Explanation:
* -size +3k means greater than 3 KB.
* -size -5k means less than 5 KB.
* chmod g+s sets the SGID bit on the directory.
* SGID on a directory causes new files created there to inherit the directory's group.