RHCSA EXAM MODEL QUESTION
To Display Exam Question
➔
Crack root password
➔
Set hostname
➔
Set IP Address
➔
yum repo
Cracking root password
use ctl+alt+del in send keys tab in virtual server m/c
when grub displays press tab key to freeze .Press e to edit grub
search for Linux16 string and press end key and add this line
rd.break console=tty
press ctl+x to save and restart
#root: mount -o remount,rw /sysroot
#chroot /sysroot/
sh] passwd
new password: confirm password: sh] touch /autorelabel exit exitSetting hostname
Setting hostname
#hostname (or) #cat /etc/hostname displays the current hostname Change host temporarily #host newhostname change host permanently
#hostctl set-hostname newhostname
Setting hostname using nmtui
#nmtui
Setting IP Address
Setting IP
Can be in 3 ways
● Network Manager (GUI) ● nmcli
● nmtui
Using Network Manager
Go to right top where network manager icon and set ip,dns and gateway address from the question Using nmtui
#nmtui
Set the values for ip,dns,gateway
Using nmcli
#nmcli device status adding connection
#nmcli connection.add con-name as ifname etho type ethernet ip4 172.25.7.0 gw4 172.25.0.0 set dns
#nmcli connection modify as ip4.dns 172.25.6.8 manual assign
#nmcli connection modify as ip4.method manual Set auto connect
#nmcli connection modify as connection. autoconnect yes
Activate connection
#nmcli connection up con-name Restart network
#systemctl restart network To check
#ifconfig
Setting yum repo and SElinux
Setting yum repo
#cd /etc/yum.repos.d/ #vim myown.repo [myown]
baseurl=”paste the url from the question” enabled=1
gpgcheck=0 :wq
#yum clean all #yum repolist all
#yum install any package to check if its installing from our own repo
Set SELinux Permission #vim /etc/sysconfig/selinux
change the line selinux=premissive to
selinux=enforcing :wq
1 . swap partition
#fdisk -l
#fdisk /dev/vda
P - print the list of pratitions
n - create new partition
e or p (extended or primary)
:e
default(first sector)
default(last sector)
: n
default(first sector)
default(last sector) +100M
t
l: 82 ( linux swap type)
:p (to print the partitions)
:w (to save the changes)
#partprobe (intimate to kernel)
#mkswap /dev/vda2
#mkdir /test
#vim /etc/fstab
/dev/vda2 /test swap swap defaults 0 0
#swapon -a
#mount -a
#df -h
2 . user, group creation with permissions
User creation with UID
#useradd -u 2323 ashwin
#passwd ashwin
#cat /etc/passwd
User creation with no login shell
#useradd -s /bin/nologin kaviya
#passwd kaviya
#su - kayiva
Not allowed
# date -d “+1month”
# usermod -e YYYY-MM-DD ashwin
or # chage -E YYYY-MM-DD ashwin
# chage -l ashwin
Group creation and adding user
#groudadd sysmanager
#chgrp sysmanager ashwin
Adding to user when creating user
#useradd -G sysmanager ashwin
Setting permission for file or folder
#chmod u-x,g-x,o-x /file or /folder
removes execute permission to all
#setfacl -m u:ashwin: 0 /file or /folder/
removes read/write for user ashwin
#chmod g+rwx,o= /file or folder
others dont have permission to read,write
#chmod g+s /file or folder
files will be created in group ownership
automatically
3 . Crontab
Set cronjon for user to /bin/echo string at h:m
#crontab -e -u username
m h * * * /bin/echo "string"
#systemctl restart crond.service
#su - username
Deny Cron for specific user
#vim /etc/cron.deny
ashwin
#crontab -e -u ashwin
This program is not allowed
4 . find grep copy command combined & collaborative directory
Locate files of user and copy to to some path #find / -user ashwin -exec cp -a {}/file path \; Note: If path doesnt exists create using mkdir Find string in all file and copy to some path #grep "string" /source > /destination path
Creating Collaborative directory #mkdir -p /a/b
#chgrp sysmanager /a/b #chmod g+rw,o= /a/b or
#chmod 770 /a/b
sets read,write to group sysmanger and other no permission to access /a/b
#chmod g+s /a/b
sets group permission automatically when files created in that directory
5 . LDAP
Setting LDAP
#yum install authconfig-gtk* ssd* krb5* -y
#authconfig-gtk
Set all the values from question
#getent passwd ldauserx( x denotes station
number)
You can see details about ldapuserx
Autofs
#yum install autofs* -y #systemctl restart autofs #systemctl enable autofs #vim /etc/auto.master /rhome /etc/auto.misc #vim /etc/auto.misc
ldapuserx -rw,sync,nfvers=3 servername:/rhome/ldapuserx #systemctl restart autofs
#systemctl enable autofs
LVM reduce #lvdisplay #vim /etc/fstab #umount /dev/vgname/vo #e2fsck -f /dev/vgname/vo #resize2fs -p* /dev/vgname/vo 120M #lvreduce -L 120M /dev/vgname/vo #mount /dev/vgname #lvdisplay #df -h LVM Increase #lvdisplay #vim /etc/fstab #umount /dev/vgname #e2fsck -f /dev/vgname #lvextend -L 120M /dev/vgname #resize2fs -p /dev/ #mount /dev/vgname #lvdisplay #df -h
6 . LVM
7 . LVM creation
#fdisk -l
#fdisk /dev/vda
P - print the list of pratitions
n - create new partition
e or p (extended or primary)
:e
default(first sector)
default(last sector)
: n
default(first sector)
default(last sector) +100M
t
l: 83 ( linux LVM type)
:p (to print the partitions)
:w (to save the changes)
#partprobe (intimate to kernel)
Creating physical volume #pvcreate /dev/vdb4 Creating volume group
#vgcreate -s 8M vgname /dev/vdb4 Creating volume
#lvcreate -l 35 -n volname /dev/mapper/vgname Display volume #lvdisplay
Create directory to mount #mkdir /lvm
Convert volume to filesystem #mkfs.ext3 /dev/mapper/vgnanme/volna me #mkfs.vfat /dev/mapper/vgname/volnam e
Add entry to fstab
#/dev/mapper/vgname /lvm ext3 defaults 0 0
:wq
Refresh using mount #mount -a
List the mounted directory #df -h