Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

RHCSA9 New Demo

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

RHCSA(EX200) EXAM-PAPER

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.

Q1.) setup an ip address for Primary virtual machine.

ip addr 172.25.X.11 subnet mask 255.255.255.0 Default gateway 172.25.X.254 nameserver


172.25.254.254 and hostname as primary.netX.example.com.

Ans. Network Configurations

# nmtui (for set the IP address)

Edit a Connection --> select Wired Connection1 (eth0) --> go to IPV4 CONFIGURATION --> select Manual --> show

Enter on Add Addresses = 172.24.0.110/24


Gateway = 172.24.0.254
DNS = 172.24.0.254

OK 🡪 Back 🡪 Activate a Connection 🡪 Deactivate 🡪 Activate 🡪 Back 🡪 Set System Hostname🡪 node1.domain0.example.com 🡪 Ok 🡪
Quit

# ip add [to show IP address]

# hostaname [to show hostname]

# 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

# semanage port –a –t http_port_t –p tcp 82 (add port on SE-Linux policy)#

systemctl restart httpd

# systemctl enable httpd

Q4.) Configure a cron job on Primary machine

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

# crontab -e -u natasha (to add the following line)

23 14 * * * /bin/echo “hiya”

*/2 * * * * /usr/bin/logger “EX200 Exam”

:wq

# systemctl restart crond (to restart the service)


# systemctl enable crond (to enable the service)
# crontab -l -u natasha (to check)

Q5.) 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 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.

Q6). 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 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.

Step-3. chmod 2770 (path of 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

Comment the line no. 3 of starting with the pool.

# pool 2.rhel.pool.ntp.org iburst (comment this line)

server utility.domain0.example.com iburst (add the line)

:wq

# systemctl restart chronyd

# systemctl enable chronyd

# 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-2. vim /etc/auto.master.d/(file_name).autofs -> By this command, we create a new file in


“/etc/auto.master.d/” in which we specify the home directory for remoteuser and also specify the path
of a file which is “/etc/auto.misc”.

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-

remoteuserX -(permission),soft,intr servername:(full path of home directory of remoteuser)

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.

12. User of Specific UID

Create a user barry User id of this user should be 2112 and set password atenorth

ANS

# useradd -u 2112 barry #

passwd barry

# id –u barry

13. Sudo privilege

a group name is 'elite', they have to give administrative permission without password.

# visudo

Add the new line


%elite ALL=(ALL) NOPASSWD: ALL
:wq

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

13. Build Application

- build an application testapp that prints the message when user1 logged in

"welcome to user1"

14. Create a container on node1 as andrew:

1. - using http://server1.net3.example.com/materials/3/Containerfile

build the container name is watcher

- don't change the Containerfile content


On Secondary Machine:

Q1.) First step is to crack password of Secondary Machine.

Ans. crack password of virtual machine for root

**** You have to reset your root password *****

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)

4:- go to end of linux line (press END key)

5:- just give space and type rd.break (type the command)

6:- Press ctrl+x (to start)

Give the root password for maintenance (Just enter press)

# mount -o remount,rw /sysroot

EXT4 filesystem does not create or exist (ignore the message)

# chroot /sysroot

# echo atenorth| passwd --stdin root

# 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)

Ans- Use yum to confirm that the tuned package is installed

# yum install tuned

Use the systemctl is-enabled tuned command to display the tuned service enablement state

# systemctl is-enabled tuned enabled

List all available tuning profiles and their descriptions

# tuned-adm list

Mention the profile to be loaded

# 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

# cfdisk /dev/vda (create partition)

Select Free space 🡪 Partition size 512M 🡪 select Type 🡪 select 82 (Linux swap) 🡪 write 🡪 Are you sure? 🡪 yes 🡪 Quit

# mkswap /dev/vda4 (make swap partition)

# swapon /dev/vda4 (to enable swap)

# vim /etc/fsatb

/dev/vda4 none swap defaults 0 0

:wq

# mount –a (to check syntax)

# swapon –s [to check]

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

# vgcreate -s 8M datastore /dev/vda5

# lvcreate -l 50 -n database datastore

# mkfs.vfat /dev/datastore/database

# mkdir /mnt/database

# vim /etc/fstab

Insert the line last line of the file

/dev/datastore/database /mnt/database vfat defaults 0 0

: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-2. lvextend –L (required_size in Kb or Mb or Gb) (path_of_LVM_partition) -> “lvextend”


command is used to extend lvm partition with required size of partition. -> With this command, we use
“-L” option which is used to extend or set size of partition in form of kilobyte, megabyte or gigabyte and
many more. If we use “+” sign with value then value is added in actual size of partition but if we not use
“+” sign with value then value is set as actual size of LVM partition.

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.

You might also like