Vous êtes sur la page 1sur 15

RHCSA EXAM MODEL QUESTION

BY SARAVANAN.C (919688798896)

To Display Exam Question

Crack root password

Set hostname

Set IP Address

yum repo

SELinux Enforcing

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

new password:
confirm password:
sh] touch /autorelabel

search for Linux16 string and press end key and add this line
exit

rd.break console=tty
press ctl+x to save and restart
#root: mount -o remount,rw /sysroot
#chroot /sysroot/
sh] passwd

exit

Setting 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
Using nmcli

Activate connection

Setting IP

#nmcli device status

#nmcli connection up con-name

Can be in 3 ways

adding connection

Restart network

#nmcli connection.add con-name as ifname etho


type ethernet ip4 172.25.7.0 gw4 172.25.0.0

#systemctl restart network

Network Manager (GUI)


nmcli
nmtui

To check
set dns

Using Network Manager

#ifconfig
#nmcli connection modify as ip4.dns 172.25.6.8

Go to right top where network manager icon and set


ip,dns and gateway address from the question

manual assign

Using nmtui

#nmcli connection modify as ip4.method manual

#nmtui

Set auto connect

Set the values for ip,dns,gateway

#nmcli connection modify as connection.


autoconnect yes

#cat /etc/resolv.conf

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

1 . swap partition
#fdisk -l

:n

#fdisk /dev/vda

default(first sector)

P - print the list of pratitions

default(last sector) +100M

n - create new partition

e or p (extended or primary)

l: 82 ( linux swap type)

:e

:p (to print the partitions)

default(first sector)

:w (to save the changes)

default(last sector)

#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
/dev/vda2 /test

100M

2 . user, group creation with permissions


User creation with UID

# date -d +1month

Setting permission for file or folder

#useradd -u 2323 ashwin

# usermod -e YYYY-MM-DD ashwin

#chmod u-x,g-x,o-x /file or /folder

#passwd ashwin

or # chage -E YYYY-MM-DD ashwin

removes execute permission to all

#cat /etc/passwd

# chage -l ashwin

#setfacl -m u:ashwin: 0 /file or /folder/

User creation with no login shell

Group creation and adding user

removes read/write for user ashwin

#useradd -s /bin/nologin kaviya

#groudadd sysmanager

#chmod g+rwx,o= /file or folder

#passwd kaviya

#chgrp sysmanager ashwin

others dont have permission to read,write

#su - kayiva

Adding to user when creating user

#chmod g+s /file or folder

Not allowed

#useradd -G sysmanager ashwin

files will be created in group ownership


automatically

3 . Crontab
Set cronjon for user to /bin/echo string at h:m

Deny Cron for specific user

#crontab -e -u username

#vim /etc/cron.deny

m h * * * /bin/echo "string"

ashwin

#systemctl restart crond.service


#su - username

#crontab -e -u ashwin

#mail

This program is not allowed

4 . find grep copy command combined & collaborative directory

Creating Collaborative directory


Locate files of user and copy to to some path
#mkdir -p /a/b
#find / -user ashwin -exec cp -a {}/file path \;
#chgrp sysmanager /a/b
Note: If path doesnt exists create using mkdir
#chmod g+rw,o= /a/b
Find string in all file and copy to some path
#grep "string" /source > /destination path

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
Autofs

Setting LDAP
#yum install authconfig-gtk* ssd* krb5* -y
#authconfig-gtk

#yum install autofs* -y


#systemctl restart autofs
#systemctl enable autofs
#vim /etc/auto.master

Set all the values from question


/rhome /etc/auto.misc

#getent passwd ldauserx( x denotes station


number)
You can see details about ldapuserx

#vim /etc/auto.misc
ldapuserx -rw,sync,nfvers=3 servername:/rhome/ldapuserx
#systemctl restart autofs
#systemctl enable autofs
#su - ldapuserx #ls

#cd ldapuserx

6 . LVM
LVM reduce

LVM Increase

#lvdisplay

#lvdisplay

#vim /etc/fstab

#vim /etc/fstab

#umount /dev/vgname/vo

#umount /dev/vgname

#e2fsck -f /dev/vgname/vo

#e2fsck -f /dev/vgname

#resize2fs -p* /dev/vgname/vo 120M

#lvextend -L 120M /dev/vgname

#lvreduce -L 120M /dev/vgname/vo

#resize2fs -p /dev/

#mount /dev/vgname

#mount /dev/vgname

#lvdisplay

#lvdisplay

#df -h

#df -h

7 . LVM creation
Convert volume to filesystem
Creating physical volume

#fdisk -l

:n

#pvcreate /dev/vdb4

#fdisk /dev/vda

default(first sector)

Creating volume group

P - print the list of pratitions

default(last sector) +100M

n - create new partition

e or p (extended or primary)

l: 83 ( linux LVM type)

#lvcreate -l 35 -n volname
/dev/mapper/vgname

:e

:p (to print the partitions)

Display volume

default(first sector)

:w (to save the changes)

#lvdisplay

default(last sector)

#partprobe (intimate to kernel)

#mkfs.ext3
/dev/mapper/vgnanme/volna
me

#mkfs.vfat
/dev/mapper/vgname/volnam
#vgcreate -s 8M vgname /dev/vdb4
e
Creating volume

Create directory to mount


#mkdir /lvm

Add entry to fstab


#/dev/mapper/vgname /lvm
ext3 defaults 0 0
:wq
Refresh using mount
#mount -a
List the mounted directory
#df -h

8 . Kernel update ,compression & NTP service

Kernel Update
download the file from the given url using ezlink
#rpm -vh package name
#reboot
NTP Service
#vim /etc/chrony.conf
add the source url given the question for NTP

Compression methods:
tar
#tar -cvf /destionationpath/filename.tar /source path
bz2
#tar -cvjf /destionationpath/filename.bz2 /source path
gz
#tar -cvzf /destionationpath/filename.gz /source path
xz
#tar -cvJf /destionationpath/filename.xz /source path

Problem in booting due to wrong entry in /etc/fstab


Booting in emergency target:

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
systemd.unit =emergency.target
use ctl+x to save and reboot
#root: mount -o remount,rw /
#vim /etct/fstab
remove the wrong entry and save using :wq

#reboot

Vous aimerez peut-être aussi