RHCSA9 New Demo
RHCSA9 New Demo
RHCSA9 New Demo
NOTE: - Two new virtual machines will be given for RHCSA Exam Paper. All perform in your virtual Machine. Your exam code is
EX200. (node1 and node2 machine)
After login to the base machine, you are to see an Activities on base machine in which information regarding (Exam Start) the exam
is given.
There is also an icon on the Activities which is VM View, by clicking which you will be able to access your Virtual Machine.
All perform in your virtual system. DO NOT change the physical machine root password. NO access your physical machine root user.
You can log in as a limited user.
Edit a Connection --> select Wired Connection1 (eth0) --> go to IPV4 CONFIGURATION --> select Manual --> show
OK 🡪 Back 🡪 Activate a Connection 🡪 Deactivate 🡪 Activate 🡪 Back 🡪 Set System Hostname🡪 node1.domain0.example.com 🡪 Ok 🡪
Quit
# ping 172.24.0.110
# ping 172.24.0.254
Q2.) Yum repository configuration on both machines
Ans.
# vim /etc/yum.repos.d/new.repo
[BaseOS]
baseurl = http://content.example.com/rhel8.0/x86_64/dvd/BaseOS
enabled = true
gpgcheck = false
[AppStream]
baseurl = http://content.example.com/rhel8.0/x86_64/dvd/AppStream
enabled = true
gpgcheck = false
:wq!
# yum repolist
3. Debug SE-Linux
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.
ANS
a. The user natasha must configure a cron job that runs daily at 13:30 local time and executes
/bin/echo hello
OR
b. The user natasha must configure a cron job that runs daily at every 3-minute local time
andexecutes /bin/echo hiya
# useradd natasha (to add the user)
# which logger
23 14 * * * /bin/echo “hiya”
:wq
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 atenorth.
Ans. We’re going to create users, group and group membership with following steps-
Step-1. groupadd sysadmin -> This command is simply creating a group “sysadmin” in which no any
member added recently.
Step-2. useradd (username) -> By this command, we’ll create user with given name of user.
Step-3. usermod –aG (group_name) (user_name) -> By this command, we’ll add user into a group as
secondary group of user because when user created then primary or personal group of user
automatically created so another group is treated like secondary group for user. -> In this command, “-
a” option is used for append user with secondary group and “-G” option is used to specify group in
which user will be append and with “-G” option, we specify the group name and at last, we give the
name of user which will be append with secondary group.
Step-4. useradd –s /sbin/nologin (user_name) -> In this command, we’ll create a user with given name
which not have access on interactive shell. -> In this command, “-s” option is used to provide any
required shell to any user.
Step-5. passwd (user_name) -> This command is used to give password to any user.
Group ownership of /common/admin is sysadmin. The directory should be readable, writable, and
accessible to members of sysadmin, but not to any other 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.
Ans. We’re going to create collaborative and also give group ownership and permission for group
members-
Step-1. mkdir –p (path of directory) -> In this command, we’re creating a collaborative directory with
“mkdir” command which is used to make directory. -> In this command, “-p” option is used to make
parent directory of current directory simultaneously. -> With “mkdir” command and “-p” option, we’ll
give directory name with parent directory name like “/common/admin” and both directories will
createsimultaneously.
Step-2. chgrp (group_name) (path of directory) -> This command is used to change group ownership of
any directory.
-> “chmod” command is used to give permission to root, group or any other user. -> In this command,
after “chmod” command first digit which is “2” is used to give special permission which is SGID by which
all files in “/common/admin” directory automatically have group ownership and second digit which is
“7” is used to give read, write and access to root user and third digit which is “7” is used to give read,
write and access to group and last digit which is “0” is used to give no any permission of read, write and
access to any other user. -> At last, we give path of directory on which we want to give permission.
Q8). Configure NTP in your system so that it is an NTP client of classroom.example.com.
# vi /etc/chrony.conf
:wq
# timedatectl
Q9). Find the files in your system which is owned by Simone user & copy all the files on /root/found
directory
Step-1. mkdir (path of new directory) -> By “mkdir” command, We make a new directory where we can
copy all find files.
Step-2. find / -user (user_name) –exec cp –a –rvf {} (path of directory where we want to copy) \; ->
“find” is a command to find any file or directory. -> After the “find” command, we use “/” which means
this command will find the required file in whole system because whole directory or file is made in “/”. -
> After “/”, We use “-user” option which is used to specify the name of user and we’re using this option
when we want to find that files which is owned by any user. -> After specify the user name, we use “–
exec” option by which we can add or join another command with previous command. -> After the “-
exec” option, we use “cp” command for copy all files at given path of directory. In “cp” command, we
use certain following option- -a = This option is used to append command with previous command. -r =
This option is used to copy files recursively. -v = This option is used to print verbose information on
screen means process shows on display. -f = This option is used to copy all files forcefully. -> After all
options, we give path of that directory where we want to copy all file which is find and owned by
specified user.
Step-3. ll (path of that directory where all file copied) -> By this “ll” command, we can cross check that
“find” and “cp” command will do work properly or not.
Q10). Find the string strato from /usr/share/dict/words/file and save the result in /searchfile.
Ans. We’re going to search a particular string from a particular file and store output into specified file
with some following steps-
Step-1. grep ‘strato’ (path of that file in which we want to search string) > (path of that file in which
we want save output) -> “grep” is a command to search specified string in command (eg. ‘strato’) this
string is always written in single quotes(‘ ’) after the command. -> After the “grep” command, We
provide the path of that file in which we want to search string and after this, we use “>”(redirection) to
save output of “grep” command into specified file.
Step-2. vim (path of that file where we save the output of command) -> With use of vim editor, We
can open file in which output will save and cross check the result.
Q11.) Using automounter service mount RemoteuserX onto the provided folder
/ourhome/RemoteuserX
Ans.
Step-1. yum install -y autofs -> By this command, we’re going to install autofs package to configure
remoteuser.
Step-3. vim /etc/auto.misc -> By this command, we open the file which is “auto.misc” in which we
specify the information in below syntax-
Step-4. systemctl start autofs ; systemctl enable autofs -> In this step, First command is used to start
“autofs” service in system. -> Second command is used to enable the “autofs” service by which after the
reboot of system, service will automatic start.
Step-5. su – remoteuserX -> This command is used to switch user and by this command, we can login
on remoteuserX shell prompt and also can verify that remoteuserX is created or not.
Step-6. pwd -> “pwd” command is used to check present working directory and by this command, we
also check that remoteuserX have his home directory or not which is provided by server to remoteuserX.
Create a user barry User id of this user should be 2112 and set password atenorth
ANS
passwd barry
# id –u barry
a group name is 'elite', they have to give administrative permission without password.
# visudo
OR
13. Simple Shell Script
Write a script mysearch to list the contents of /usr that are smaller 10M and set group id (SGID) permission
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
OR
- build an application testapp that prints the message when user1 logged in
"welcome to user1"
1. - using http://server1.net3.example.com/materials/3/Containerfile
1:- Just restart your virtual machine (Click on Ctrl + Alt + Delete button)
2:- Press space bar key (to stop the GRUB line)
3:- select 2nd line press "e" (to edit the grub)
5:- just give space and type rd.break (type the command)
# chroot /sysroot
# touch /.autorelabel
# exit
# exit
Q2.) Yum repository configuration on both machines
Ans.
# vim /etc/yum.repos.d/new.repo
[BaseOS]
baseurl = http://content.example.com/rhel8.0/x86_64/dvd/BaseOS
enabled = true
gpgcheck = false
[AppStream]
baseurl = http://content.example.com/rhel8.0/x86_64/dvd/AppStream
enabled = true
gpgcheck = false
:wq!
# yum repolist
Q3). Set a recommended tuning profile for your system. (Profile already available)
Use the systemctl is-enabled tuned command to display the tuned service enablement state
# tuned-adm list
# tuned-adm recomended
# tuned-adm active
Q4). Create a SWAP partition of 250 megabyte and make available at next reboot. Partition already
available.
# fdisk -l
Select Free space 🡪 Partition size 512M 🡪 select Type 🡪 select 82 (Linux swap) 🡪 write 🡪 Are you sure? 🡪 yes 🡪 Quit
# vim /etc/fsatb
:wq
Q5). Create the volume group with name myvol with 8 MiB P.E. and create the lvm name mydatabase
with the 50 P.E. and format this lvm with vfat and create a directory /database and mount this lvm
permanently on /database.
# cfdisk /dev/vda
Select Free space 🡪 Enter on New 🡪 Enter (full size) 🡪 select Type 🡪 select 8e (Linux LVM) 🡪 write 🡪 Are you sure? 🡪 yes 🡪
Quit
# pvcreate /dev/vda5
# mkfs.vfat /dev/datastore/database
# mkdir /mnt/database
# vim /etc/fstab
:wq
# mount -a
# df –hT
Q6). Resize the Lvm partition "home" to 150MiB.
Ans. We’re going to resize the LVM partition with some following steps-
Step-1. lvdisplay -> “lvdisplay” command is used to show the created LVM partition by which we can
see the details of created LVM partitions.
Step-3. resize2fs (path_of_LVM_partition) -> “resize2fs” command is used to resize the ext2/ext3/ext4
file system after extend the size of LVM partition. It’s used to enlarge or shrink a mounted or
unmounted file system located in system.
Step-4. lvremove (path_of_LVM_partition) -> “lvremove” is used to remove any created LVM partition
and after this command, we give path of LVM partition which we want to remove.