RHCSA Exam Dump Paper
RHCSA Exam Dump Paper
setup an IP address for the Primary virtual machine. IP address172.25.1.11 subnet mask 255.255.255.0 Default
gateway 172.25.1.254 nameserver172.25.254.254 and hostname as primary.net1.example.com
Answer-1:
# hostnamectl set-hostname “primary.net1.example.com”
# exec bash
-----------------------------------------------------------------------------------------------------------------------------------------
Question -2:
Yum repository configuration on both machines Node1 & Node 2 :
✓ AppStream : "mirror.stream.centos.org/9-stream/AppStream",
✓ BaseOS: mirror.stream.centos.org/9-stream/BaseOS
Answer-2:
# vim /etc/yum.repos.d/onlne.repo
[AppStream]
name=”AppStream repo”
gpgcheck=0
enabled=1
baseurl= mirror.stream.centos.org/9-stream/AppStream
[BaseOS]
name=”BaseOS repo”
gpgcheck=0
enabled=1
baseurl= mirror.stream.centos.org/9-stream/BaseOS
# yum repoinfo
# yum repolist all
-----------------------------------------------------------------------------------------------------------------------------------------
Question -3:
http service serve non-standard 82 port for your machine, the system is not able to connect to httpd service at port
82, fix the debug issue, to store the HTML files under /var/www/html directory don’t have change to it. it should
be accessible at port 82 and should start at boot time.
Answer-3:
# rpm -q httpd
# yum install -y httpd
# firewall-cmd --permanent --add-port=82/tcp
# firewall-cmd --reload
# man semanage port
# semanage port -a -t http_port_t -p tcp 82
# cat /etc/httpd/conf/httpd.conf | grep “Listen ”
# systemctl enable --now httpd
# curl http://localhost:82
-----------------------------------------------------------------------------------------------------------------------------------------
Question -4 :
Configure a cron job on Primary machine. (a.) The user natasha must configure a cron job that runs daily at 14:23
local time and executes /bin/echo hiya.
Answer-4 :
# id natasha
# useradd natasha
# crontab -eu natasha
23 14 * * * /bin/echo “hiya”
Answer-4.1 :
# id natasha
# useradd natasha
# crontab -eu natasha
23 14 * * * /bin/echo “hiya”
Answer-4.2 :
# id natasha
# useradd natasha
# crontab -eu natasha
*/3 * * * * /usr/bin/logger “EX403”
Answer-5:
# yum install tuned
# systemctl is-enabled tuned enabled
# tuned-adm list
# tuned-adm recommend
# tuned-adm profile <profile-name>
# tuned-adm active
-------------------------------------------------------------------------------------------------------------------------------------------
Question -6:
Create the following users, groups, and group memberships: - A group named sysadmin. A user natasha who
belongs to sysadmin as a secondary group. A user sarah who also belongs to sysadmin as a secondary group. A user
harry who does not have access to an interactive shell on the system, and who is not a member of sysadmin.
Natasha, Sarah and Harry should all have the password of thuctive.
Answer-6:
# groupadd sysadmin
# useradd natasha
# usermod -aG sysadmin natasha
# id natasha
# useradd sarah
# usermod -aG sysadmin sarah
# id sarah
# useradd -s /sbin/nologin harry
# passwd natasha
# passwd sarah
# passwd harry
# tail /etc/passwd | grep harry
-----------------------------------------------------------------------------------------------------------------------------------------
Question -7:
Create a collaborative directory “/common/admin” with the following characteristics: Group ownership of
/common/admin is sysadmin. The directory should be readable, writable, and accessible to members of sysadmin,
but not to another user. (It is understood that root has access to all files and directories on the system.) Files created
in /common/admin automatically have group ownership set to the sysadmin group.
Answer-7 :
# mkdir -p /common/admin
# chgrp sysadmin /common/admin
# chown 2770 /common/admin
# touch /common/admin/sample_file
# ls -al /common/admin/
-----------------------------------------------------------------------------------------------------------------------------------------
Question -8:
Configure NTP in your system so that it is an NTP client of classroom.example.com. your new NTP server is running
on "utility.domain0.example.com"
Answer-8:
# vim /etc/chrony.conf
#Comment the line no. 3 of starting with the pool.
#pool 2.rhel.pool.ntp.org iburst
server utility.domain0.example.com iburst
Answer-9:
# id simone
# mkdir -p /root/found
# find / -user simone -exec cp -arvf {} /root/found \;
# ls -al /root/found/
-----------------------------------------------------------------------------------------------------------------------------------------
Question -10:
Find the string strato from /usr/share/dict/words file and save the result in /searchfile.
Answer-10:
# grep “strato” /usr/share/dict/words > /searchfile
# cat /searchfile
-----------------------------------------------------------------------------------------------------------------------------------------
Question -11:
Using automounter service mount RemoteuserX onto the provided folder /home/RemoteuserX. (nfs server ip &
Domain name will provide you)
Answer-11:
# rpm -q autofs
# yum install -y autofs
# vim /etc/auto.master.d/abc.autofs
/- /etc/auto.misc
# vim /etc/auto.misc
Question-12:
Write a script mysearch to list the contents of /usr that are below 10Mib,and sgid permission on it. The script should
be present in /usr/local/bin. After execution, the script should automatically write all the lines and save It to
/root/lines.
Answer-12:
# vim /usr/local/bin/mysearch
#!/bin/bash
find /usr -size -10M -perm /g=s > /root/lines
Answer-13:
# vim /usr/local/bin/mysearch
#!/bin/bash
find /usr -size +2M -size -10M -perm /u=s > /root/lines
Answer-14:
# useradd -u 2112 barry
# id barry
# password barry
-----------------------------------------------------------------------------------------------------------------------------------------
Question -15:
Set sudo privilege: a group name is 'elite', they have to give administrative permission without the password
"Atenorth".
Answer-15:
# cat /etc/group | grep “elite”
# visudo
%elite ALL=(ALL) NOPASSWD:ALL
-----------------------------------------------------------------------------------------------------------------------------------------
Question -16:
First step is to crack password of Secondary Machine. Set password "Ventyol". (Note: Use Rescue kernel Mode )
Answer-16:
Stop booting process by "e" and then Find "linux16" line. At last of the line type "rd.break" and then press "Ctrl -x"
mount -o remount,rw /sysroot
chroot /sysroot
passwd root
touch /.autorelabel
exit
exit
-----------------------------------------------------------------------------------------------------------------------------------------
Question -17: (Remember All partitions relation questions will be using single drive ex: /dev/sdb)
Create a SWAP partition of 250 megabyte and make available at next reboot. Partition already available.
Answer- 17:
# lsblk
# fdisk /dev/sda
Press: “n”
Give Size of the volume with last sector: +250M
Press: “t”
Press “L”-------q → Swap=19
Press: “w”
# lsblk
# mkswap /dev/sda1
# vim /etc/fstab
/dev/sda1 none swap defaults 0 0
# mount -a
# free -h
# swapon -a
# free -h
-----------------------------------------------------------------------------------------------------------------------------------------
Question -18:
Create the volume group with name myvol with 8 MiB P.E. and create the lvm name mydatabase with the 100 P.E.
and format this lvm with vfat and create a directory /database and mount this lvm permanently on /database.
Answer- 18:
# lsblk
# fdisk /dev/sdb
Press: “n”
Give Size of the volume with last sector: +850M
Press: “t”
Press “L”---------q→ Linux lvm = 30
Press: “w”
# lsblk
# pvcreate /dev/sdb1
# pvdisplay
# vgcreate -s 8M myvol /dev/sdb1
# vgdisplay
# lvcreate -l 100 -n mydatabase myvol
# mkfs.vfat /dev/myvol/mydatabase
# mkdir /database
# vim /etc/fstab
/dev/myvol/mydatabase /database vfat defaults 0 0
# mount /database
# lsblk
# df -h
-----------------------------------------------------------------------------------------------------------------------------------------
Question -19:
Resize the lvm partition "home" to 150MiB. (A lvm partition named “home” given to you in the exam with vol
100MiB)
Answer-19:
# lsblk
# lvextend -r -L 150M home
# lsblk
-----------------------------------------------------------------------------------------------------------------------------------------
Question-20:
Create a backup.tar.(bz2 or gz or xz) of /etc directory in /home location.
Answer-20:
# man tar
# tar -cJvf /home/backup.tar.xz /etc
# ls -al /home
-----------------------------------------------------------------------------------------------------------------------------------------
Question-20.1:
Create a backup.tar.(bz2 or gz or xz) of /etc directory in /home location. Note: (Don’t use special compression
methods with tar -cvf)
Answer-20.1:
# man tar
# tar -cvf /home/backup.tar /etc
# xz /home/backup.tar
# bzip2 /home/backup.tar
# gzip /home/backup.tar
# yum whatprovides xz
# yum install -y xz
# ls -al /home
-----------------------------------------------------------------------------------------------------------------------------------------
Question-21:
Build an application testapp that prints the message when user1 logged in “Welcome to user1”.
Answer-21:
# id user1
# which testapp
# cat /usr/bin/testapp
#!/bin/bash
if [ -f ~/.testapp/testapp.conf ]
then
cat ~/.testapp/testapp.conf
else
echo "There Is No Message For You Dude"
fi
# cd /home/user1
# mkdir .testapp
# vim .testapp/testapp.conf
Welcome to user1
# su - user1
user1: ~$ testapp
-----------------------------------------------------------------------------------------------------------------------------------------
Question - 22:
Create a container on node1 as andrew user:-
Containerfile: https://raw.githubusercontent.com/sameer09694/Text-To-PDF/master/Single \ ContainerFile/Containerfile” .
And Build the container image name is watcher. Don't change the Containerfile content.
Answer-22:
# id andrew
# ssh andrew@localhost
$ hostname
$ whoami
$ wget https://raw.githubusercontent.com/sameer09694/Text-To-PDF/master/SingleContainerFile/Containerfile
$ ls -al
$ podman image build . -t watcher
$ podman image ls
-----------------------------------------------------------------------------------------------------------------------------------------
Question - 23:
Create a container using an image which you created somewhere in exam:
• create a container using andrew user and container name should be “merger”.
• container should run as a systemd service, so configure as a service name container-merger.service.
• container should run at boot time.
• container name should be merger.
• mount /opt/files directory to /opt/incoming in container and /opt/processes to /opt/outgoing in container this
container will convert ascii test file into pdf format, so when you create simple file in /opt/files then container will
automatically convert that file into pdf and save /opt/processed.
Answer-23:
# mkdir -p /opt/processes
# mkdir -p /opt/files
# chown andrew:andrew /opt/processes
# chown andrew:andrew /opt/files
# ssh andrew@localhost
Answer-24:
# vim /etc/yum.repos.d/onlne.repo
[AppStream]
name=”AppStream repo”
gpgcheck=0
enabled=1
baseurl= mirror.stream.centos.org/9-stream/AppStream
[BaseOS]
name=”BaseOS repo”
gpgcheck=0
enabled=1
baseurl= mirror.stream.centos.org/9-stream/BaseOS
# yum repoinfo
# yum repolist all
-----------------------------------------------------------------------------------------------------------------------------------------