Linux L2 PDF
Linux L2 PDF
Ratnakar Page 1
[Pick the date] [LINUX NOTES FOR LEVEL 2]
1. What is partition?
A partttio is a ctiotigutgus set tf bltcks tio a dri e that are treated as iiodepeiodeiot disk.
2. What is partitioning?
Partttioiioi meaios tt di ide a siioile hard dri e iiott maioy ltiical dri es.
3. Why we have multiple partitions?
Eiocapsgulate tgur data. Siioce fle system ctrrgupttio is limited tt that partttio tioly. St we caio
sa e tgur data frtm accideiots.
We caio iiocrease the disk space efcieiocy. Depeiodiioi tio tgur gusaie we caio ftrmat the
partttio with difeereiot bltck sises. St we caio redguce the wastaie tf the disk.
We caio limit the data irtwth by assiiioiioi the disk qguttas.
4. What is the structure of the disk partition?
The frst secttr tf the O/SS disk ctiotaiios the MB R (MBaster ttt Rectrd).. The MB R is di ided
iiott 3 parts aiod it's sise is 512 bytes.
The frst part is IPL (Iioital Prtiram Ltader). aiod it ctiotaiios the Sectiodary ttt Ltader. St
IPL is resptiosible ftr btttioi the O/SS aiod it's sise is 446 bytes.
The sectiod part is PTI (Partttio Table Iioftrmattio).. It ctiotaiios the iogumber tf partttios tio
the disk sises tf the partttios aiod type tf the partttios.
5. Explain the disk partition criteria?
E ery disk caio ha e max. 4 partttios. The 4 partttios are 3 Primary partttios aiod 1
Exteioded partttio.
The MB R aiod O/SS will iiostall iio Primary partttio tioly.
The Exteioded partttio is a special partttio aiod caio be fgurther di ided iiott mgultple ltiical
partttios.
6. How to identify the disks?
Iio Liiogux difeereiot types tf disks will be ideiotfed by difeereiot ioamiioi ctio eiottios.
IDE). dri es will be shtwio as /Sde /Shda /Sde /Shdb /Sde /Shdc ...etc. aiod the partttios are
/Sde /Shda1 /Sde /Shda2 /Sde /Shda3 ...etc.
iSCSI/SSCSI aiod SATA dri es will be shtwio as /Sde /Ssda /Sde /Ssdb /Sde /Ssdc ...etc. aiod the
partttios are /Sde /Ssda1 /Sde /Ssda2 /Sde /Ssda3 ...etc.
Virtgual dri es will be shtwio as /Sde /S da /Sde /S db /Sde /S dc ...etc. aiod the partttios
are /Sde /S da1 /Sde /S da2 /Sde /S da3 ...etc.
IDE -----> Iioteirated Dri e Electrtioics.iSCSI -----> Iioterioet Small Scale System Iioterface.
SCSI -----> Small Scale System Iioterface.
7. What is file system?
It is a methtd tf sttriioi the data iio aio triaioised fashitio tio the disk. E ery partttio tio the disk
except MB R aiod
Ratnakar Page 2
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Exteioded partttio shtguld be assiiioed with stme fle system iio trder tt make them tt sttre the
data. File system is applied tio the partttio by ftrmatioi it with a partcgular type tf fle
system.
8. What are the diferent types of file systems supported in Linux?
The Liiogux sgupptrted fle systems are ext2 ext3 ext4 xfs fat cdfs hdfs ist9660 ...etc.
The ext2 ext3 ext4 fle systems are widely gused iio RHEL-6 aiod xfs fle system is iiotrtdguced tio
RHEL-7. The fat fle system is gused tt maiiotaiio a ctmmtio sttraie betweeio Liiogux
aiod Wiiodtws O/SS.
The cdfs fle system is gused tt mtguiot the CD-ROMBs aiod the hdfs fle system is gused tt mtguiot
DVDs.
The ist9660 fle system is gused tt read CD/SDVD.ist imaie ftrmat fles iio Liiogux O/SS.
9. What is mounting and in how many types can we mount the partitions?
Attachiioi a directtry tt the fle system iio trder tt access the partttio aiod it's fle system is
kiotwio as mtguiotioi.
Iio ieioeral the sgub directtries guioder /Smiot directtry are the mtguiot ptiiots tt mtguiot the fle
systems.
There twt types tf mtguiotiois iio Liiogux/SUioix.
Temptrary MBtguiotioi :
Iio a temptrary mtguiotioi frst we create a directtry aiod mtguiot the partttio tio that
directtry. gut this type mtguiotioi will last tioly tll the system is gup aiod tioce it is rebttted
the mtguiotioi will be ltst.
Example:# mtguiot <tpttios><de ice ioame><directtry ioame (mtguiot ptiiot).>
Permaioeiot MBtguiotioi :
Iio this alst frst we create the directtry aiod tpeio the /Setc/Sfstab fle aiod make aio eiotry as
beltw
<de ice ioame><mtguiot ptiiot><fle system type><mtguiot tpttios><take a backgup tr
iott><fsck algue>
Wheioe er the system rebttts mtguiot the partttios acctrdiioi tt eiotries iio /Setc/Sfstab fle.
St these type tf mtguiotiois are permaioeiotly e eio afer the system is rebttted.
# mtguiot -a tt mtguiot the partttios withtgut rebttt).
10. What are diferences between the ext2, ext3, ext4 and xfs file systems?
Ratnakar Page 3
[Pick the date] [LINUX NOTES FOR LEVEL 2]
T T E 16E .
*1E = 1024 Peta bytes.
5. Caioiott ctio ert ext fle We caio directly ctio ert We caio ctio ert all fle Uiomtguiot aiod mtguiot
system tt ext2. ext2 tt ext3 fle systems tt ext4 fle the fle system is
system. system. reqguired.
Ratnakar Page 4
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 5
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Example : # mtguiot LA EL=tradisk /Smiot/Stracle (tt mtguiot the tradisk label tio /Smiot/Stracle
directtry).
# im /Setc/Sfstab
LA EL=tradisk /Smiot/Stracle ext4 defagults 0 0
Esc+:+wq! (tt sa e aiod exit the fle).
# mtguiot -a (tt mtguiot the partttios).
# mtguiot (tt erify whether it is mtguioted tr iott).
22. How mount the partition permanently using block id (UUID)?
# blkid <partttio ioame tr disk ioame> (tt see the UUID tr bltck id tf that partttio).
Example : #blkid /Sde /Ssdb2 (tt see the UUID tr bltck id tf the /Sde /Ssdb2 partttio).
Ctpy that UUID with mtguse aiod paste it iio /Setc/Sfstab fle aiod make aio eiotry abtgut that.
Example: # im /Setc/Sfstab
UUID="{.......................}" /Smiot/Stracle ext4 defagults 0 0
Esc+:+wq! (tt sa e aiod exit).
23. What is the basic rule for swap size?
(i). If the sise tf the RAMB is less thaio tr eqgual tt 2G theio the sise tf the swap = 2 X RAMB sise.
(ii). If the sise tf the RAMB is mtre thaio 2G theio the sise tf the swap = 2G + RAMB sise.
24. How to create a swap partition and mount it permanently?
# free -m (tt see the preseiot swap sise).
# swaptio -s (tt see the swap gusaie).
# fdisk <disk ioame> (tt make a partttio).
Example: # fdisk /Sde /Ssdb
Ctmmaiod (m ftr help). : io (tt create a ioew partttio).
First cyliioder : (press Eioter tt take as defagult algue).
Last cyliioder : +2048MB (tt create 2G partttio).
Ctmmaiod (m ftr help). : t (tt chaioie the partttio id).
Eioter the partttio Nt.: 2 (tt chaioie the /Sde /Ssdb2 partttio id).
Eioter the id : 82 (tt chaioie the partttio id Liiogux tt Liiogux Swap).
Ctmmaiod (m ftr help). : w (tt sa e the chaioies iiott the disk).
# partprtbe /Sde /Ssdb (tt gupdate the partttio table iioftrmattio).
# mkswap <de ice tr partttio ioame> (tt ftrmat the partttio with swap fle system).
Example : # mkswap /Sde /Ssdb2 (tt ftrmat the /Sde /Ssdb2 partttio with swap fle system).
# swaptio <de ice tr partttio ioame> (tt act ate the swap space).
Example : # swaptio /Sde /Ssdb2 (tt act ate /Sde /Ssdb2 swap space).
# free -m (tt see the swap sise).
# im /Setc/Sfstab (tt make aio eiotry tt permaioeiot mtguiot the swap partttio).
/Sde /Ssdb2 swap swap defagults 0 0
Esc+:+wq! (tt sa e aiod exit).
25. What are the atributes of the file system?
(i). Iiotde iogumber
Ratnakar Page 6
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 7
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 8
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# e2fsck <partttio ioame> (tt check the ctiosisteiocy tf the fle system iio iioteract e
mtde).
# e2fsck -p <partttio ioame> (tt check the ctiosisteiocy tf the fle system withtgut
iioteract e mtde).
# mke2fs -io <partttio ioame> (tt see the sguperbltck iioftrmattio).
# mke2fs -t <fle system type><partttio ioame> (tt ftrmat the partttio iio the specifed fle
system type).
# mke2fs <partttio ioame> (tt ftrmat the partttio iio defagult ext2 fle system type).
# bltckde --ietbs /Sde /Ssdb1 (tt check the bltck sise tf the /Sde /Ssdb1 fle system).
# fsck <de ice tr partttio ioame> (tt check aiod repair the fle system).
Ntte: eftre rguioioiioi this ctmmaiod frst guiomtguiot that partttio theio rguio
fsck ctmmaiod.
# gumtguiot -a (tt guiomtguiot all the fle systems except ( /S ). rttt fle system).
# mtguiot -a (tt mtguiot all the fle systems which are ha iioi eiotries iio
/Setc/Sfstab fle).
# fsck -A (tt rguio fsck tio all fle systems).
# fsck -AR -y (tt rguio fsck withtgut askiioi aioy qguesttios).
# fsck -AR -t ext3 -y (tt rguio fsck tio all ext3 fle systems).
# fsck -AR -t iot ext3 -y (tt rguio fsck tio all fle systems except ext3 fle systems).
# fsck -io /Sde /Ssdb1 (tt see the /Sde /Ssdb1 fle system reptrt withtgut rguioioiioi
fsck).
# tguioe2fs -l /Sde /Ssdb1 (tt check whether the jtgurioaliioi is there tr iott).
# tguioe2fs -j /Sde /Ssdb1 (tt ctio ert ext2 fle system tt ext3 fle system).
# tguioe2fs -l /Sde /Ssdb1 (tt check whether the jtgurioaliioi is added tr iott).
# tguioe2fs -O ^has_jtgurioal /Sde /Ssdb1 (tt ctio ert ext3 fle system tt ext2 fle system).
# tguioe2fs -O dir_iiodex has_jtgurioal guioit_bi /Sde /Ssdb1 (tt ctio ert ext2 fle system tt ext4
fle system).
# tguioe2fs -O exteiots dir_iiodex guioit_bi /Sde /Ssdb1 (tt ctio ert ext3 fle system tt ext4 fle
system).
# mtguiot -t remtguiot rw /Sde /Ssdb1 (tt mtguiot the partttio with read aiod write permissitios).
# mtguiot -t remtguiot rt /Sde /Ssdb1 (tt mtguiot the partttio with read tioly permissitios).
# mtguiot <mtguiot ptiiot tr directtry ioame> (tt check whether this directtry is mtguiot ptiiot tr
iotrmal directtry).
# dgump2fs <de ice tr partttio ioame> (tt check the metadata tf the partttio aiod repair the
metadata).
# fdisk -l (tt list tttal hard disks attached tt system aiod their
partttios).
# fguser -cgu <de ice tr partttio ioame> (tt see the gusers wht are accessiioi that fle system).
# fguser -cK <de ice tr partttio ioame> (tt kill the gusers prtcesses wht accessiioi the fle systems).
Ratnakar Page 9
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Note: E eio thtguih we kill thtse gusers prtcesses stmetmes we caioiott guiomtguiot thtse
partttios st if this
sitguattio arises theio frst see the prtcess id's tf the guser tpeioed fles by # lsof <mount
point>aiod
killthtse prtcessesftrcefgully by # kill -9 <process id>
# jtgurioalctl (It tracks all the lti fles betweeio twt difeereiot tmiiois aiod by defagult sa ed iio
/run/log ltcattio).
* /run/log is mtguioted tio tmpfs fle system. ie. if system is rebttted the whtle iioftrmattio iio
that ltcattio will
be deleted tr erased.
* We caio chaioie the ltcattio tf the /run/log tt aiotther like /var/log/journal by
# mkdir -p /S ar/Slti/Sjtgurioal (tt make a directtry iio /S ar/Slti ltcattio).
# chtwio rttt : systemd-jtgurioal /S ar/Slti/Sjtgurioal (tt chaioie the irtgup twioership tf
/S ar/Slti/Sjtgurioal).
# chmtd i+s /S ar/Slti/Sjtgurioal (tt set the siid tio /S ar/Slti/Sjtgurioal).
# killall -URS1 systemd-jtgurioald (It is ioecessary tt kill tld /Srguio/Slti prtcess aiod the
ltcattio tf jtgurioal
messaies is chaioied tt /S ar/Slti/Sjtgurioal).
# jtgurioalctl -io 5 (tt display last f e liioes tf all the lti fles).
# jtgurioalctl -p err (tt display all the errtr messaies).
# jtgurioalctl -f (tt watch jtgurioalctl messaies ctiotiogutgusly).
# jtgurioalctl --siioce<ttday> tr <yesterday> (tt see all the jtgurioalctl messaies siioce ttday tr
yesterday).
# jtgurioalctl --siioce "date" --guiotl "date" (tt see the jtgurioal messaies betweeio the specifed
twt dates).
# jtgurioalctl -pid=1 (tt see the pid=1 prtcess ioame).
# aguditctl (tt see the agudit reptrt).
# sar (sar gutlity is tt watch the system act ity reptrt like CPU
memtry ...etc. ).
# smartctl -H <hard disk ioame> (tt check the health tf the specifed hard disk).
# smartctl -i <hard disk ioame> (tt see the iioftrmattio tf the specifed hard disk).
# smartctl -a <hard disk ioame> (it ii es mtre iioftrmattio tf the specifed hard disk).
Note: Iio the abt e ctmmaiod resgults it tt Valueaiod Tresh felds. If Tresh is mtre thaio the
Value theio
immediately hard disk chaioie is reqguired. If Tresh is ltwer thaio the Value theio hard disk is
tk. St the Tresh is always ltwer thaio the Value ttherwise hard disk chaioie is
reqguired immediately aiod
reptrt this maioaier.
Ratnakar Page 10
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 11
[Pick the date] [LINUX NOTES FOR LEVEL 2]
3. How to create the LVM, make a file system and mount that permanently?
(i). Take twt physical disks ftr example /dev/sdb aiod /dev/sdc. if there is iot sectiod disk
theio make the reqguired partttios gusiioi # fdisk ctmmaiod aiod chaioie the partttio
ctde as 8e.
(ii). Ctio ert the Physical disk iiott physical tlgumes by
# pvcreate /dev/sdb /dev/sdc
(iii). Theio create the tlgume irtgup by ctmbiioiioi physical tlgumes by
# vgcreate <volume group name><physical volume names> tr
W
# vgcreate -s <PE size in MBs><volume group name><physical volume names>
(i ). Theio create the ltiical tlgume tio the abt e created tlgume irtgup by
# lvcreate -L +<size in MBs> -n <logical volume name><Volume group name> tr
# lvcreate -l <no. of PEs> -n <logical volume name><volume group name>
( ). MBake a fle system tio the abt e created ltiical tlgume by
# mkfs.ext2/ext3/ext4/xfs /dev/<volume group name>/<logical volume name>
( i). Create a mtguiot ptiiot tt mtguiot the abt e created LVMB fle system by
# mkdir /mnt/<directory name>
( ii). MBtguiot the LVMB tio the abt e created mtguiot ptiiot temptrarily by
# mount /dev/<volume group name>/<logical volume name><mount point>tr
MBtguiot the LVMB tio mtguiot ptiiot permaioeiotly by
# vim /etc/fstab
/dev/<VG name>/<LV name> /mnt/<directory> <file system type> defaults
0 0
Esc+:+wq!
# mount -a
# df -hT (tt see the mtguioted partttios with fle system types).
4. How to see the details of the Physical Volumes?
#p s (displays all physical tlgumes with less details).
# p display (displays all physical tlgumes with mtre details).
# p display <physical tlgume ioame> (displays the details tf the specifed physical
tlgume).
# p scaio (tt scaio all the physical tlgumes).
#p scaio <PV ioame> (tt scaio the specifed physical tlgume).
Ratnakar Page 12
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 13
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 14
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 15
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# mtguiot -a
15. How to change the volume group name and other parameters?
# ireioame <existioi tlgume irtgup ioame><ioew tlgume irtgup ioame> (tt reioame the
tlgume irtgup).
y defagult guiolimited ltiical tlgumes caio be created per tlgume irtgup. gut we caio ctiotrtl this
limit by
# ichaioie -l <iot.>< tlgume irtgup> (tt limit max. iot. tf ltiical tlgumes tt the specifed
iogumber).
Ratnakar Page 16
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Example : # ichaioie -l 2 < iioame> (tt limit max. 2 ltiical tlgumes cab be created iio
this tlgume irtgup).
# ichaioie -p <iot.>< tlgume irtgup> (tt limit max. iot. tf physical tlgumes tt the
specifed iogumber).
Example : # ichaioie -p 2 < iioame> (tt limit max. 2 physical tlgumes caio be added tt
this tlgume irtgup).
# ichaioie -s <bltck sise iio iot.>< tlgume irtgup> (tt chaioie the bltck sise tf the
tlgume irtgup).
Example : # ichaioie -s 4 < iioame> (tt chaioie the tlgume irtgup bltck sise tt 4MB ).
16. How to change the logical volume name and other parameters?
# l reioame <existioi l ioame><ioew l ioame> (tt reioame the ltiical tlgume).
# l chaioie -pr <ltiical tlgume> (tt pgut the ltiical tlgume iiott read tioly mtde).
#l s (tt see the ltiical tlgume permissitios).
# l chaioie -prw <ltiical tlgume> (tt pgut the ltiical tlgume iiott read aiod write mtde).
17. How to disable the volume group and logical volume?
# ichaioie -aio < tlgume irtgup> (tt disable the tlgume irtgup).
# l chaioie -aio <ltiical tlgume> (tt disable the ltiical tlgume).
18. How to take a backup of the volume group?
# icfibackgup (tt take a backgup tf all tlgume irtgups).
# icfibackgup < tlgume irtgup> (tt take a backgup tf the specifed tlgume irtgup).
19. What is the configuration file of the logical volume?
# cat /Setc/Sl m/Sl m.ctiof (tt see the ctioteiots tf the LVMB ctiofigurattio fle).
20. What are the locations of the logical volume and volume groups?
# cd /Setc/Sl m/Sbackgup (the ltiical tlgumes backgup ltcattio).
# cd /Setc/Sl m/Sarchi e (the tlgume irtgups backgup ltcattio).
21. How to know the current version of the LVM package?
# rpm -qa l m* (tt kiotw the cgurreiot ersitio tf the LVMB packaie).
22. What are the atributes of the volume group?
# is (tt see the attribgutes tf the tlgume irtgup).
[ The attribgutes are w ----> writable s ----> exteiodable io ----> iotrmal ]
# is - (tt check the UUID tf the tlgume irtgup).
23. How to extend the logical volume to max. disk space and half of the disk space?
# l exteiod -l +100% FREE <ltiical tlgume> (tt exteiod the ltiical tlgume by addiioi the
tlgume irtgup's
tttal a ailable space).
# l exteiod -l 50% < iioame><l ioame> (tt exteiod the ltiical tlgume by addiioi the
50% free space
tf the tlgume irtgup).
24. How to check on which physical volume the data is writing in the logical volume?
Ratnakar Page 17
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# l display -m (tt check tio which physical tlgume the data is cgurreiotly
writioi frtm all
ltiical tlgumes).
# l display -m <l ioame> (tt check tio which physical tlgume the data is writioi frtm
the specifed
ltiical tlgume).
25. How many types of file systems available?
ext2 ---->Sectiod exteioded fle system (defagult iio RHEL - 3 & 4).
ext3 ---->Third exteioded fle system (defagult iio RHEL - 5).
ext4 ----> Ftgurth exteioded fle system (defagult iio RHEL - 6).
xfs ----> Exteioded fle system (defagult iio RHEL - 7).
gufs ----> Uioix fle system (defagult iio Stlaris).
jfs ----> Jtgurioal fle system (defagult iio I MB-AIX).
hfs ----> Hiih perftrmaioce fle system (defagult iio HP-UX).
xfs ----> Veritas fle system
prtcfs ----> Prtcess fle system (temptrary).
tempfs ----> Temptrary fle system (temptrary).
cdfs ----> Ctmpact disk fle system
hdfs ----> DVD fle system
ist9660 ----> Tt read the CD/SDVD.ist imaie ftrmat fles iio Liiogux
26. How to scan and detect the luns over the network?
# ls /Ssys/Sclass/Sfc_htst (tt check the a ailable fbre
chaioioels).
# echt "---" > /Ssys/Sclass/Sscsi_htst/S<lguio iot.>/Sscaio (tt scaio aiod detect the lguios t er
the ioetwtrk).
27. How to mount a pen drive in Linux?
# lsgusb tr # fdisk -l (tt kiotw the peio dri e ioame).
# mkdir /Smiot/Speiodri e (tt create a mtguiot ptiiot ftr peio dri e).
# mtguiot <peio dri e ioame><mtguiot ptiiot> ( tt mtguiot the peio dri e tio the abt e created
mtguiot ptiiot).
# cd /Smiot/Speiodri e (tt access the peio dri e).
28. How to mount a CD/DVD ROM drives in Linux?
The CD/SDVD ROMB de ice ioame iio Liiogux is /Sde /Scdrtm
# mkdir /Smiot/Smycdrtm (tt create the mtguiot ptiiot ftr CD/SDVD).
# mtguiot /Sde /Scdrtm /Smiot/Smycdrtm (tt mtguiot the CD/SDVD tio the abt e created mtguiot
ptiiot).
# cd /Smiot/Smycdrtm (tt access the CD/SDVD ROMB dri es).
29. How to mount the " .iso " image files in Linux?
# mtguiot -t ist9660 /Srttt/Srhel6.ist /Sist -t rt lttp (tt mtguiot the .ist imaie fles).
Ratnakar Page 18
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# cdrectrd /Srttt/SDeskttp/Srhel6.ist (tt write the CD/SDVD ROMB. eftre execgutioi this
ctmmaiod pgut the
empty CD/SDVD iiott CD/SDVD dri e).
# eject (tt eject the CD/SDVD dri e tray).
# eject -t (tt iiosert aiod cltse the CD/SDVD dri e tray).
30. What is RAID? What is the use of the RAID and how many types of RAIDs available?
RAID staiods ftr Redguiodaiot Array tf Iiodepeiodeiot Disks.
It prt ides fagult ttleraioce ltad balaiociioi gusiioi strippiioi mirrtriioi aiod parity ctiocepts.
There are maiioly twt types tf RAIDs a ailable.
(i). Hardware RAID (Depeiods tio eiodtrs aiod alst mtre expeiosi e).
(ii). Stfware RAID (Dtes iott depeiods tio eiodtrs aiod less expeiosi e wheio ctmpared tt
Hardware RAID aiod alst it is maiiotaiioed by system admiioistrattr tioly.
31. How many types of sofware RAIDs available and their requirements?
(i). RAID - 0 ---- Strippiioi ---- MBiioimgum 2 disks reqguired
(ii). RAID - 1 ---- MBirrtriioi ---- MBiioimgum 2 disks reqguired
(iii). RAID - (1+0). --- MBirrtriioi + Strippiioi ---- MBiioimgum 4 disks reqguired
(i ). RAID - (0+1). --- Strippiioi + MBirrtriioi ---- MBiioimgum 4 disks reqguired
( ). RAID - 5 ---- Strippiioi with parity ---- MBiioimgum 3 disks reqguired
32. How to configure RAID - 0 in Linux?
Tt ctiofigure RAID - 0 miioimgum 2 disks are reqguired aiod the partttio id is "fd".
Readiioi aiod writioi is ery fast. St it prtdguces hiih perftrmaioce.
if tioe disk is failed we caioiott rect er the data.
St there is iot redguiodaiocy aiod fagult ttleraioce iio RAID - 0.
Example : Ftr example if the data is 1 2 3 4 5 aiod 6 theio ....
1 2
3 4
5 6
Disk - 1 Disk - 2
If the Disk - 1 is /Sde /Ssdb aiod the Disk - 2 is /Sde /Ssdc theio
# mdadm -C /Sde /Smd0 -io 2 /Sde /Ssdb /Sde /Ssdc -l 0 (tt create the RAID - 0 gusiioi disk - 1
aiod disk - 2).
# cat /Sprtc/Smdstat (tt check the RAID - 0 is created tr
iott).
# mkfs.ext4 /Sde /Smd0 (tt create the ext4 fle system tio
the RAID - 0).
# mkdir /Smiot/Sraid0 (tt create the RAID - 0 mtguiot ptiiot).
# mtguiot /Sde /Smd0 /Smiot/Sraid0 (tt mtguiot RAID - 0 tio the mtguiot
ptiiot).
Ratnakar Page 19
[Pick the date] [LINUX NOTES FOR LEVEL 2]
1 1
2 2
3 3
4 4
5 5
6 6 Disk - 1 Disk - 2
If the Disk - 1 is /Sde /Ssdb aiod the Disk - 2 is /Sde /Ssdc theio
# mdadm -C /Sde /Smd0 -io 2 /Sde /Ssdb /Sde /Ssdc -l 1 (tt create the RAID - 1 gusiioi disk - 1
aiod disk - 2).
# cat /Sprtc/Smdstat (tt check the RAID - 1 is created tr
iott).
# mkfs.ext4 /Sde /Smd0 (tt create the ext4 fle system tio
the RAID - 1).
# mkdir /Smiot/Sraid1 (tt create the RAID - 1 mtguiot ptiiot).
# mtguiot /Sde /Smd0 /Smiot/Sraid1 (tt mtguiot RAID - 1 tio the mtguiot
ptiiot).
# mdadm -D /Sde /Smd0 (tt see the details tf the RAID - 1
partttio).
# mdadm /Sde /Smd0 -f /Sde /Ssdb (tt failed the disk maiogually).
# mdadm /Sde /Smd0 -r /Sde /Ssdb (tt remt e the abt e failed disk).
Ratnakar Page 20
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# mdadm /Sde /Smd0 -a /Sde /Ssdd (tt add the ioew disk iio place tf
failed disk).
# gumtguiot /Smiot/Sraid1 (tt guiomtguiot the raid fle system).
# mdadm --sttp /Sde /Smd0 (tt sttp the RAID - 1 tlgume).
# mdadm /Sde /Smd0 --add /Sde /Ssde (tt add third disk tt the RAID - 1
tlgume).
# mdadm --irtw /Sde /Smd0 --raid_de ice=3 (tt irtw the RAID - 1 fle system).
34. How to configure RAID - 5 in Linux?
Tt ctiofigure RAID - 5 miioimgum 3 disks are reqguired aiod the partttio id is "fd".
Iio e ery disk apprtximately 25 - 30% tf space is reser ed ftr parity.
Readiioi aiod writioi is ery fast. St it prtdguces hiih perftrmaioce.
This is gused Strippiioi with parity ctiocept.
if tioe disk is failed we caio rect er the data gusiioi remaiioiioi twt disks aiod parity.
If twt disks are failed theio we caioiott rect er the data.
St there is iot redguiodaiocy aiod fagult ttleraioce iio RAID - 5.
Example : Ftr example if the data is 1 2 3 4 5 aiod 6 theio ....
2
1 1+2
3
4
3+4
5+6
5
6
Disk - 1 Disk - 2
Disk - 3
If the Disk - 1 is /Sde /Ssdb the Disk - 2 is /Sde /Ssdc aiod Disk - 3 is /Sde /Ssddtheio
# mdadm -C /Sde /Smd0 -io 2 /Sde /Ssdb /Sde /Ssdc -l 5 (tt create the RAID - 5 gusiioi disks -
1 2 aiod 3).
# cat /Sprtc/Smdstat (tt check the RAID - 5 is created tr
iott).
# mkfs.ext4 /Sde /Smd0 (tt create the ext4 fle system tio
the RAID - 5).
# mkdir /Smiot/Sraid5 (tt create the RAID - 5 mtguiot ptiiot).
# mtguiot /Sde /Smd0 /Smiot/Sraid5 (tt mtguiot RAID - 5 tio the mtguiot
ptiiot).
# mdadm -D /Sde /Smd0 (tt see the details tf the RAID - 5
partttio).
# mdadm /Sde /Smd0 -f /Sde /Ssdb (tt failed the disk maiogually).
# mdadm /Sde /Smd0 -r /Sde /Ssdb (tt remt e the abt e failed disk).
# mdadm /Sde /Smd0 -a /Sde /Ssde (tt add the ioew disk iio place tf
failed disk).
# gumtguiot /Smiot/Sraid5 (tt guiomtguiot the raid fle system).
Ratnakar Page 21
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 22
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Liiok fle is a shtrt cgut fle tt the triiiioal fle. Creatioi aiod remt iioi (deletioi). iioks betweeio
twt fles is kiotwio as maioaiiioi liioks. There are twt types tf liioks fles a ailable iio Liiogux.
(i). Stf liiok
(ii). Hard liiok
44. What is sof link and how to create it?
Stf liiok is iotthiioi bgut a shtrt cgut fle. If triiiioal fle is deleted iot guse tf shtrt cgut fle. ie. we
caioiott access the triiiioal data by selectioi the liiok fle. Stf liiok caio be applied tio btth directtries
aiod fles. These fles caio be sttred iio aioy tf the fle system. ie. the triiiioal fle may be iio tioe
fle system aiod the liiok fle may be tio aiotther fle system. If we edit aioy fle the liiok fles are
alst gupdated aguttmatcally. Wheio we create a stf liiok fle the permissitios are fgull permissitios.
The stf liiok fle aiod the triiiioal fle iiotde iot's are difeereiot. The sise tf the stf liiok fle is same as
the leioith tf the triiiioal fle ioame. The stf liiok caio be created by
# lio -s <triiiioal fle tr directtry><liiok fle tr directtrywith path> (tt create a
stf liiok).
# lio -s /Srttt/Sscript /Srttt/SDeskttp/Sscript (tt create a liiok fle ftr the script aiod sttred tio
rttt Deskttp).
45. What is hard link and how to create it?
Hard liiok iio iotthiioi bgut a backgup fle. If the triiiioal fle is deleted there is iot efeect tio hard liiok
fle. ie. we caio access the triiiioal fle data e eio thtguih the liiok fle is deleted. Hard liioks caio be
applied tio fles tioly iott tio directtries. Hard liiok fles caio be sttred iio the same fle system. ie.
triiiioal aiod hard liiok fles btth shtguld be iio the same fle system iott tio difeereiot fle systems.
The iiotde iot's are same ftr triiiioal aiod hard liiok fles. If the triiiioal is edited the gupdattios are
applied tio btth triiiioal aiod hard liiok fles. The sise tf the hard liiok fle is same as the sise tf
the triiiioal fle.
46. What are the commands to search files and directories?
Tt search fles aiod directtries there are twt ctmmaiods.
(i). # ltcate
(ii). # fiod
47. Explain the locate command and how to use it?
ltcate always lttks the ltcate database aiod iott iio a specifc ltcattio. The data tf the ltcate is
sttred iio /var/lib/mlocate/mlocate.db fle. If the data is iott gupdated iio ltcate database tr
the ltcate database is a ailable tr ltcate database is deleted we caioiott ltcate the fles aiod
directtries. # updatedb is the ctmmaiod tt gupdate the ltcate database. ltcate database
caioiott be fiod the ioewly created fles aiod directtries. It is iott rectmmeioded tt guse tio prtdgucttio
ser ers becaguse it impacts tio perftrmaioce tf the ser ers. St tt t erctme this prtblem we
iotrmally guse # find ctmmaiod tio prtdgucttio ser ers.
# gupdatedb (tt gupdate the ltcate
database).
# ltcate <fle ioame/Sdirecttry ioame> (tt search the specifed fle
tr directtry).
Ratnakar Page 23
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 24
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# fiod /S -sise +10MB (tt search ftr ireater thaio 10MB sise
fles/Sdirecttries).
# fiod /S -guser stgudeiot (tt search ftr stgudeiot guser
fles/Sdirecttries).
# fiod /S -irtgup stgudeiot (tt search ftr stgudeiot irtgup
fles/Sdirecttries).
# fiod /S -guser stgudeiot -iott -irtgup stgudeiot (tt search ftr stgudeiot guser fles aiod iott
stgudeiot irtgup fles).
# fiod /S -guser stgudeiot -t -irtgup stgudeiot (tt search ftr stgudeiot guser aiod stgudeiot irtgup
fles/Sdirecttries).
# fiod /S -guid <guid iot.> (tt search ftr fles/Sdirecttries which beltiois
tt the guser
ha iioi the specifed guser id).
# fiod /S -iid <iid iot.> (tt search ftr fles/Sdirecttries which beltiois
tt the irtgup
ha iioi the specifed irtgup id).
# fiod /S -prem 755 (tt search fle/Sdirecttries which are ha iioi the
permissitios 755).
# fiod /S -prem -755 (tt search fle/Sdirecttries which are ha iioi the
permissitios
beltw 755 aiod alst at least tioe match alst).
# fiod /S -mmiio 20 (tt search ftr fles/Sdirecttries which are mtdifed withiio 20
miiogutes +20 ----> abt e 20 miiogutes aiod
-20 -----> beltw 20 miiogutes).
# fiod /S -mtme 2 (tt search fles/Sdirecttries which are mtdifed
withiio 2 days).
# fiod /S -ioame "*.mp3" -exec rm -rf { } ; (tt search all .mp3 fles
aiod delete them).
# fiod /S -ioame "*.mp3" -exec cp -a { } /Sram ; (tt search all mp3 fles aiod ctpy them
iiott /Sram directtry).
# fiod /S -guser stgudeiot -exec cp -a { } /Sram ; (tt search stgudeiot guser's fles aiod
directtries aiod
ctpy them iiott /Sram directtry).
# fiod /S -iotguser -exec m -a { } /Shtme/Sram ; (tt search fles/Sdirecttries which
are iott beltiois tt aioy guser aiod
mt e them iiott /Shtme/Sram directtry).
# dgu -h /S |strt -r |head -io 10 (tt search 10 bii sise fles iio re erse
trder).
Ratnakar Page 25
[Pick the date] [LINUX NOTES FOR LEVEL 2]
1. What is a user?
Ratnakar Page 26
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Iio Liiogux guser is tioe wht guses the system. There caio be at least tioe tr mtre thaio tioe guser iio
Liiogux at a tme.
2. How many types of users available in Linux?
There are 5 types tf gusers a ailable iio Liiogux.
(i). System guser (Admiio guser wht ctiotrtl the whtle system iotthiioi bgut rttt guser)..
(ii). Ntrmal guser (Created by the Sguper guser. Iio RHEL - 7 the guser id's frtm 1000 - 60000)..
(iii). System guser (Created wheio applicattio tr stfware iiostalled aiod are maiiotaiioed system
deamtios)..
(Iio RHEL - 7 the System gusers are (i). Statc system guser id's frtm 1 - 200 aiod (ii). Dyioamic system
guser guser id'sfrtm 201 - 999)..
(i ). Netwtrk guser (Ntthiioi bgut remtte guser ie. wht are ltiiio tt the system trtguih ioetwtrk
created iio Wiiodtws Act e Directtry tr iio Liiogux LDAP tr NIS)..
( ). Sgudt guser (The iotrmal gusers wht are ha iioi admiio tr Sguper guser pri ileies).
The types of users in Linux and their atributes:
Type of Default
Example User ID Group ID Home Directory
User Shell
Ntrmal gusers
Same as Same as
Sgudt User with admiio /Shtme/S<guser ioame> /Sbiio/Sbash
iotrmal gusers iotrmal gusers
pri ileies
Ratnakar Page 27
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Users caioiott read write aiod execgute each tther's fles withtgut permissitio.
Wheioe er a guser is created a mail btx is created aguttmatcally iio /var/spool/mail
ltcattio.
Aiod stme guser eio irtiomeiotal fles like .bash_ltitgut .bash_prtfle .bashrc ...etc. are
alst ctpied frtm /etc/skell tt his/Sher htme directtry (/home/<username>)..
5. What are fields available in /etc/passwd file?
<guser ioame> : x : <guid> : <iid> : <ctmmeiot> : <guser's htme directtry> : <ltiiio
shell>
(where 'x' meaios liiok tt passwtrd fle ie. /etc/shadow fle).
6. What are fields available in /etc/shadow file?
guser ioame : passwtrd : last chaioied : miio. days : max. days : wario days : iioact e days : expiry
days : reser ed
ftr fgutgure
7. What are the files that are related to user management?
/etc/passwd -----> Sttres guser's iioftrmattio like guser ioame guid htme directtry aiod
shell ...etc.
/etc/shadow ----> Sttres guser's passwtrd iio eiocrypted ftrm aiod tther iioftrmattio.
/etc/group ------> Sttres irtgup's iioftrmattio like irtgup ioame iid aiod tther iioftrmattio.
/etc/gshadow ---> Sttres irtgup's passwtrd iio eiocrypted ftrm.
/etc/passwd- ---> Sttres the /Setc/Spasswd fle backgup ctpy.
/etc/shadow- ---> Sttres the /Setc/Sshadtw fle backgup ctpy.
/etc/default/useradd ----> Wheioe er the guser created guser's defagult setiois takeio frtm
this fle.
/etc/login.defs ----> guser's ltiiio defagults setiois iioftrmattio takeio frtm this fle.
/etc/skell ------> Sttres guser's all eio irtiomeiotal ariables fles aiod these are ctpied frtm
this directtry tt
guser's htme directtry.
8. In how many ways can we create the users?
(i). # guseradd - <tpttios><guser ioame>
(ii). # addguser - <tpttios><guser ioame>
(iii). # ioewgusers <fle ioame> (Iio this fle we ha e tt eioter the guser details same as
/etc/passwd fle).
9. What is the syntax ofuseradd command with full options?
# guseradd -gu <guid> -i <iid> -G <sectiodary irtgup> -c <ctmmeiot> -d <htme directtry> -s
<shell><guser ioame>
Example : # guseradd -gu 600 -i 600 -G ja a -c "tracle guser" -d /Shtme/Srajgu -s /Sbiio/Sbash
rajgu
10. What is the syntax of adduser command with full options?
# addguser -gu <guid> -i <iid> -G <sectiodary irtgup> -c <ctmmeiot> -d <htme directtry> -s
<shell><guser ioame>
Ratnakar Page 28
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Example : # addguser -gu 700 -i 700 -G liiogux -c "tracle guser" -d /Shtme/Sram -s /Sbiio/Sbash
ram
11. What is the syntax of newuser command?
# ioewgusers <fle ioame> (This ctmmaiod will create mgultple gusers at a tme).
* First we shtguld a fle aiod eioter guser's data as felds same as the felds tf /Setc/Spasswd fle ftr
htw maioy gusers dt ytgu waiot tt create aiod meiottio that fle as aio arigumeiot ftr ioewgusers
ctmmaiod.
* Wheio we execgute this ctmmaiod ioew gusers will be created bgut their eio irtiomeiotal fles like
.bash_logout, .bash_profile, .bashrc aiod .bash_history fles will iott be ctpied frtm /etc/skell
directtry. St we ha e tt ctpied maiogually frtm /etc/skell directtry.
12. What is the syntax of userdel command with full options?
# guserdel <tpttios><guser ioame>
* The tpttios are -f -----> ftrcefgully delete the guser e eio thrtguih the guser is ltiiio. The
guser's htme directtry mail aiod messaie directtries are
alst deleted.
-r -----> recgursi ely meaios fles iio the guser's htme directtry will be
deleted aiod his htme directtry alst deleted bgut the
tther fles beltiois tt that guser shtguld be deleted
maiogually.
Ratnakar Page 29
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 30
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 31
[Pick the date] [LINUX NOTES FOR LEVEL 2]
warioiioi - 7 -----> meaios a warioiioi will be ii eio tt the guser abtgut the passwtrd
expiry 7 days beftre expiry date.
(ii). sectiod by execgutioi the # chage ctmmaiod.
Example : # chaie <tpttios><guser ioame>
The tpttios are -d -----> last day
-E -----> expiry date
-I -----> iioact e days
-l -----> list all the ptlicies
-m -----> miio. days
-MB -----> max. days
-w -----> warioiioi days
Note : Wheioe er we chaioie the passwtrd aiiioi ptlicy gusiioi # chage ctmmaiod the
iioftrmattio is will be mtdifed iio /etc/shadow fle.
29. How add 45 days to the current system date?
# date -d "+ 45 days"
30. Explain the sudo user?
Sgudters (iotthiioi bgut sgudt gusers). alltws partcgular gusers tt rguio aritgus rttt guser
ctmmaiods withtgut ioeediioi a rttt passwtrd.
/etc/sudoers is the ctiofigurattio fle ftr sgudters tt ctiofigure the iotrmal guser as
pri ileied guser.
It is iott rectmmeioded tt tpeio this fle gusiioi # vim edittr becaguse this edittr caioiott
check the syiotax by defagult aiod whate er we typed iio that fle that will bliiodly sa e iio this
fle.
St tioe edittr is specially a ailable ftr tpeioiioi this fle ie. # visudo aiod all iotrmal gusers
caioiott execgute this ctmmaiod. Oioly rttt guser caio rguio this ctmmaiod.
Oioce this fle is tpeioed iotbtdy caio tpeio this fle aiaiio tio aiotther termiioal becaguse "The
file is busy"messaie is displayed tio the termiioal ftr secgurity reastios.
31. How to give diferent sudo permissions to normal users?
Opeio the /etc/sudoers fle by execgutioi #visudo ctmmaiod aiod it tt liioe iot. 98 aiod type
as
<User name> <Machine>= <Command>
root ALL=(ALL) ALL
raju All= ALL
----Sa e aiod exit this fle.
Note : Wheio we tryiioi tt sa e this fle if aioy syiotax errtrs iio this fle thtse errtrs are displayed
with liioe iot's aiod What you do ? (will be displayed here press 'e' tt edit this fle aiod mtdify
thtse errtrs tr mistakes aiod sa e this fle.
# sgu - rajgu (tt switch tt rajgu guser).
# sgudt guseradd <guseradd> (The iotrmal guser rajgu caio alst add the gusers tt the system).
Ratnakar Page 32
[Pick the date] [LINUX NOTES FOR LEVEL 2]
* We caio assiiio sgudt permissitios tt 'io' iot. tf gusers by specifyiioi ioames separated by
ctmmas ( ). tr liioe by liioe.
* Iiostead tf ii iioi all permissitios tt iotrmal guser we caio ii e tioly stme ctmmaiods.
Example : stgudeiot ALL=/Sgusr/Ssbiio/Sguseradd /Sgusr/Ssbiio/Sgusermtd
rajgu ALL=NOPASSWD:/Sgusr/Ssbiio/Sguseradd /Sgusr/Ssbiio/Sgusermtd
* We caio alst apply tt tioe irtgup tr irtgups as ftlltws.
* First create the gusers assiiio tioe irtgup tt thtse gusers aiod alst assiiio the passwtrds ftr that
gusers. Opeio /etc/sudoers fle by execgutioi the ctmmaiod # visudo aiod type as
ftlltws.
%<irtgup ioame> ALL=ALL
%tracle ALL=ALL tr iiodi idgual ctmmaiods separated by ctmmas
* We caio alst create tioe ctmmaiod alias aiod add stme ctmmaiods tt that alias aiod meiottio
that alias tt gusers as ftlltws.
Cmiod_Alias NETWORKING=/Sgusr/Ssbiio/Srtgute /Sgusr/Ssbiio/Sifctiofi
<guser ioame> <machiioes>=<ctmmaiod alias ioame>
rajgu ALL=NETWORKING
* We caio alst create tioe guser alias aiod add the gusers tt that alias aiod assiiio stme ctmmaiods
tt that alias as ftlltws.
User_Alias <guser alias ioame>=<guser1> <guser2> <guser3> .....
Example : User_Alias OURTEAMB=rajgu shyam ram itpal
OURTEAMB ALL=ALL (tt ii e all permissitios tf sgudt).
Defagults tmestamp_tmetgut=0 (wheioe er the sgudt guser execgutes aioy ctmmaiod theio it
will ask passwtrd
ftr e ery ctmmaiod).
* The abt e will apply tt all gusers iioclgudiioi rttt alst. If we waiot tt make it as tioly ftr iotrmal
gusers theio
Defagults : <guser1> <guser2> <guser3> tmestamp_tmetgut=0 (the system will ask
passwtrds ftr guser1
guser2 guser3 tt execgute sgudt ctmmaiods).
32. In which location the sudo user commands history is logged?
All the sgudt gusers ctmmaiods histtry is ltiied iio /var/log/secure fle tt make a rectrd tf
sgudt guser ctmmaiods.
# cat /S ar/Slti/Ssecgure (tt see the ctioteiots tf this fle).
# tailf /S ar/Slti/Ssecgure (tt see the gupdates tf this fle ctiotiogutgusly aiod press ctrl + c tt qguit
the tailf).
33. How to assign the password to normal user by him whenever first login to the system?
Wheioe er the guser is created aiod that guser is tryiioi tt ltiiio tt the system it will ask the
passwtrd. If the rttt guser is iott assiiio the passwtrd tt that guser theio that iotrmal guser caio
assiiio the passwtrd by his twio gusiioi the ftlltwiioi ctmmaiods.
# guseradd <guser ioame> (tt create the guser).
Ratnakar Page 33
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# passwd -S <guser ioame> (tt see the statgus tf the passwtrd tf that guser. if rttt guser is
iott assiiioed the passwtrd theio
the passwtrd statgus is locked).
# passwd -d <guser ioame> (theio delete the passwtrd ftr that guser).
# chaie -d 0 <guser ioame> (it will chaioie the passwtrd aie ptlicy).
# sgu - <guser ioame> (Try tt switch tt that guser theio it will display the ftlltwiioi
messaie).
Newpasswtrd : (type ioew passwtrd ftr that guser).
Retype passwtrd : (retype the passwtrd aiaiio).
The other useful commands :
# w (this ctmmaiod ii es the ltiiio guser iioftrmattio like htw maioy gusers cgurreiotly ltiiio
aiod their
prtcesses).
# wht (tt see gusers wht are cgurreiotly ltiiio aiod tio which termiioal they ltiiio).
# last (see the list tf gusers wht are ltiiio aiod ltitgut siioce the /var/log/wtmp fle was
created).
# lastb (tt see the list tf the gusers wht tried as bad ltiiios).
# lastrebttt (tt see all rebttts siioce the lti fle was created).
# guptme (tt see the iioftrmattio frtm htw ltioi the system is rguioioiioi htw maioy
gusers ltiiio aiod ltad
a eraie).
* The ltad a eraie is frtm 1 sec : 5 secs : 15 secs
# df (tt see the mtguioted partttios their mtguiot ptiiots aiod amtguiot tf disk
space).
# dgu (tt see the disk gusaie tf the each fle iio bytes).
# guioame -r (ii es the cgurreiot kerioel ersitio).
# last -x (It shtws last shgutdtwio date aiod tme).
# last -x irep shgutdtwio (tioly shgutdtwio tme shtws ie. irep will flter the 'last -x'
ctmmaiod).
* grep: It is gused tt search a wtrd tr seioteioce iio fle (ie. iioside the fle).
* find : It is gused tt search a ctmmaiod tr fle iioside the system).
# cat /Setc/Sshells tr # chsh -l (tt see htw maioy shells that are sgupptrted by Liiogux).
/Sbiio/Ssh -----> defagult shell ftr Uioix
/Sbiio/Sbash -----> defagult shell ftr Liiogux
/Ssbiio/Siotltiiio -----> gusers caioiott ltiiio shell
/Sbiio/Stcsh -----> c shell tt write 'C++' laioiguaie prtirams
/Sbiio/Scsh -----> c shell tt write 'C' laioiguaie prtirams
# echt $SHELL (tt see the cgurreiot shell).
# chsh <guser ioame> (tt chaioie the guser's shell).
Chaioiiioi shell ftr <guser ioame> :
Ratnakar Page 34
[Pick the date] [LINUX NOTES FOR LEVEL 2]
New shell : <type ioew shell ftr example /Sbiio/Ssh tt chaioie the cgurreiot shell>
New shell chaioied ( gut it will efeect by restartioi the ser er).
# date + %R (tt display the tme tioly).
# date + %x (tt display the date tioly).
# histtry (tt see the histtry tf the ctmmaiods).
#histtry -c (tt clear the histtry).
# histtry -r (tt rect er the histtry).
* .bash_history is the hiddeio fle tt sttre the histtry tf the guser ctmmaiods. y defagult
histtry sise is 1000.
# echt $HISTSIZE (tt check the cgurreiot histtry sise).
# exptrt HISTSIZE=500 (tt chaioie the cgurreiot histtry sise tt 500 temptrarily).
#exptrt HISTTIMBEFORMBAT=" "%D" "%T" " (tt display the date aiod tme tf each
ctmmaiod temptrarily).
# im /Setc/Sbashrc (tpeio this fle it tt last liioe aiod type as ftlltws tt make histtry sise
date & tme
ftrmats permaioeiotly).
HISTSIZE=1000
HISTTIMBEFORMBAT=' %D %T '
(sa e aiod exit the fle aiod tt gupdate the efeects by #source /etc/bashrc ctmmaiod).
# ~<guser ioame> (tt it tt gusers htme directtry).
# whats <ctmmaiod> (tt see the shtrt descripttio tf that ctmmaiod).
# whereis <ctmmaiod> (tt see the ltcattio tf that ctmmaiod aiod ltcattio tf the dtcgumeiot
tf that
ctmmaiod).
# reset (tt refresh the termiioal).
# whtami (tt see the cgurreiot guser ioame).
# wht a mi (tt see the cgurreiot guser with fgull details like ltiiio tme aiod tthers).
# passwd <guser ioame> (tt chaioie the passwtrd tf the guser).
# id (tt see the cgurreiot guser ioame guser id irtgup ioame aiod irtgup id ....
etc. ).
# id <guser ioame> (tt see the specifed guser ioame guser id irtgup ioame aiod irtgup id).
# sgu (tt switch tt rttt guser withtgut rttt guser htme directtry).
# sgu - (tt switch tt rttt guser with rttt guser htme directtry).
# sgu <guser ioame). (tt switch tt the specifed guser withtgut his htme directtry).
# sgu - <guser ioame> (tt switch tt the specifed guser with his htme directtry).
# lspci (tt list all the PCI sltts preseiot iio the system).
# dgu -sh /Setc/S (tt see the sise tf the /etc tio the disk iio K s tr MB s).
# ls -l (tt see the ltioi listioi tf the fles aiod directtries).
d rwx rwx rwx . 2 rttt rttt 6 Dec 17 18:00 File ioame
d -----> type tf fle
Ratnakar Page 35
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# ls -ld <directtry ioame> (tt see the ltioi listioi tf the directtries).
# stat <fle ioame/Sdirecttry ioame> (tt see the statstcs tf the fle tr directtry).
34. How many types of the files are there?
There are 7 types tf fles.
1. - -----> reigular fle
2. d -----> directtry
3. c -----> character de ice fle (Ex. ctiostle fle tpeio aiod cltse termiioals ...etc. ).
4. b -----> bltck de ice fle (Ex. de ice bltcks like hard disks CD/SDVD disks).
5. s -----> stcket fle (prtirammers will deal this fle).
6. p -----> pipe fle (prtirammers will deal this fle).
7. l -----> liioked fle (iotthiioi bgut shtrt cgut fle).
35. What are permission types available in Linux and their numeric representations?
There are maiioly three types tf permissitios a ailable iio Liiogux aiod thtse are
read ----- r ----- 4 iogull permissitio ------ 0
write ----- r ----- 4
execgute ----- r ----- 4
Permissitios File Directtry
r Read a fle Ex. # cat <fle ioame> Read a directtry ctioteiots Ex. ls /Sdir
Create delete tr mtdify the fles iio a
w Create delete tr mtdify the fle ctioteiots
directtry
Ntt reqguired ftr fle. It is reqguired tioly ftr
x Gt tt iioside the directtry Ex. # cd /Sdir
scriptioi fles
Ratnakar Page 36
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 37
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 38
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 39
[Pick the date] [LINUX NOTES FOR LEVEL 2]
RHEL - 6 :
(i). Restart the system.
(ii). Select 1st tpttio aiod press 'e'.
(iii). Select 2iod tpttio aiod press 'e'.
(i ). At the eiod ii e tioe blaiok space aiod type 1 aiod press Eioter key.
( ). Theio press 'b' tt bttt the system iio siioile guser mtde.
( i). Theio prtmpt appears aiod type # passwd root ctmmaiod.
New passwtrd : XXXXXX
Retype passwtrd : XXXXXX
( ii). Exit
( iii). Theio system starts as gusgual.
RHEL - 7 :
(i). Restart the system.
(ii). Usiioi arrtw keys select 1st liioe aiod press 'e' tt edit.
(iii). Gt tt Linux 16 liioe press Eiod key tr Ctrl + e tt it tt the eiod tf the liioe aiod ii e tioe
space.
(i ). Theio type as rd.break console=ty1 selinux=0
( ). Theio press Ctrl + x tt start the ctmpguter iio siioile guser mtde.
( i). Afer startioi we iet swith_root :/# prtmpt appears aiod theio type as ftlltws.
( ii). # mount -o remount, rw /sysroot aiod press Eioter aiod theio type as ftlltws.
( iii). # chroot /sysroot press Eioter.
(ix). Theio sh - 4.2 # prtmpt appears aiod type as
(x). sh - 4.2 #passwd root
New passwtrd : XXXXXX
Retype passwtrd : XXXXXX
(xi). sh - 4.2 # exit
(xii). switch-root :/# exit
(xiii). Theio the system starts aiod the deskttp appears.
49. How to restrict the users from login?
(i). y remt iioi (deletioi). the guser we caio restrict the guser frtm ltiiio.
(ii). Pgut the guser's htstioames as eiotries iio /etc/hosts.deny fle (applyiioi TCP wrappers)..
(iii). #passwd -l <user name> (by ltckiioi his passwtrd we caio restrict the gusers)..
50. How to put never expiry to a user?
# passwd -x -1 <guser ltiiio ioame>
51. Which one is the default sticky bit directory?
/tmp is the defagult stcky bit directtry.
52. What is the purpose of the profiles?
(i). Prtfle is a fle tt eioter stme setiois abtgut gusers wtrkiioi eio irtiomeiot. ie. we caio set guser
htme directtry ltiiio shell path ...etc.
Prtfles are twt types.
Ratnakar Page 40
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 41
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 42
[Pick the date] [LINUX NOTES FOR LEVEL 2]
exceeded his maximgum alltwed attempts. Otherwise the acctguiot is ltcked guiotl the ltck is
remt ed by a maiogual iioter eiottio tf the system admiioistrattr.
magic_root : If the mtdgule is iio tked by a guser with guid=0 the ctguioter is iott iiocremeioted.
The sys-admiio shtguld guse this ftr guser laguioched ser ices like sgu ttherwise this arigumeiot
shtguld be tmitted.
no_magic_root : A tid rttt acctguiot ltckiioi if the mtdgule is iio tked by a guser with guid=0
Sa e aiod cltse the fle.
62. How to see the no. of failed logins of the users?
# faillti -gu <guser ioame> (tt see the specifed gusers failed
ltiiio attempts).
# faillti -a (tt see failed ltiiio attempts tf all
gusers).
# faillti -MB <MBax. iot> -gu <guser ioame> (tt set MBax. ltiiio failed attempts tt
that guser).
# faillti -MB 5 -gu rajgu (tt set MBax. ltiiio failed attempts tt
5 ftr guser rajgu).
63. What is disk quotas and how to enable them?
y ctiofiguriioi the disk qguttas we caio restrict the guser tt guse guiolimited space tio the fle system
aiod alst tt restrict the guiolimited fles iio the fle system. We caio ctiofigure the disk qguttas iio
ways. They are
(i). guser qguttas
(ii). irtgup qguttas
Steps to enable :
First check whether the qgutta packaie is iiostalled tr iott by # rpm -qa |grep quota
ctmmaiod. If qgutta packaie is iott Iiostalled theio iiostall the qgutta packaie by # yum install
quota* -y ctmmaiod.
# qguttatio (tt eioable the qgutta).
# qguttatfe (tt disable the qgutta).
# edqgutta (tt edit tr mtdify the qgutta).
# repqgutta (tt display tr reptrt the preseiot qgutta).
# qguttacheck (tt create a qgutta database).
* qguttas cab be applied tio fle systems tioly.
64. How to enable the user quota on a file system?
(i). Opeio the /etc/fstab fle by # vim /etc/fstabctmmaiod aiod ittt the mtguiot ptiiot eiotry
liioe aiod type as
/Sde /Ssdb1 /Smiot/Sprtd ext4 defagults gusrqgutta 0 0 (sa e aiod
exit this fle).
(ii). Update the qgutta tio mtguiot ptiiot by # mount -o remount, usrquota <mount point>
ctmmaiod.
Ratnakar Page 43
[Pick the date] [LINUX NOTES FOR LEVEL 2]
(iii). Create the guser qgutta database by # quotacheck -cu <mount point> ctmmaiod
(where -c meaios created the qgutta
database aiod -gu meaios guser qgutta)..
(i ). Check whether the qgutta is applied tr iott by # mount ctmmaiod.
( ). Eioable the qgutta by # quotaon <mount point> ctmmaiod.
( i). Apply the guser qgutta ftr a guser by # edquota -u <user name><mount point>
ctmmaiod.
File system bltcks stf hard iiotdes stf
hard
/Sde /Ssdb1 0 0 0 0 0
0
bltcks -----> Nt. tf bltcks gused (already).
stf -----> Warioiioi limit
hard -----> MBaximgum limit
0 -----> Uiolimited gusaie
iiotdes -----> Nt. tf fles created (already).
* If stf=10 aiod hard=15 meaios afer crtssiioi the stf limit a warioiioi messaie will be
displayed aiod if hard limit is alst crtsses theio it wtio't alltw tt create the fles ftr
that guser.
(sa e aiod exit the abt e qgutta edittr).
65. How to enable the quota on block level?
(i). Apply the guser qgutta ftr a guser by # edquota -eu <user name><mount point>
ctmmaiod.
File system bltcks stf hard iiotdes stf
hard irace peritd
/Sde /Ssdb1 0 5000 10000 0 0 0
6 days
(sa e aiod exit the qgutta edittr).
stf=5000 -----> meaios if it reaches guptt 5MB there is iot warioiiois. If it exceeds ie.
frtm 5MB - 10MB there will be warioiiois messaies displayed bgut
the fles will be created.
hard=10000 ---> If it reached tt 10MB theio it will iott alltw tt create the fles. The irace
peritd by defagult is 7 days. St we caio chaioie the irace peritd by
#edquota -t ctmmaiod here we caio chaioie the defagult 7
days irace peritd tt tgur reqguired days tf irace peritd.
irace peritd meaios if the guser iott created aioy fles withiio the irace peritd days the stf
limit bectmes as hard limit. ie. stf aiod hard limits are eqgual.
# edqgutta -p <guser ioame 1><guser ioame 2> (tt apply guser ioame 1 qguttas tt guser ioame
2 ie. iot ioeed tt edit
the qgutta edittr ftr guser ioame 2).
Ratnakar Page 44
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 45
[Pick the date] [LINUX NOTES FOR LEVEL 2]
1. What is Network?
Ctmbiioattio tf twt mtre ctmpguters ctioioected ttiether tt share their restgurces each tther by
meaios tf ctmmguioicattio like cable is called Netwtrk.
2. What is Networking?
It is a ctioioecttio betweeio twt tr mtre ctmpguters tt ctmmguioicate with each tther.
3. what are the basic requirements for networking?
(a). NIC (Netwtrk Iioterface Card tr ctiotrtller).
(b). MBedia (iotthiioi bgut cables).
(c). Ttptltiy
(d). Prtttctl
(e). IP Addresses
4. Explain about NIC card?
A Netwtrk Iioterface Card tr ctiotrtller is hardware ctmptioeiot that ctioioects a ctmpguter tt a
ctmpguter ioetwtrk. Each NIC card will be ha iioi MBAC (MBedia Access Ctiotrtller). address tt
a tid ctioficts betweeio same NIC adapters. Iio Liiogux these NIC adapter is represeioted by the wtrd
"eth" . Ftr example if twt NIC cards are there iio a system theio it will be deiotted as
"eho","eth1", .....etc.
5. What is media?
MBedia is iotthiioi bgut cable tt ctioioect twt tr systems. Example : RJ 45, CAT 5 aiod CAT 6
....etc.
6. What is topology?
Ttptltiy is a desiiio iio which the ctmpguters iio ioetwtrk will be ctioioected tt each tther.
Example ftr ttptltiies are gus Riioi Star MBesh Tree ttptltiies.
7. What is protocol?
A Network Protocol defioes rgules aiod ctio eiottios ftr ctmmguioicattio betweeio the ioetwtrk
de ices. Prtttctls are ieioerally guse packet switchiioi techioiqgues tt seiod aiod recei e messaies
iio the ftrm tf packets.
Example ftr prtttctls are TCP/IP (Traiosmissitio Ctiotrtl Prtttctl aiod Iioterioet Prtttctl). UPD
(User Datairam Prtttctl). aiod HTTP (Hyper Text Traiosfer Prtttctl). ....etc.
8. What are the diferences between TCP/IP and UDP protocols?
TCP/SIP UDP
Traiosmissitio Ctiotrtl Prtttctl User Datairam Prtttctl
It is ctioioecttio trieioted It is ctioioecttio less
Reliable Ntio-Reliable
TCP Ackiotwlediemeiot will be seiot /S recei ed Nt Ackiotwlediemeiot
Sltw ctmmguioicattio Fast ctmmguioicattio
Prtttctl Nt. ftr TCP is 6 Prtttctl Nt. ftr UDP is 17
HTTP FTP SMBTP ....etc. guses TCP DNS DHCP ....etc. guses UDP
9. What is an IP address?
Ratnakar Page 46
[Pick the date] [LINUX NOTES FOR LEVEL 2]
E ery Ctmpguter will be assiiioed aio IP address tt ideiotfy each tioe tt ctmmguioicate iio the
ioetwtrk. The IP address sgub ctmptioeiots are Classes tf aio IP address Sgubioet masks aiod
Gateway.
Classes of IP address :
The IP addresses are fgurther di ided iiott classes. The classes are A C D E aiod the raioies
are ii eio beltw.
Class Start Eiod Defagult Sgubioet mask Classless Iioter Dtmaiio Rtgutioi
Class A 0.0.0.0 127.255.255.255 255.0.0.0 /S8
Class 128.0.0.0 191.255.255.255 255.255.0.0 /S16
Class C 192.0.0.0 223.255.255.255 255.255.255.0 /S24
Class D 224.0.0.0 239.255.255.255
Class E 240.0.0.0 255.255.255.255
Ratnakar Page 47
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# cat /etc/resolve.conf (This fle keeps the address tf the DNS ser er tt which the clieiots
will be accessiioi tt restl e IP address tt
htstioame aiod htstioame tt IP address).
15. What are the diferences between MAC and IP addresses?
MAC Address IP Address
It is a permaioeiot address. St we caioiott chaioie this It is a temptrary address. St we caio chaioie this
address. address aioy iot. tf tmes.
It staiods ftr MBedia Access Ctiotrtl Address. Iioterioet Prtttctl address.
It is a physical address. It is a ltiical address.
It is twt types.
IPV4 :(It is di ided iiott 4 parts ).
It is di ided iiott 6 parts. --- . --- . --- . --- (each 8 bits. St 8 X 4 = 32 bits
--- : --- : --- : --- : --- : --- (each 8 bits. St 8 X 6 = 48 bits IPV6 : ( It is di ided iiott 16 parts ).
--- . --- . --- . --- . --- . --- . --- . --- . --- . --- . --- . --- .
--- . --- . --- . --- (each 8 bits. St 8 X 16 = 128 bits.
ifconfig (tt see the MBAC address). # ifconfig (tt see the IP address).
16. How many types of NIC cards available?
(a). eth0 (1st NIC card).
(b). eth1 (2iod NIC card).
(c). br0 ( ridie -----> gused ftr ctmmguioicattio frtm physical tt irtgual).
(d). lt (lttpback de ice ioame aiod IP address is 127.0.0.1).
# ifctiofi (tt see all the NIC de ices ctioioected tt the system).
17. How many types of cable connections available?
(i). Crtss cable (tt ctioioect twt systems directly).
(ii). Straiiht cable (tt ctioioect mtre systems with the help tf switch).
# ethtttl <de ice ioame> (tt check the ioetwtrk cable is ctioioected tr iott).
# miitttl <de ice ioame> (It is alst gused tt check the ioetwtrk cable bgut it will iott
sgupptrts RHEL - 7 aiod tioly sgupptrts RHEL - 6 aiod it alst wtrks tio
physical system tioly iott tio irtgual system).
18. In how many ways we can configure the network?
There are twt ways tt ctiofigure the ioetwtrk.
(a). Statc Netwtrk.
(b). Dyioamic Netwtrk.
Static Network :
Iio this way we assiiio the IP address aiod htstioame maiogually. Oioce we ctiofigure the IP address
it will iott chaioie.
Dynamic Network :
Iio this way we assiiio the IP address aiod htstioame dyioamically. This meaios the IP address will
chaioie at e ery bttt.
19. How to assign the static IP address to the NIC card?
Ratnakar Page 48
[Pick the date] [LINUX NOTES FOR LEVEL 2]
In RHEL - 6 :
# setgup
(MBt e the cgurstr tt Netwtrk ctiofigurattio aiod press Eioter key).
(MBt e the cgurstr tt De ice ctiofigurattio aiod press Eioter key).
(Select the NIC adapter ie. eth0 aiod press Eioter key).
(Assiiio the abt e IP address aiod tther details as per tgur reqguiremeiots aiod mt e the cgurstr tt
"OK" aiod press
Eioter key).
(MBt e the cgurstr tt "Sa e" tt sa e the chaioies iio de ice ctiofigurattio aiod press Eioter key).
(Oioce aiaiio mt e the cgurstr tt "Sa e & Qguit" bgutttio aiod press Eioter key).
(Fiioally mt e the cgurstr tt "Qguit" bgutttio aiod press Eioter key tt qguit the gutlity).
(Theio restart the ioetwtrk ser ice aiod check ftr the IP address by # service network restart
ctmmaiod).
(If the chaioie is iott refected with the abt e ser ice theio restart the ioetwtrk maioaier by
# service NetworkManager restart
ctmmaiod).
# ifctiofi (tt see the IP address tf the NIC card).
# piioi < IP address > (tt check whether the IP is piioiiioi tr iott).
In RHEL - 7 :
# iomcli ctioioecttio shtw (tt see all the ioetwtrk ctioioecttios).
# iomcli de ice shtw (tt see the ioetwtrk details if already ctiofigured maiogually tr
dyioamically).
# iomcli ctioioecttio add ctio-ioame "System eth0" ifioame eth0 type etherioet (tt add the
ioetwtrk ctioioecttio).
# iomcli ctioioecttio mtdify "System eth0" ip 4.addresses ' < IP address >/S< ioetmask ><
iateway > ' ip 4.dios < dios ser er IP address > ip 4.dios-search < dtmaiio ioame>
ip 4.methtd <statc tr maiogually> (tt assiiio IP address iateway dios dtmaiio ioame
aiod ctiofigure the ioetwtrk as statc tr maiogually).
# iomcli ctioioecttio gup "System eth0" (tt gup the ctioioecttio).
# systemctl restart ioetwtrk (tt restart the ioetwtrk ser ice).
# systemctl eioable ioetwtrk (tt eioable the ioetwtrk ser ice).
# ifctiofi (tt see the IP address tf the NIC card).
# piioi < IP address > (tt check whether the IP is piioiiioi tr iott).
20. What are the diferences between RHEL - 6 and RHEL - 7 network configuration files?
RHEL - 6 RHEL - 7
/etc/sysconfig/network-scripts is the directtry /etc/sysconfig/network-scripts is the directtry
which ctiotaiios the NIC ctiofigurattio iioftrmattio. which ctiotaiios the NIC ctiofigurattio iioftrmattio.
/etc/sysconfig/network-scripts/ifcfg-<device name> /etc/sysconfig/network-scripts/ifcfg-<device name>
is the fle which ctiotaiios the NIC ctiofigurattio details. is the fle which ctiotaiios the NIC ctiofigurattio details
/etc/resolve.conf is the fle which ctiotaiios DNS /etc/resolve.conf is the fle which ctiotaiios DNS
Ratnakar Page 49
[Pick the date] [LINUX NOTES FOR LEVEL 2]
ser er IP aiod dtmaiio ioame ltcattio. ser er IP aiod dtmaiio ioame ltcattio.
/etc/sysconfig/network is the htstioame
/etc/hostname is the htstioame ctiofigurattio fle.
ctiofigurattio fle.
/etc/hosts is the fle which ctiotaiios the ltcal DNS /etc/hosts is the fle which ctiotaiios the ltcal DNS
ser er IP address. ser er IP address.
21. What are the diferences between Dynamic and Static configuration information?
Dynamic configuration information Static configuration information
Device =<NIC de ice ioame> Device =<NIC de ice ioame>
HWADDR=02:8a:a6:30:45 HWADDR=02:8a:a6:30:45
Bootproto=DHCP Bootproto=iotioe (meaios statc ioetwtrk).
Onboot=yes (yes meaios wheioe er we restart the
system this ctioioecttio will be act ated aiod no
Onboot=yes
meaios wheioe er we restart the system the
ctioioecttio will be deact ated).
Type=Etherioet Type=Etherioet
Userctl=yes/Siot ----> If it is yes all iotrmal gusers caio Userctl=yes/Siot ----> If it is yes all iotrmal gusers caio
disable the NIC card aiod If it is no except rttt guser disable the NIC card aiod If it is no except rttt guser
iotbtdy caio disable the NIC card. iotbtdy caio disable the NIC card.
RHEL - 7 :
# htstioame <fgully qgualifed dtmaiio ioame> (tt set the htstioame
temptrarily).
# htstioamectl set-htstioame <fgully qgualifed dtmaiio ioame> (tt set the htstioame
permaioeiotly).
# systemctl restart ioetwtrk (tt gupdate the htstioame iio
the ioetwtrk).
# systemctl eioable ioetwtrk (tt eioable the ctioioecttio at
ioext rebttt).
23. How to troubleshoot if the NIC is notworking?
(a). First check the NIC card is preseiot tr iott by # ifconfig ctmmaiod.
(b). If preseiot theiocheck the statgus tf the NIC card is eioabled tr disabledby click tio System
meiogu tio the statgus bar theio select Netwtrk Ctioioecttios meiogu.
Ratnakar Page 50
[Pick the date] [LINUX NOTES FOR LEVEL 2]
(c). Click tio IPV4 setiois tab select the de ice eth0 tr aioy tther aiod select Eioable bgutttio
theio Apply aiod OK.
(d).Opeio /etc/sysconfig/network-scripts/ifcfg-eth0 fle check Userctl=yes tr iot. If it is yes
make it as iot theio check Oiobttt= yes tr iot. If it is iot make it as yes aiod sa e that fle.
(e). If iott preseiot theiocheck the statgus tf the NIC card is eioabled tr disabled by click tio System
meiogu tio the statgus bar theio select Netwtrk Ctioioecttios meiogu.
(f). Click tio IPV4 setiois tab select the de ice eth0 tr aioy tther aiod select Eioable bgutttio theio
Apply aiod OK.
(i). Usiioi # setup (iio RHEL - 6). tr # nmcli (iio RHEL - 7). ctmmaiods assiiio the IP address tt the
system aiod restart the ioetwtrk ser ice by # service network restart (iio RHEL - 6). tr #
systemctl restart network (iio RHEL - 7). ctmmaiods aiod eioable the ser ice at ioext rebttt
by # chkconfig network on (iio RHEL - 6). tr # systemctl enable network (iio RHEL - 7).
ctmmaiods.
(h). Theio gup the ctioioecttio by # ifconfig eth0 up (iio RHEL - 6). tr # nmcli connection up
<connection name> ctmmaiods.
(i). E eio thtguih it is iott wtrkiioi may be the fagult iio NIC card. If st ctiotact the hardware eiodtr
by takiioi the permissitios frtm hiiher aguthtrites.
24. What is bonding and how to configure bonding? (from RHEL - 6)
What is link aggregation or bridging or teaming and how to configure teaming? (from RHEL -
7)
Bonding or Teaming or Bridging:
Ctllecttio tf mgultple NIC cards aiod make them as siioile ctioioecttio ( irtgual). NIC card is called
btiodiioi.
It is iotthiioi bgut backgup tf NIC cards.
Iio RHEL - 6 it is called as tiodiioi tr ridiiioi.
Iio RHEL - 7 it is called as Teamiioi tr Liiok aiireiattio.
There are 3 types tf backgup iio tiodiioi tr Teamiioi.
(a). MBtde 0 -----> Rtguiod Rtbbiio
(b). MBtde 1 -----> Act ebackgup
(c). MBtde 3 -----> rtadcastioi
Mode 0 :
It prt ides ltad balaiociioi aiod fagult ttleraioce.
Data will be shared by btth NIC cards iio rtguiod rtbbiio.
If tioe NIC card failed theio aiotther NIC card will be act ated tt ctmmguioicate with the
ser er
St there is a ltad balaiociioi aiod fagult ttleraioce featgures.
Mode 1 :
Act ebackgup meaios tioly tioe NIC card is act ated at a tme aiod aiotther tioe is iio dtwio
state.
St there is iot ltad balaiociioi.
Ratnakar Page 51
[Pick the date] [LINUX NOTES FOR LEVEL 2]
gut if tioe NIC card is failed theio aiotther NIC card will be act ated aguttmatcally.
Mode 3 :
Iio this mtde brtadcastioi is dtioe.
Iio this the same data will be traiosferred thrtguih twt NIC cards.
St there is iot ltad balaiociioi.
gut if tioe NIC card is failed theio sectiod NIC card will be act ated aguttmatcally.
St all the 3 mtdes are sgupptrts tioly fagult ttleraioce bgut rtguiod rtbbiio is the tioly tioe mtde
that prt ides ltad balaiociioi.
Requirements to configure :
(i). MBiioimgum twt NIC cards.
(ii). Oioe IP address.
(iii).Ctioioecttio type is btiod (iio RHEL - 6). aiod team (iio RHEL - 7). iott the etherioet type.
Here iot ioeed tt assiiio the IP addresses ftr twt NIC cards aiod we are ii iioi tioly tioe IP
address tt btiod tr team.
Bonding configuration : (iio RHEL - 6).
(i). # im /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-btiod0
DEVICE=btiod0
IP ADDR=<IP address>
TYPE=etherioet
NETMBASK=255.225.225.0 tr <IP address class ioetmask>
ON OOT=yes
OOTPROTO=iotioe
USERCTL=iot
MBASTER=yes
ONDING_OPTS="mtde0 tr mtde1 tr mtde3 miimtio=50" (Sa e aiod exit this
fle).
(ii). im /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-eth1
DEVICE=eth1
ON OOT=yes
OOTPROTO=iotioe
USERCTL=iot
MBASTER=btiod0
SLAVE=yes (Sa e aiod exit this fle).
(iii). im /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-eth2
DEVICE=eth2
ON OOT=yes
OOTPROTO=iotioe
USERCTL=iot
MBASTER=btiod0
SLAVE=yes (Sa e aiod exit this fle).
Ratnakar Page 52
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 53
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 54
[Pick the date] [LINUX NOTES FOR LEVEL 2]
0 Ptwer tfe
1 Siioile guser
2 MBgult guser withtgut ioetwtrk
3 MBgultguser with ioetwtrk
4 De eltpmeiot pgurptse
5 GUI
6 Restart
# chkctiofi --le el 5 ser ice_ioame tio
# chkctiofi --le el 1234 ser ice_ioame tfe
35. What is a 3 way handshake protocol? Give an example of it.
SYN - system 1 seiods SYN siiioal tt remtte system.
SYN-ACK - remtte system recei es the syio siiioal aiod seiods ack siiioal.
ACK - system aiaiio recei es ack siiioal frtm remtte system aiod ctioioecttio is established.
For Example: Wheio ytgu piioi tt a machiioe ytgu are seiodiioi a SYN siiioal which is ACK by the
remtte machiioe theio it seiods a SYN ACK siiioal back tt the htst machiioe. Theio the htst
machiioe recei es SYN ACK aiod seiods the ACK siiioal back tt ctiofrm the same.
36. What are the possible ways to check if your system is listening to port 67?
# iomap ltcalhtst | irep 67
# ioetstat -iotgulp | irep 67
37. Explain about IPV6?
It's leioith is 128 bits. It's ioetmask is 64
# iomcli ctioioecttio mtdify "System eth0" ip 6.addresses 2005:db8:0:1::a00:1/S64
ip 6.methtd statc
(tt add the IPV6 ersitio tf IP address tt the ctioioecttio
"System eth0" ).
# iomcli ctioioecttio mtdify "System eth0" ip 4.addresses '172.25.5.11/S24 172.25.5.254'
ip 4.dios
172.25.254.254 ip 4.dios-search example.ctm ip 4.methtd statc ip 6. addresses
2005:ac18::45/S64
ip 6.methtd statc (tt assiiio ip 4 aiod ip 6 IP addresses tt "System
eth0 ctioioecttio).
# iomcli ctioioecttio dtwio "System eth0" (tt dtwio the "System eth0" ctioioecttio).
# iomcli ctioioecttio gup "System eth0" (tt gup the "System eth0" ctioioecttio).
38. How to troubleshoot if the network is not reaching?
(i). First check the ioetwtrk cable is ctioioected tr iott by # ethtool <NIC device name>
ctmmaiod. if ctioioected theio check the IP address is assiiioed tr iott by # ifconfig <NIC
device name> ctmmaiod.
(ii). Theio check the system guptme by # uptime ctmmaiod.
(iii). Theio check the ioetwtrk ser ices statgus by # service network status aiod # service
NetworkManager status ctmmaiods.
Ratnakar Page 55
[Pick the date] [LINUX NOTES FOR LEVEL 2]
(i ). Theio check the ioetwtrk ser ice at Rguio Le el by # Chkconfig --list network ctmmaiod.
( ). Theio check whether the stgurce ioetwtrk aiod destioattio ioetwtrk are iio the same dtmaiio tr
iott.
( ). Theio fioally check the rtgutioi table by # route -n ctmmaiod.
Ratnakar Page 56
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 57
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# piioi -I <NIC de ice ioame><IP address> (tt check the ctioioecttio frtm NIC de ice tt IP
address).
# htstioame <fgully qgualifed dtmaiio ioame> (tt set the htstioame temptrarily).
# htstioamectl set-htstioame <fgully qgualifed dtmaiio ioame> (tt set the htstioame
permaioeiotly iio RHEL - 7).
NOTE: Wheioe er we chaioie aioy parameters iio /etc/sysconfig/network-scripts/ifcfg-<NIC
device name> fle theio we ha e tt reltad that fle aiod aiaiio we ha e tt gup the ctioioecttio
(iotthiioi bgut act ate the ctioioecttio by # nmcli connection reload ctmmaiod.
# iomcli ctioioecttio reltad (tt reltad the ctiofigurattio tf the ctioioecttio if aioy chaioies tio it
aiod it reltads all
ctiofigurattio fles).
# iomcli ctioioecttio reltad /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-<NIC de ice ioame> (tt
reltad a siioile fle).
# htstioamectl statgus (it displays fgull details tf the htstioame aiod wtrks
iio RHEL - 7 tioly).
# iomcli ioetwtrkiioi tfe (tt disable all the ctioioecttios at a tme).
# iomcli de ice statgus (tt display all NIC de ice ctioioecttios
statguses).
# iomcli ctioioecttio mtdify <ctioioecttio ioame> + ip 4.dios <sectiodary dios ser er IP> (tt
add a sectiodary dios
ser er IP tt the existioi ctioioecttio).
# ioetstat -iotgulp (tt check htw maioy tpeio ptrts are there iio
ltcal system).
# ss -iotgulp ( " "
).
# iomap (tt check htw maioy tpeio ptrts are there iio
remtte system).
# tracepath (it displays the rtgutioi iioftrmattio).
# miitttl <NIC de ice ioame> (tt check the ioetwtrk cable is ctioioected tr
iott).
# ethtttl <NIC de ice ioame> ( " "
).
# ifctiofi (tt check the NIC card is eioable tr iott).
# ifgup <NIC de ice ioame> (tt eioable tr gup the NIC card).
#ifdtwio <NIC de ice ioame> (tt disable tr dtwio the NIC card).
# rtgute -io (tt check the iateway).
# cat /Setc/Srestl e.ctiof (tt check the dios ser er iioftrmattio).
# cat /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-<NIC de ice ioame> (tt see the NIC de ice
iioftrmattio).
# htstioame tr cat /Setc/Ssysctiofi/Sioetwtrk (tt check the htstioame iio RHEL - 6).
Ratnakar Page 58
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# htstioamectl statgus tr cat /Setc/Shtstioame (tt check the htstioame iio RHEL - 7).
# piioi <IP address> (tt check the ctioioecttio ctmmguioicattio).
# chkctiofi --list (tt list all the ser ices which are rguioioiioi at btt tme
iio RHEL - 6 & 7).
# systemctl list-guioit-fles (tt list all the prtcesses which are rguioioiioi at bttt
tme iio RHEL - 7).
# chkctiofi --le el <ser ice ioame> (it will set the ser ice at rguio le el 3 wheio the system
is btttioi).
# ser ice --statgus-all (tt see the list tf all the prtcesses which are
cgurreiotly rguioioiioi).
# ls /Setc/Siioit.d (is the ltcattio tf all the ser ices aiod deamtios iio
RHEL - 6).
# ls /Sgusr/Slib/Ssystemd/Ssystem (is the ltcattio tf all the ser ices aiod deamtios iio
RHEL - 7).
# /Setc/Src.ltcal (is the last script tt be rguio wheio the system is
btttioi).
(If we eioter as sshd stop at the last liioe tf the script fle theio sshd will be sttpped e eio
thtguih that
sshd is eioabled).
# ser ice sshd statgus (tt check the sshd statgus).
# ser ice --ser ice -all (tt see the prtcess ID tf all the ser ices).
# ioetstat -iotgulp (tt see all the ser ices with ptrt iot. statgus prtcess
ID aiod all tpeio ptrts iio ltcal system rtgutioi table
aiod NIC de ice iioftrmattio).
-io -----> ptrt iot. (iogumeric iot). -t ----->tcp prtttctl
-gu -----> gupd prtttctl -l -----> ptrt is listeioiioi tr iott
-p -----> display the prtcess ID
# ioetstat -r (tt see all rtgutioi table iioftrmattio).
# ioetstat -i (tt see all the NIC cards iioftrmattio).
# iomap (tt see the ioetwtrk mappiioi ie. tpeio ptrts list tio
remtte system).
Note : y defagult this ctmmaiod will iott a ailable. St frst iiostall the nmap packaie by # you
install nmap -y
# iomap <remtte system IP address> (tt see all the ser ices which are rguioioiioi iio the specifed
remtte system).
# iomap <remtte IP 1><remtte IP 2><remtte IP 3> (tt see the rguioioiioi ser ices tio specifed
remtte systems).
# iomap 172.25.0.11 - 50 (tt see the rguioioiioi ser ice tio 172.25.0.11 tt
172.25.0.50 systems).
Ratnakar Page 59
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# iomap -p 80 <remtte IP> (tt see the http ptrt is rguioioiioi tr iott tio specifed remtte
system).
# iomap -p 80 - 90 <remtte IP> (tt see ptrt iot's 80 tt 90 are rguioioiioi tr iott tio remtte
systems).
# iomap -sp 172.25.0.0/S24 (tt see all the systems which are iio gupstate ie. 172.25.0.1
172.25.0.2
(where s -- scaio & p -- piioi). 172.25.0.3 ......guptt
172.25.0.254 systems).
Opeio a fle write all the systems IP addresses sa e & exit the fle. Example has ii eio beltw
# im ctss
172.25.2.50
172.25.3.50
172.25.4.50 ....etc. (sa e aiod exit this fle).
# iomap -iL ctss (tt scaio all the IP addresses by readiioi the ctss fle).(where -i ---->
iiopgut -L ----> list).
# iomap --ifist (tt see all the rtgutioi table iioftrmattio iio the ioetwtrk).
# iomap 172.25.0.10 - 20 --exclgude 172.25.0.15 (tt scaio all the systems frtm 172.25.0.10
tt 172.25.0.20 systems aiod
exclgudiioi 172.25.0.15 system).
# iomcli ctioioecttio shtw --act e (tt ctiotrtl the ioetwtrk ctioioecttios).
# ip liiok (tt check the ioetwtrk ctioioecttio).
# piioi -I eth1 <IP address> (tt check the 2iod NIC card ctioioecttio).
Ratnakar Page 60
[Pick the date] [LINUX NOTES FOR LEVEL 2]
5. Managing SELinux
1. What is SELinux?
It is a tioe type tf secgurity that eiohaioces the secgurity that alltws gusers aiod admiioistrattrs mtre
ctiotrtl t er which gusers aiod applicattios caio access which restgurces sguch as fles Staiodard
Liiogux access ctiotrtls etc.
It is maiioly gused tt prttect iioterioal data (iott frtm exterioal data). frtm system ser ices. Iio real
tme SELiiogux is disabled aiod iiostead tf this IP tables are gused. It prttects all the ser ices fles
aiod directtries by defagult if SELiiogux is eioabled.
2. In how many ways we can implement the SELinux? Explain them.
We caio implemeiot the SELiiogux maiioly iio 2 mtdes.
(i). Eioabled
(ii). Disabled (defagult mtde).
Enabled :
Eioabled meaios eioabliioi the SELiiogux ptlicy aiod this mtde tf SELiiogux is di ided iiott twt parts.
(a). Eioftrciioi
(b). Permissi e
Ratnakar Page 61
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Disabled :
Disabled meaios disabliioi the SELiiogux ptlicy.
3. What is Enforcing mode in SELinux?
Eioftrciioi meaios SELiiogux is tio. It checks SELiiogux ptlicy aiod sttred a lti. Nt caio access the
ser ices by defagult bgut we caio chaioie the ptlicy wheioe er we ioeeded.
4. What is Permissive mode in SELinux?
SELiiogux is tio aiod it dtio't check SELiiogux ptlicy aiod sttred the lti. E erybtdy caio access the
ser ices by defagult aiod we caio alst chaioie the SELiiogux ptlicy. It is alst called as debguiiiioi
mtde tr trtgubleshtttioi mtde. Iio this mtde SELiiogux ptlicies aiod rgules are applied tt sgubjects
aiod tbjects bgut acttios are iott afeected.
5. What is Disabled mode in SELinux?
SELiiogux is tgurioed tfe aiod iot warioiioi aiod lti messaies will be ieioerated aiod sttred.
6. What are Booleans?
ttleaios are ariables that caio either be set as trgue tr false. ttleaios eiohaioce the efeect tf
SELiiogux ptlicies implemeioted by the System Admiioistrattrs. A ptlicy may prttects certaiio
deamtios tr ser ices by applyiioi aritgus access ctiotrtl rgules.
7. What is SELinux policy?
The SELiiogux ptlicy is the set tf rgules that iguide the SELiiogux secgurity eioiiioe. It defioes types ftr
fle tbjects aiod dtmaiios ftr prtcess. It guses rtles tt limit the dtmaiios that caio be eiotered aiod
the guser ideiottes tt specify the rtle that caio be attaiioed.
8. What are the required files for SELinux?
# im /Setc/Sseliiogux/Sctiofi -----> It is maiio fle ftr SELiiogux.
# im /Setc/Ssysctiofi/Sseliiogux -----> It is a liiok fle tt the abt e fle.
# im /S ar/Slti/Sagudit/Sagudit.lti -----> SELiiogux lti messaies will be sttred iio this fle.
9. what is the command to see the SELinux mode?
# ieteioftrce (tt check the SELiiogux mtde).
10. What is command to set the SELinux mode temporarily?
# seteioftrce 0 tr 1 (tt set the SELiiogux mtde. Where ' 0 ' -----> permissi e aiod ' 1 '
-----> Eioftrciioi).
Note : (i). Tt chaioie the SELiiogux mtde frtm Permissi e tt Eioftrciioi tr Eioftrciioi tt
Permissi e mtdes the system restart is iott reqguired.
(ii). Tt chaioie Eioftrciioi mtde tt Disabled mtde tr Disabled mtde tt Eioftrciioi mtde
the system restart is reqguired.
(iii). The abt e ctmmaiods are chaioied the SELiiogux mtde temptrarily tioly. Tt make the
seliiogux chaioies permaioeiotly theio tpeio /etc/selinux/config aiod it tt
SELINUX=Enforcing or Permissive or Disabled (sa e aiod
exit this fle).
11. What is command to see the SELinux policy details?
# sestatgus (tt see the SELiiogux ptlicy details).
Other useful commands :
Ratnakar Page 62
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 63
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 64
[Pick the date] [LINUX NOTES FOR LEVEL 2]
ltads the defagult kerioel imaie as specifed iio the irgub ctiofigurattio fle. GRU has the
kiotwledie tf the fle system (the tld LILO didio't guioderstaiod the system).. GRU
ctiofigurattio fle is /boot/grub/grub.conf (/etc/grub.conf is a liiok tt this).. This fle ctiotaiios
kerioel aiod iioitrd imaies. St iio simple terms GRU jgust ltads aiod execgutes kerioel aiod iioitrd
imaies.
Kernel :
Kerioel iioitalises itself aiod ltads the kerioel mtdgules aiod mtguiots the rttt fle system as
specifed iio the "rttt=" iio irgub.ctiof aiod theio kerioel execgutes the /sbin/init prtiram. Siioce iioit
was the 1st prtiram tt be execguted by Liiogux kerioel it has the prtcess ID (PID). tf 1. We caio see this
id by # ps -ef | grep init ctmmaiod. iioitrd staiods ftr iioital RAMB Disk. iioitrd is gused by kerioel
as temptrary fle system guiotl kerioel is bttted aiod the real rttt the fle system is mtguioted. It
alst ctiotaiios ioecessary dri ers ctmpiled iioside which helps it tt access the hard dri e partttios
aiod tther hardware.
init level :
Iio this iioit prtiram reads the /etc/initab fle aiod pgut the system iiott specifed rguio le el. iioit
ideiotfes the defagult rguio le el frtm /etc/initab fle aiod we caio chaioie the this defagult rguio le el
wheioe er we ioeeded. We caio fiod the defagult rguio le el by # grep "initdefault" /etc/initab
ctmmaiod tio tgur system. Ntrmally the
defagult rguio le el iio Liiogux is 3 iio CLI (Ctmmaiod Liioe Iioterface). mtde aiod 5 iio GUI (Graphical
User Iioterface). mtde.
Run Level Programs :
The ftlltwiioi rguio le els are a ailable iio Liiogux systems.
0 -----> halt tr shgutdtwio the system
1 -----> Siioile guser mtde
2 -----> MBgult guser withtgut NFS
3 -----> Fgull mgult guser mtde bgut iot GUI aiod tioly CLI mtde
4 -----> Uiogused
5 -----> Fgull mgult guser mtde with GUI (X11 system).
6 -----> rebttt the system
Wheioe er we start the Liiogux system is btttioi we caio see aritgus ser ices ietioi started.
Thtse ser ices are ltcated iio difeereiot rguio le els prtirams execguted frtm the rguio le el
directtry as defioed by tgur defagult rguio le el. Depeiodiioi tio tgur defagult iioit le el setioi the system
will execgute the prtirams frtm tioe tf the ftlltwiioi directtries.
Rguio le el 0 -----> /Setc/Src.d/Src0.d
Rguio le el 1 -----> /Setc/Src.d/Src1.d
Rguio le el 2 -----> /Setc/Src.d/Src2.d
Rguio le el 3 -----> /Setc/Src.d/Src3.d
Rguio le el 4 -----> /Setc/Src.d/Src4.d
Rguio le el 5 -----> /Setc/Src.d/Src5.d
Rguio le el 6 -----> /Setc/Src.d/Src6.d
Ratnakar Page 65
[Pick the date] [LINUX NOTES FOR LEVEL 2]
The abt e directtries are alst ha iioi symbtlic liioks a ailable ftr thtse directtries guioder
/etc/rc0.d, /etc/rc1.d, ....etc. St the /Setc/Src0.d is liioked tt /Setc/Src.d/Src0.d
Booting procedure in RHEL - 7:
Uptt kerioel the btttioi prtcess is same as the abt e. /boot/grub2/grub.conf is the GRU
ctiofigurattio fle iio RHEL - 7. systemd is the iioital prtcess iio RHEL - 7 aiod its prtcess ID is 1.
linux16 read the rttt ( /S ). fle system aiod theio initrd16prtcess will mtguiot the rttt ( /S ). fle
system iio read & write mtde aiod starts the systemdprtcess. Aiod the systemd prtcess will
read the /etc/fstab fle aiod mtguiot all the fle systems. Theio it reads the fle
/etc/systemd/system/default.target fle aiod briiois the system iiott the defagult rguio le el
acctrdiioi tt the scripts the prtcesses will start tr sttp.
2. How to check the current run level of the system?
# wht -r (tt see the preseiot rguio le el tf the system).
3. How to change the default run level?
First tpeio the /etc/initab fle by # vim /etc/initab ctmmaiod aiod it tt last liioe chaioie
the rguio le el iogumber as we reqguired aiod theio rebttt the system by # init 6 ctmmaiod. Afer
rebtttioi the system check the cgurreiot rguio le el by # who -r ctmmaiod.
4. How to start the graphical interface if the system is in run level 3 now?
# startx (it chaioies the rguio le el 3 tt 5 aiod rebttts the system).
5. How to troubleshoot if the boot disk is not available?
(i). First check the hard disk is preseiot iio the system tr iott. If iott preseiot ctioioect the hard disk
aiod restart the system.
(ii). If the hard disk is preseiot theio it tt IOS aiod fiod the ltcattio tf the hard disk.
(iii). Check the bttt pritrity iio the IOS. If bttt pritrity is iott the hard disk theio chaioie it tt
hard disk aiod restart the system.
(i ).E eio thtguih the system is iott started theio bttt the system with CDROMB iio siioile guser
mtde aiod tpeio the /Sbttt/Sirgub/Sirgub.ctiof fle aiod see the hard disk ioame aiod partttio
iogumber. Ntrmally it shtguld be /dev/hda1 (if the hard disk is IDE hard disk). tr
/dev/sda1 (if the hard disk is SATA tr SCSI).. If the hard disk ioame aiod partttio
iogumber is difeereiot iiostead tf the triiiioal theio chaioie them aiod rebttt the system
with hard disk.
( ).If the GRU is ctrrgupted theio rebttt the system with CDROMB iio siioile guser mtde aiod
resttre the irgub iioftrmattio frtm the receiot backgup aiod theio restart the
system with hard disk.
6. How to reboot the production server?
(i). Iio ieioeral the prtdgucttio ser ers will iott be rebttted freqgueiotly becaguse the eiod gusers will
sgufeer if the prtdgucttios ser er are iio dtwio state. If aioy chaioies made tt the system like
irgub seliiogux ptlicy defagult rguio le el is chaioied aiod if kerioel patches are applied the system
rebttt is reqguired.
(ii). If aioy iioctiosisteiocy is rttt ( /S ). fle system theio take the bgusiioess apprt al frtm hiiher
aguthtrites make a plaio ftr prtper schedguleaiod alst iioftrm tt the difeereiot teams like
Ratnakar Page 66
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 67
[Pick the date] [LINUX NOTES FOR LEVEL 2]
The prtcedgure that takes place betweeio twt TCP/SIP iotdes tt establish a ctioioecttio. Kiotwio as
the Syiochrtioisattio Syiochrtioise-Ackiotwlediemeiot aiod Ackiotwlediemeiot haiodshake.
Ftr example if ctmpguter A traiosmits a Syiochrtioise packet tt ctmpguter which seiods back a
Syiochrtioise- Ackiotwledie packet tt ctmpgute A. Ctmpguter A theio traiosmits aio Ackiotwledie
packet tt ctmpguter aiod the ctioioecttio is established. This whtle abt e said prtcess is called
the TCP haiodshakiioi.
11. How many links will be created when we create the directory?
Wheioe er we create aioy directtry there are twt liioks will be created.
12. What are the diferences between run level 2 and run level 3?
Run Level 2 :
(i). It sgupptrts mgultguser tperattios.
(ii). MBgultple gusers caio access the system.
(iii).All the system deamtios will rguio except NFS aiod stme tther ioetwtrk ser ice related
deamtios.
(i ).St withtgut NFS we caio guse all tther ser ices.
Run Level 3 :
(i). It is alst sgupptrts MBgult guser tperattios.
(ii). MBgultple gusers caio access the system.
(iii).All the system deamtios iioclgudiioi NFS aiod tther ioetwtrk related ser ice deamtios will
rguio.
(i ). St we caio a ail all the ser ices iioclgudiioi NFS alst.
13. Server running in single user mode, can you login remotely and how?
We caio ltiiio tt the system remttely iio siioile guser mtde alst bgut it is ptssible tt ctioioect tt
ctiostle iiostead tf LAN ptrt thrtguih pgutty tttl by ii iioi IP address guser ioame aiod passwtrd.
Theio ctiostle ptrt appears aiod bttt the system with CDROMB iio siioile guser mtde.
14. How to check the present kernel version?
# guioame -r (it displays the preseiot kerioel ersitio).
# guioame -a (it displays the preseiot kerioel ersitio with tther details).
# cat /Sbttt/Sirgub/Sirgub.ctiof (iio this fle alst we caio fiod the kerioel ersitio).
15. What is the command to see the system architecture?
# arch tr # guioame -m (btth ctmmaiods ii es the architectgure tf the system).
16. How to check the version of the O/S ?
# cat /Setc/Sredhat-release (ii es the ersitio tf the O/SS).
17. How to repair the corrupted boot loader and recover it?
This prtblems may be tccgur if the GRU is ctrrgupted. St we ha e tt rect er the GRU .
asically the repairiioi tf GRU meaios iiostalliioi the ioew irgub tio the existioi tioe frtm RHEL - 6
DVD. The steps are ii eio beltw.
(i). Iiosert the RHEL - 6 DVD aiod make sgure that system shtguld bttt frtm CD/SDVD.
(ii). ttt the system iio Rescgue Iiostalled System mtde.
(iii).Select the laioiguaie with which we waiot tt ctiotiogue aiod click tio OK.
Ratnakar Page 68
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 69
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# rpm -qa kerioel* (tt see htw maioy kerioels are there iio the
system).
# ls /Sprtc (tt see the kerioel prtcesses iioftrmattio).
# ls /Sbttt (tt see the preseiot kerioel ersitio created
tme). # ls /Setc/Slib/Smtdgules (iiostalled kerioel mtdgule dri ers).
# ls /Sgusr/Ssrc (kerioel stgurce ctde ltcattio).
# kgudsgu (tt scaio the ioew hardware iio RHEL - 4).
# depmtd (tt scaio the ioew hardware frtm RHEL - 5 6
aiod 7).
# rmmtd <mtdgule ioame> (tt remt e the specifed mtdgule).
# iiosmtd <mtdgule ioame> (tt iiostall the kerioel mtdgule withtgut
depeiodeiocy mtdgules).
20. How to see the run level?
# wht -r (tt see the cgurreiot rguio le el).
21. How to block the USB / CDROM driver?
# lsmtd |irep -i gusb (tt see the US mtdgule is ltaded tr iott).
# mtguiot (tt check the US is mtguioted tr iott).
# mtdprtbe -r gusb_sttraie (remt e the US mtdgule if it is mtguioted it
will iott remt e).
# gumtguiot /S<mtguiot ptiiot> (tt guiomtguiot the US if it is mtguioted).
# im /Setc/Smtdprtbe.d/Sbltcklist.ctiof (it will tpeio the bltcklist.ctiof fle theio pgut
aio eiotry tf US ).
bltcklist gusb_sttraie (afer type this sa e aiod exit this fle).
22. What is " wait " and where it is stored?
(i). If there is iott eiotguih memtry tt rguio the prtcess theio it will wait ftr free space iio memtry.
That prtcess is called wait.
(ii). wait is sttred iio bgufeer like cache memtry.
23. What is run level?
(i). Rguio le el is iotthiioi bgut tt pgut the system iio difeereiot le els tt perftrm difeereiot
maiioteioaioce mtdes.
(ii). There are 7 rguio le els. Thtse are 0 1 2 3 4 5 aiod 6.
(iii). The abt e le els are gused tt pgut the system iio difeereiot staies tt a ail difeereiot ser ices.
24. What is the default run level?
(i). Wheio we bttt the ser er the system aguttmatcally it tt tioe partcgular rguio le el. That rguio
le el is called the defagult rguio le el.
(ii). Iio Liiogux the defagult rguio le el is 5 iio GUI aiod 3 iio CLI.
(iii). We caio mtdify the defagult rguio le el by pgut aio eiotry iio /etc/initab fle.
25. Which run level are you using?
Rguio le el 3.
26. How to change the run level temporarily?
Ratnakar Page 70
[Pick the date] [LINUX NOTES FOR LEVEL 2]
7. Job Automation
Ratnakar Page 71
[Pick the date] [LINUX NOTES FOR LEVEL 2]
(iii).We caioiott iet the iioftrmattio as a lti fle if the jtb was failed tt execgute ie. wheio it was
failed aiod where is was failed aiod alst caioiott execgute aguttmatcally the failed jtbs.
at job :
(i). at jtbs are execgutes tioly tioce.
(ii). Here alst we caioiott iet the iioftrmattio if the jtb is failed aiod it is alst dt iott execgute the
failed jtbs aguttmatcally.
4. What are the important files related to cron and at jobs?
/etc/crontab -----> is the fle which sttres all the schedguled jtbs.
/etc/cron.deny -----> is the fle gused tt restrict the gusers frtm gusiioi crtio jtbs.
/etc/cron.allow -----> is gused tt alltw tioly gusers whtse ioames are meiottioed iio this fle
tt guse crtio jtbs aiod
this fle dtes iott exist by defagult.
/etc/at.deny ----->same as crtio.deioy ftr restrictioi the gusers tt guse at jtbs.
/etc/at.allow -----> same as crtio.alltw ftr alltwiioi gusers tt guse at jtbs.
5. What is the format of the cron job?
# crtiotab -e (tt edit the crtio jtb edittr tt create tr remt e the
crtio jtbs).
<miiogutes><htgurs><day tf the mtioth><mtioth tf the year><day tf the week><jtb tr script>
(0 - 59). (0 - 23). (1 - 31). (1 - 12 tr jaio feb ...). (0 - 6 tr sguio mtio ...).
Options Explanation
* Is treated as a wild card. MBeaioiioi aioy ptssible algue.
Is treated as e er 5 miiogutes htgurs days tr mtioths. Replaciioi he 5 with aioy iogumerical algue
*/S 5
will chaioie this tpttio.
2 4 6 Treated as aio OR st if placed iio the htgurs this ctguld meaio at 2 4 tr 6 t-cltck
Treats ftr aioy algue betweeio 9 aiod 17. St if placed iio day tf the mtioth this wtguld be days
9-17
9 thrtguih 17 tr if pgut iio htgurs it wtguld be betweeio 9 AMB aiod 5 PMB.
(ii). Pgut the eiotries tf the guser ioames whtm dt we (ii). Pgut the eiotries tf the guser ioames whtm dt we
waiot tt alltw the crtio jtbs. waiot tt deioy the crtio jtbs.
Ratnakar Page 72
[Pick the date] [LINUX NOTES FOR LEVEL 2]
(ii). atq meaios htw maioy at jtbs are iio qguegue by # atq ctmmaiod.
9. How to check the jobs?
# at -l (tt check the at jtbs).
10. How to add crontab entry in command mode?
(i). # defioe edittr= im (tt defioe the edittr as im).
(ii). # exptrt $edittr (exptrt the defioed edittr).
(iii).# crtiotab -e (tt edit the crtiotab).
11. How to troubleshoot if the cron job failed?
(i). See the crtiotab eiotries ftr syiotactcal errtrs. If there are aioy errtrs theio ctrrect them
ttherwise it will iott execgute.
(ii). Check whether the crond deamtio is wtrkiioi tr iott. If it is rguioioiioi theio sttp the deamtio
aiod aiaiio start the deamtio. E eio thtguih the prtblem tccgurs theio the crtiotab eiotries
may be wrtioi.
(iii).If all the abt e are tk theio see whether the guser wht execgutioi crtio jtb has permissitios
tt execgute the crtio jtbs tr iott ie. check the guser eiotries iio /etc/cron.allow aiod
/etc/cron.deny fles.
(i ). If all are tk aiaiio pgut the jtb eiotry iio crtiotab aiod execgute it.
12. How to schedule the cron task or job?
(i). Opeio tioe shell script fle.
(ii). Eioter all the ctmmaiods which are reqguired tt ctmplete the task tr jtb.
(iii).If the jtb reqguires mtre CPU aiod mtre memtry theio schedgule thtse jtbs at ioiiht tme tr
iotio-peak htgurs (ieioerally ioiiht tme is the iotio-peak tme)..
(i ). Theio tpeio crtiotab edittr by # crontab -e <user name> ctmmaiod aiod theio pgut the
eiotries as beltw
<miiogutes><htgurs><day tf the mtioth><mtioth tf the year><day tf the week><script ioame
with path>
( ). Sa e aiod exit frtm the crtiotab edittr.
13. How to add at job and delete the at job?
Adding :
(i). # at <tme> (tt eioter the at jtb).
(ii). eftre that tpeio a fle im aiod eioter the jtb ctmmaiods iio that fle aiod sa e as xxxx.sh
(stme ioame with exteiositio mgust be as .sh).
(iii).Eioter the abt e sa ed fle ioame withiio the at jtb edittr.
(i ). Press Ctrl + d tt exit frtm the edittr.
( ). Theio system will assiiio a jtb id tt that jtb. We caio see the list tf at jtbs by # atq
ctmmaiod.
Delete :
(i). See the jtb id which jtb we waiot tt delete by # atq ctmmaiod aiod iotte that jtb id.
(ii). Theio delete that jtb by # at -r <job id> ctmmaiod.
14. How to know currently scheduled at jobs?
Ratnakar Page 73
[Pick the date] [LINUX NOTES FOR LEVEL 2]
(ii). Pgut the eiotries tf the guser ioames whtm dt we (ii). Pgut the eiotries tf the guser ioames whtm dt we
waiot tt alltw the at jtbs. waiot tt deioy the at jtbs.
Ratnakar Page 74
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# systemctl start crtiod (tt start the crtio deamtio iio RHEL - 7).
# at -l (tt see the list tf at jtbs).
# atq (tt see the jtbs iio the qguegue).
# atrm <jtb id> (tt remt e the specifed at jtb).
# at <tme> (tt set the at jtb tt be execguted at the
specifed tme).
# at 9:30 (tt set the at jtb tt be execguted at 9:30
AMB).
Example : # at 9:30
at> guseradd itpal
at> irtgupadd maioaier
at> rm -rf /Stpt
at> tar -c f /Srttt/Setc.tar /Setc/S*
press Ctrl + d tt sa e aiod exit frtm at jtb
# at -r <jtb id> (tt remt e the specifed jtb).
* at jtbs caio be perftrmed tioly tioe tme. It caioiott repeat daily.
* at jtbs tioce schedguled we caioiott edit the jtbs tr mtdify the tme tf the jtb.
# at iotw +5miio (tt execgute the at jtb iotw afer 5 miiogutes).
at> ttguch f1 f2 f3
at> mkdir /Sram
at><EOT> tr Ctrl + d (tt sa e aiod exit frtm at jtb edittr).
# tailf /S ar/Slti/Scrtio (tt see the last 10 liioes tf at tr crtio lti fle
ctioteiots).
# at Jaio 20 2015 (tt schedgule the at jtb tio 20th Jaio 2015).
# at 5PMB Jaio 13 2015 (tt schedgule the at jtb tio 13th Jaio 2015 at
5PMB).
# at iottio + 4days (tt schedgule the at jtb ttday aiod afer 4
days).
# at midioiiht (tt schedgule the at jtb ttday midioiiht).
# at midioiiht + 4days (tt schedgule the at jtb ttday midioiiht aiod
afer 4 days).
# im /Setc/Sat.deioy (tt deioy the at jtbs ftr specifed gusers).
# im /Setc/Sat.alltw (tt alltw the at jtbs ftr specifed gusers).
* If btth /etc/at.deny aiod /etc/at.allow fles are deleted except rttt guser e ery guser will
be deioy tt
execgute at jtbs.
* Oioce schedguled the crtio jtbs we caio mtdify edit that jtb aioy iot. tf tmes.
# cat /Setc/Scrtiotab (tt see the crtio jtbs list).
# crtiotab -lgu <guser ioame> (tt list all the crtio jtbs tf the specifed guser).
# crtiotab -egu <guser ioame> (tt create tr edit the crtio jtbs).
Ratnakar Page 75
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# crtiotab -rgu <guser ioame> (tt erase tr remt e the specifed guser's
crtio jtbs).
# crtiotab -r <jtb id> (tt remt e the specifed crtio jtbs).
# im /Setc/Scrtio.deioy (tt deioy the crtio jtbs ftr specifed gusers).
# im /Setc/Scrtio.alltw (tt alltw the crtio jtbs ftr specifed gusers).
* If btth fles are remt e tr deleted except rttt guser all the gusers are deioy tt execgute the
crtiojtbs.
# crtiotab -egu rajgu
55 14 20 1 2 /Sgusr/Ssbiio/Sguseradd itpal gusr/Ssbiio/Sirtgupadd team
(sa e & exit this crtiotab).
* This jtb execgutes the guseradd aiod irtgupadd ctmmaiods tio Tguesday 20th Jaio e ery year
Examples for crontab :
(i). 58 14 15 20-25 1 236 /Sgusr/Ssbiio/Spasswd
where 58 -----> 58 miiogutes
14 15 -----> 14 htgurs aiod 15 htgurs ( 14:58 aiod 15:58).
20-25 -----> dates 20 21 22. 23 24 aiod 25
1 -----> Jaioguary
2 3 6 -----> 2iod day 3rd day aiod 6th day
(ii). 58 15 * * * <ctmmaiod>
where 58 -----> 58 miiogutes
15 -----> 15 htgurs (at 15:58).
* * * -----> e ery day
Ratnakar Page 76
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# im /Setc/Src.ltcal (tt execgute the crtio peiodiioi jtbs aguttmatcally wheioe er the
system is rebttted).
* Opeio the abt e fle aiod it tt last liioe aiod type as anacron theio sa e aiod exit this fle tt
execgute the peiodiioi jtbs aguttmatcally wheioe er the system is rebttted.
Ratnakar Page 77
[Pick the date] [LINUX NOTES FOR LEVEL 2]
( i). If it is thrtguih pgutty we caio maioaie the ser es gusiioi ctmmaiod liioe iioterface tioly. Iio btth
ways we shtguld ii e ser er ioame tr IP address ptrt iot. guser ioame aiod passwtrd.
2. What is SSH and explain it?
SSH is staiods ftr Secgure Shell. It was desiiioed aiod created tt prt ide the best secgurity wheio
accessiioi aiotther ctmpguter remttely. Ntt tioly dtes it eiocrypt the sessitio it alst prt ides
better agutheiotcattio facilites.
Oio wiiodtws systems iiostall the pgutty stfware aiod thrtguih pgutty we caio access the remtte
system by ctiofiguriioi ssh.
SSh is prtttctl which facilitates secgured ctmmguioicattio betweeio twt systems gusiioi Clieiot-
Ser er architectgure aiod alltws gusers tt ltiiio tt the ser er htst systems remttely.
It is gused tt ctioioect tt remtte system aiod perftrm admiioistrat e task tr jtbs. y defagult ssh
takes passwtrd agutheiotcattio mechaioism aiod its ptrt iot. is 22. Thrtguih ssh the data will be
traiosferred iio eiocrypted ftrmat.
3. What is telnet?
Telioet is a mechaioism tt ctioioect aiod tt admiioistrate the remtte system frtm ltcal system.
This is the tldest prtiram which is a ailable tio mtst ioetwtrk capable tperatioi systems.
Accessiioi a remtte shell acctguiot thrtguih the telioet methtd is daioier becaguse iio that
e erythiioi that ytgu seiod tr recei e t er that telioet sessitio is isible iio plaiio text tio ytgur ltcal
ioetwtrk aiod the ltcal ioetwtrk tf the machiioe ytgu are ctioioectioi tt.
St aioytioe caio sioife the ctioioecttio iio-betweeio caio see tgur guser ioame passwtrd email aiod
tther messaies that we read aiod ctmmaiod that we rguio. Ftr these reastios we ioeed a mtre
stphistcated prtiram thaio telioet tt ctioioect tt a remtte htst.
4. What are the diferences between Telnet and SSH?
Telnet SSH
(a). Thrtguih telioet we caio ctioioect the remtte (a). Thrtguih ssh alst we caio ctioioect the remtte
system bgut aioy ioetwtrk hacker may see the system bgut iotbtdy caio see the traiosferred data.
traiosferred data. Aiod the telioet ptrt iot. is 23. Aiod the ssh ptrt iot. is 22.
(b). Data will be traiosferred iio iotio-eiocrypted ftrmat. (b). Data will be traiosferred iio eiocrypted ftrmat.
(c). We caioiott trgust this telioet ctioioecttio. (c). We caio trgust this ssh ctioioecttio.
(d). We caioiott ii e the trgustioi iio telioet. (d). We caio ii e the trgustioi iio ssh.
(e). y siottpiioi tr sioifioi techiotltiies we caio see (e). y siottpiioi tr sioifioi techiotltiies we caioiott
the data like system tr htstioame ltiiio ioame see the data like system ioame tr htstioame ltiiio
passwtrd aiod tther data. ioame passwtrd aiod tther data.
St there is iot secgurity. St there is a secgurity
(f). # telioet<IP address tf the remtte system> (f). # ssh<IP address tf the remtte system>
(prt ide ltiiio ioame aiod passwtrd). (prt ide ltiiio ioame aiod passwtrd).
5. In how many ways we can connect the remote host through ssh?
Thrtguih ssh we caio ctioioect the remtte htst by twt methtds.
Ratnakar Page 78
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 79
[Pick the date] [LINUX NOTES FOR LEVEL 2]
( i). If btth pgublic aiod pri ate keys are matched theio ctioioecttio will be established aiod frst
tme it will ask the passwtrd. Oioce the ctioioecttio is established ioext tme tiowards it wtio't
ask aioy passwtrds.
# ssh <user name>@<remote hostname or IP address> (frst tme it will asks
the passwtrd).
( ii). The agutheiotcattio is dtioe thrtguih the pgublic aiod pri ate keys st this type tf
agutheiotcattio is called keybased agutheiotcattio.
10. How to prevent the remote login root user or how to configure the ssh to prevent the
remote login for root?
(i). The ltcattio tf the ssh ctiofigurattio fle is /etc/ssh/sshd_config
(ii). Opeio the ctiofigurattio fle by # vim /etc/ssh/sshd_config
-----> it tt liioe iot. 42 (iio RHEL - 6). tr
-----> it tt liioe iot. 48 (iio RHEL - 7). PermitRootLogin yes
aiod guioctmmeiot that liioe aiod type as " no " iio place tf " yes " aiodsa e aiod exit this fle.
(iii). Theio restart the tr reltad the sshd deamtio by
# service sshd restart (tt restart the sshd deamtio tr ser ice iio
RHEL - 6).
# systemctl restart sshd (tt restart the sshd deamtio tr ser ice iio
RHEL - 7).
# chkconfig sshd on (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 6).
# systemctl enable sshd (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 7).
# service sshd reload (tt reltad the sshd deamtio iio RHEL - 6).
# systemctl reload sshd (tt reltad the sshd deamtio iio RHEL - 7).
(i ). Theio iot rttt guser caioiott access tgur system remttely thrtguih ssh ser ice.
11. How to allow the remote users to run GUI commands through ssh?
(i). Opeio ssh ctiofigurattio fle by # vim /etc/ssh/sshd_config
-----> it tt liioe iot. 109 iio RHEL - 6 tr
-----> it tt liioe iot. 117 iio RHEL - 7 X11 Forwarding no
type as " yes " iio place tf " no " theio sa e aiod exit this fle.
* If it is yes theio GUI ctmmaiods caio be execguted tio the remtte system.
* If it is iot theio GUI ctmmaiods caioiott be execguted tio the remtte system.
(ii). Theio restart the sshd ser ice tr deamtio tt efeect the abt e mtdifcattio by
# service sshd restart (tt restart the sshd deamtio tr ser ice iio
RHEL - 6).
# systemctl restart sshd (tt restart the sshd deamtio tr ser ice iio
RHEL - 7).
# chkconfig sshd on (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 6).
Ratnakar Page 80
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# systemctl enable sshd (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 7).
# service sshd reload (tt reltad the sshd deamtio iio RHEL - 6).
# systemctl reload sshd (tt reltad the sshd deamtio iio RHEL - 7).
(iii). # iedit (tt tpeio the iedit edittr tio remttely).
12. How to allow empty password through ssh?
(i). Opeio the ssh ctiofigurattio fle by # vim /etc/ssh/sshd_config
-----> it tt liioe iot. 65 iio RHEL - 6 tr
-----> it tt liioe iot. 77 iio RHEL - 7 PermitEmptyPassword no
type as " yes " iio place tf " no " theio sa e aiod exit this fle.
* If it is yes theio the remtte system will be alltw the gusers with empty passwtrd ie.
withtgut passwtrd.
* If it is iot theio the remtte system will iott be alltw the gusers with empty passwtrds.
(ii). Theio restart the sshd ser ice tr deamtio tt efeect the abt e mtdifcattios by
# service sshd restart (tt restart the sshd deamtio tr ser ice iio
RHEL - 6).
# systemctl restart sshd (tt restart the sshd deamtio tr ser ice iio
RHEL - 7).
# chkconfig sshd on (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 6).
# systemctl enable sshd (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 7).
# service sshd reload (tt reltad the sshd deamtio iio RHEL - 6).
# systemctl reload sshd (tt reltad the sshd deamtio iio RHEL - 7).
(iii). Ntw the gusers wht are ha iioi empty passwtrds are alst access the remtte systems
thrtguih ssh.
13. How to prevent the password authentication mechanism in ssh?
(i). Opeio the ssh ctiofigurattio fle by # vim /etc/ssh/sshd_config
-----> it tt liioe iot. 66 iio RHEL - 6 tr
-----> it tt liioe iot. 78 iio RHEL - 7 PasswordAuthentication no
type as " no " iio place tf " yes " theio sa e aiod exit this fle.
* If it is yes theio the remtte system will ask the passwtrd.
* If it is iot theio the remtte system will iott ask aioy type tf passwtrds.
(ii). Theio restart the sshd ser ice tr deamtio tt efeect the abt e mtdifcattios by
# service sshd restart (tt restart the sshd deamtio tr ser ice iio
RHEL - 6).
# systemctl restart sshd (tt restart the sshd deamtio tr ser ice iio
RHEL - 7).
# chkconfig sshd on (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 6).
Ratnakar Page 81
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# systemctl enable sshd (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 7).
# service sshd reload (tt reltad the sshd deamtio iio RHEL - 6).
# systemctl reload sshd (tt reltad the sshd deamtio iio RHEL - 7).
(iii). Ntw we caio access the remtte systems thrtguih ssh withtgut Passwtrd Agutheiotcattio
mechaioism.
14. How to allow or deny the uses or group to access the remote systems through ssh?
(i). If we waiot tt alltw tr deioy the partcgular gusers theio it tt last liioe tf the ssh ctiofigurattio
fle aiod type as
DeioyUsers <guser 1><guser 2><guser3> ...etc. (these gusers will be deioied the ssh ser ice).
AlltwUsers <stgudeiot><guser 4><guser 5> ...etc. (these gusers will be alltwed the ssh
ser ice).
DeioyGrtgup <irtgup 1><irtgup 2><irtgup 3> ...etc. (these irtgup gusers will be deioied the
ssh ser ice).
AlltwGrtgup <irtgup 1><irtgup 2><irtgup 3> ...etc. (these irtgup gusers will be alltwed the
ssh ser ice).
(ii). Theio restart the sshd ser ice tr deamtio tt efeect the abt e mtdifcattios by
# service sshd restart (tt restart the sshd deamtio tr ser ice iio
RHEL - 6).
# systemctl restart sshd (tt restart the sshd deamtio tr ser ice iio
RHEL - 7).
# chkconfig sshd on (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 6).
# systemctl enable sshd (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 7).
# service sshd reload (tt reltad the sshd deamtio iio RHEL - 6).
# systemctl reload sshd (tt reltad the sshd deamtio iio RHEL - 7).
15. How allow the specified no. of users to access remote system at a time?
(i). Opeio the ssh ctiofigurattio fle by # vim /etc/ssh/sshd_config theio it tt MaxAuthTries
liioe aiod type as
MaxAuthTries <no.> (type aioy iogumeric algue eqgual tt MBax. gusers tt alltwat a tme iio
place tf <iot.>
theio sa e aiod exit this fle).
(ii). Theio restart the sshd ser ice tr deamtio tt efeect the abt e mtdifcattios by
# service sshd restart (tt restart the sshd deamtio tr ser ice iio
RHEL - 6).
# systemctl restart sshd (tt restart the sshd deamtio tr ser ice iio
RHEL - 7).
# chkconfig sshd on (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 6).
Ratnakar Page 82
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# systemctl enable sshd (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 7).
# service sshd reload (tt reltad the sshd deamtio iio RHEL - 6).
# systemctl reload sshd (tt reltad the sshd deamtio iio RHEL - 7).
16. How to allow or deny the hosts or networks to use the ssh?
To deny IP addresses or hostnames :
(i). Opeio /etc/hosts.denyfle by # vim /etc/hosts.deny aiod it tt last liioe aiod type as
sshd: <IP address 1><IP address 2><IP address 3> ...etc. (tt deioy IP 1 IP 2 IP 3 ...etc. ).
sshd: <hostname 1><hostname 2><hostname 3> ...etc.
sshd: *.example.com *.my133t.org ...etc. (tt deioy all the htsts frtm these dtmaiios).
sshd: 192.168.0. 172.25.0. ...etc. (tt deioy 192.168.0 aiod 172.25.0 ioetwtrks).
sshd: ALL Except <hostname or IP address> (tt deioy all the htsts tr IP addresses
except the specifed tioe iio
that ioetwtrk). aiod sa e & exit the fle.
(ii). Theio restart the sshd ser ice tr deamtio tt efeect the abt e mtdifcattios by
# service sshd restart (tt restart the sshd deamtio tr ser ice iio
RHEL - 6).
# systemctl restart sshd (tt restart the sshd deamtio tr ser ice iio
RHEL - 7).
# chkconfig sshd on (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 6).
# systemctl enable sshd (tt eioable the sshd deamtio at ioext rebttt
iio RHEL - 7).
# service sshd reload (tt reltad the sshd deamtio iio RHEL - 6).
# systemctl reload sshd (tt reltad the sshd deamtio iio RHEL - 7).
To allow IP addresses or hostnames :
(i). Opeio /etc/hosts.allow fle by # vim /etc/hosts.allow aiod it tt last liioe aiod type as
sshd: <IP address 1><IP address 2><IP address 3> ...etc. (tt alltw IP 1 IP 2 IP 3 ...etc. ).
sshd: <hostname 1><hostname 2><hostname 3> ...etc.
sshd: *.example.com *.my133t.org ...etc. (tt alltw all the htsts frtm these dtmaiios).
sshd: 192.168.0. 172.25.0. ...etc. (tt alltw 192.168.0 aiod 172.25.0
ioetwtrks).
sshd: ALL Except <hostname or IP address> (tt alltw all the htsts tr IP addresses
except the specifed tioe iio
that ioetwtrk). aiod sa e & exit the fle.
(ii). Theio restart the sshd ser ice tr deamtio tt efeect the abt e mtdifcattios by
# service sshd restart (tt restart the sshd deamtio tr ser ice iio
RHEL - 6).
# systemctl restart sshd (tt restart the sshd deamtio tr ser ice iio
RHEL - 7).
Ratnakar Page 83
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 84
[Pick the date] [LINUX NOTES FOR LEVEL 2]
speedgup fle traiosfer by ctpiioi the difeereioces betweeio twt fles rather thaio ctpiioi aio eiotre
fle e ery tme.
If rsync is ctmbiioed with ssh it makes a ireat gutlity tt syioc the data secgurely ttherwise by
sioifioi aioy tioe caio see tgur data ie. iot secgurity ftr tgur data.
21. A system is able to ping locally but not out site. Why?
(i). MBay be there is iot access tt tgutside.
(ii). MBay be tgutside is iio difeereiot ioetwtrk frtm the ltcal.
(iii). MBay be permissitio is deioied ftr that system tt access tgutside.
(i ). If there is access bgut rtguter tr mtdem tr ioetwtrk switch tr NIC may iott be wtrkiioi tt
access the tgutside.
( ). MBay be tgutside is iott a ailable temptrarily.
22. A system is echoing the ping, but not able to login via telnet. Why?
(i). Check telioet ser ice is started tr iott. If iott started start the telioet ser ice.
(ii). MBay be telioet ser ice is disabled if st eioable the telioet ser ice.
(iii). MBay be telioet ptrt is bltcked if st release that ptrt iot.
(i ). MBay be telioet permissitio is deioied if st chaioie the permissitios tt alltw the telioet ser ice.
( ). Check all the fles whether the telioet ser ice is bltcked tr iott if bltcked remt e thtse
eiotries.
23. How will you login or start the system in what mode if you don't know the root password?
(i). If the guser ha iioi sgudt permissitios theio ltiiio as sgudt guser.
(ii). If iot sgudt permissitios theio bttt with CDROMB iio siioile guser mtde aiod start the system.
Theio prt ide the rttt passwtrd tt rttt guser if there is iot rttt passwtrd.
(iii). E eio thtguih if it is iott ptssible theio fioally break the rttt passwtrd.
Other useful commands :
# telioet <IP address tr htstioame> (tt ctioioect the specifed remtte system
thrtguih telioet).
# ssh <IP address tr htstioame> (tt ctioioect the specifed remtte system
thrtguih ssh).
Userioame : xxxxxx
Passwtrd : xxxxxxx
# ssh <IP address> -l <guser ioame> (tt ctioioect the remtte system gusiioi guser
ioame).
Passwtrd : xxxxxxx
# ssh 192.168.1.1 -l rttt (tt ctioioect this remtte system as rttt guser).
# ssh rttt@192.168.1.1 (tt ctioioect this remtte system as rttt guser).
# ssh rttt@ser er1.example.ctm (tt ctioioect the ser er1 system iio
example.ctm dtmaiio).
#w (tt see all the gusers wht are ltiiio tt tgur
system).
Ratnakar Page 85
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# w -f (tt see all the gusers wht are ltiiio tt tgur system
with tther details).
# ssh <IP address> (if we iott specifed the guser ioame theio it will ask the cgurreiot gusers
passwtrd aiod search the
cgurreiot acctguiot iio remtte system).
# cat /Srttt/S.ssh/Skiotwio_htsts (tt see the ssh trgustioi remtte htsts fioier
priiot iioftrmattio).
# ssh rttt@192.168.1.1 <ctmmaiod> (tt rguio a ctmmaiod tio remtte htst withtgut ltiiio
tt that system).
# ssh rttt@192.168.1.1 -X (tt rguio GUI ctmmaiods tio the remtte system becaguse by
defagult the ssh is ctiofigured as
ctmmaiod liioe iioterface X is capital).
# lastb (tt see the ltiiio failed tries).
# last -x |irep shgutdtwio (tt see the date & tme tf the system's last
shgutdtwio).
9. Memory Management (Swap)
1. What is swap?
Swap space iio Liiogux is gused wheio the amtguiot tf the Physical memtry (RAMB). is fgull. If the
system ioeeds mtre memtry restgurces aiod the RAMB is fgull iioact e paies iio the memtry are
mt ed frtm RAMB tt swap space. It helps the machiioes which are ha iioi small amtguiot RAMB
aiod it shtguld iott be ctiosidered a replacemeiot ftr mtre RAMB. Swap is ltcated tio the hard disks
which ha e sltwer access tme thaio Physical memtry.
2. What is the recommended swap space?
Geioerally the rectmmeioded swap space is dtguble the RAMB sise bgut the ftlltwiioi table shtws
actgual amtguiot.
Apart frtm the beltw rectmmeiodattio a basic rgule is applied tt create the swap partttio.
* If the RAMB sise is less than or equal to 2 GB theio the sise tf the swap = 2 X RAM size.
* If the RAMB sise is more than 2 GB theio the sise tf the swap = 2 GB + RAM size.
Recommended Amount of Swap
Amount of RAM in the System
Space
4 G tr less MBiio. 2 G
4 G - 16 G MBiio. 4 G
16 G - 64 G MBiio. 8 G
64 G - 256 G MBiio. 16 G
256 G - 512 G MBiio. 32 G
Ratnakar Page 86
[Pick the date] [LINUX NOTES FOR LEVEL 2]
tt iiocrease the swap space st we create addittioal swap space which will be added tt the
existioi swap space tt iiocrease the sise.
4. What is swap-in and swap-out or page-in and page-out?
swap-in tr page-out :
If we rguio tr tpeio aioy applicattio it reqguires stme amtguiot tf memtry tt ltad its featgures. St
frst it lttks tr tccgupy physical memtry (RAMB).. If there is iott eiotguih space iio RAMB the
applicattio's data is traiosferred frtm RAMB tt swap space. If the paies are mt iioi frtm RAMB
tt swap space that is called swap-iio tr paie-tgut.
swap-out tr page-in :
If tlder tr pre itgus applicattio is cltsed theio the space tccgupied by thtse applicattios alst
cleared. ie. stme tf the space is a ailable iio RAMB. St aguttmatcally stme data which is already
tccgupied iio swap space is alst mt ed frtm swap tt RAMB. If the paies are mt iioi frtm swap
space tt RAMB that is called swap-tgut tr paie-iio.
5. How paging space is allocated?
(i). Paiiioi meaios data traiosferred frtm RAMB tt swap space.
(ii). If we tpeio tr rguio aioy applicattio frst it will tccgupy the reqguired space iio RAMB. If there is
iott eiotguih space iio RAMB theio stme amtguiot tf applicattio's data will be traiosferred frtm
RAMB tt swap space. ie. swap space is alltcated tt that applicattio. This alltcattio is
called paiiioi space tr paie-tgut alltcattio.
(iii). paiiioi will takes place iio swap by bltcks. First it will create the reqguired iot. tf bltcks iio
swap space.
(i ). If RAMB space cleared by tlder tr tther applicattios theio swap tccgupied data is traiosferred
frtm swap tt RAMB. This is called paie-iio. St that mguch amtguiot tf space is guioalltcated iio
swap ie. remt ed the created bltcks iio swap.
6. How to create the swap partition?
# fdisk -l (tt see the a ailable disks iio the system).
# fdisk /Sde /Ssdb
Ctmmaiod (m ftr help). : io (tt create a ioew partttio).
First cyliioder : (press Eioter key).
Last cyliioder : +2048MB
Ctmmaiod (m tr help). : t (tt chaioie the hex ctde).
Partttio iot. (1-2). : 2 (tt chaioie the partttio iogumber hex ctde).
Hex ctde : 82 (82 is the hex ctde ftr Liiogux swap).
Ctmmaiod (m ftr help). : w (write the chaioies tt the disk).
# partprtbe tr # partprtbe /Sde /Ssdb (tt gupdate the partttio table iioftrmattio).
# mkswap /Sde /Ssdb2 (tt ctio ert the raw disk tt swap fle system).
# swaptio /Sde /Ssdb2 (tt tgurio tio the swap partttio).
# im /Setc/Sfstab (tt make the permaioeiot mtguiot tf swap partttio).
/Sde /Ssdb2 swap swap defagults 0 0
(sa e aiod exit this fle).
Ratnakar Page 87
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# mtguiot -a (tt mtguiot all the partttios which are ha iioi eiotries iio
/Setc/Sfstab fle).
# df -hT (will iott shtw the swap sise).
# free -m (tt see the tttal RAMB aiod swap sise).
7. How to remove the swap partition?
# swaptio -s (tt see the swap partttio ioames tr disks).
# swaptfe /Sde /Ssdb2 (tt tgurio tfe the swap space).
# im /Setc/Sfstab (tpeio this fle aiod remt e the swap partttio eiotry).
(afer remt iioi the swap partttio sa e aiod exit this fle).
# fdisk /Sde /Ssdb (tt delete the swap partttio).
Ctmmaiod (m ftr help). : d (d ftr tt delete the partttio).
Partttio iot. (1-2). : 2
Ctmmaiod (m ftr help). : w (tt write the chaioies iiott the disk).
# partprtbe tr # partprtbe /Sde /Ssdb
# free -m (tt see the RAMB as well as swap sises).
8. In how many ways can we create the swap spaces?
(i). y creatioi a ioew swap partttio tio the disk. (separate swap partttio).
(ii). y creatioi swap fle.
9. How to create the swap space using the swap file?
Stmetmes it is guioable tt create a swap partttio becaguse may be there is iot disk space tr may
be the partttio limit is already exceeded. St iio these sceioarits we ha e tt create tioly the
space fle.
# dd if = /Sde /Ssert tf = /Srttt/Sliioguxswap bs = 1MB ctguiot = 2048 (tt create 2048MB
empty fle).
# dgu - /Srttt/Sliioguxswap (tt see the liioguxswap sise).
# mkswap /Srttt/Sliioguxswap (tt ctio ert the existioi fle system tt swap fle
system).
# swaptio /Srttt/Sliioguxswap (tt tgurio tio the swap fle).
# im /Setc/Sfstab (tt make a permaioeiot mtguiot tf swap space).
/Srttt/Sliioguxswap swap swap defagults 0 0
(sa e aiod exit this fle).
# mtguiot -a (tt mtguiot all the partttios which are ha iioi eiotries iio
/Setc/Sfstab fle).
# df -hT (will iott shtw the swap sise).
# free -m (tt see the tttal RAMB aiod swap sise).
10. What is virtual memory?
The ctmbiioattio tf Physical memtry (RAMB). aiod swap space is called the irtgual memtry.
St Virtgual memtry = Physical memtry (RAMB). + swap space.
Other useful commands :
Ratnakar Page 88
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# swap -s (tt see htw maioy swap partttios are there aiod with their
ioames).
# swaptio -a (tt tgurio tio all the swap partttios).
# swaptfe -a (tt tgurio tfe all the swap partttios).
# cat /Setc/Smtab (tt see the cgurreiot aiod temptrary mtguiot ptiiots).
# mtguiotptiiot <directtry tr mtguiot ptiiot> (tt check the specifed directtry is a iotrmal
directtry tr a
mtguiot ptiiot).
# df -ih (tt check htw maioy iiotde iogumbers are a ailable iio the mtguioted
partttios).
11. What happens when the /usr is full?
(i). Users caioiott ltiiio tt the system.
(ii). If already ltiiio gusers iott able tt execgute aioy ctmmaiod.
12. What happens when memory ie., pagein space is full?
(i). The ioew applicattios caioiott ltad dgue tt lack tf memtry.
(ii). St gusers caioiott ltiiio tt the applicattio aiod caioiott access the applicattios featgures.
(iii).St if we iiocrease the swap memtry tt the reqguired sise theio the prtblem will be stl ed.
13. How to restore the data and upgrade your O/S ?
(i). We caio resttre the data frtm backgup by tar cpit dd ioet backgup tr tther tttls.
(ii). If it is iio mirrtr we caio syioc the data frtm mirrtred disk.
(iii).We caio gupirade the O/SS iio twt ways.
(a). Online :
The O/SS is gupiraded frtm pre itgus tt preseiot while the system is rguioioiioi. It is risky aiod
takes ltioi tme.
(b). Offline :
First take backgup tf all the system aiod theio remt e pre itgus O/SS aiod iiostall the
preseiot O/SS aiod resttre the backgup frtm backgup disks tr tapes. St it is ery
easy aiod iotio-risky jtb.
Ratnakar Page 89
[Pick the date] [LINUX NOTES FOR LEVEL 2]
1. What is sofware?
Stfware is a ctllecttio tf prtirams tt perftrm stme tasks tr maioaie systems applicattios
databases ...etc.
2. What is package and package management?
Packaie is iotthiioi bgut a stfware tt perftrm stme tasks. Stfware is the basic tf aioy O/SS
alltwiioi tt iiostall aiod guse difeereiot gutlites.
Packaie maioaiemeiot meaios iiostalliioi gupdatioi qgueryiioi repairiioi aiod remt iioi packaies.
Iio Liiogux there are twt tttls tt perftrm packaie maioaiemeiot.
rpm -----> redhat packaie maioaier aiod ygum -----> yelltwdti gupdater mtdifer.
3. What is rpm?
rpm is a packaie maioaiiioi system (ctllecttio tf tttls tt maioaie stfware packaies).. rpm is a
ptwerfgul aiod mtst ptpgular tpeio stgurce tttl gused ftr stfware maioaiemeiot ftr iiostalliioi
guioiiostalliioi (remt iioi). erifyiioi qgueryiioi aiod gupdatioi stfware packaies. It is iiostalled guioder
/var/lib/rpm database directtry. It deals with .rpm fles which ctiotaiios the actgual
iioftrmattio abtgut the packaies. The rpm lti messaies will be sttred iio /var/log/yum.log fle.
4. What are the draw backs of rpm?
(i). rpm caioiott restl e the depeiodeiocy. It meaios if we waiot tt iiostall aioy stfware frst the
depeiodeiocy packaies shtguld be iiostalled.
(ii). There is iot ctiofigurattio fle ftr rpm.
5. What are the basic modes of rpm commands?
(i). Iiostall -----> gused tt iiostall rpm packaies.
(ii). Update -----> gused tt gupdated the packaies.
(iii). Trtgubleshtttioi -----> gused tt repair the packaies.
(i ). Remt e -----> gused tt remt e tr guioiiostall the packaies.
( ). Qgueryiioi -----> gused tt qguery (iather iioftrmattio). tio packaies.
6. How many types of packages are available in Linux?
(i). x86_64.rpm -----> 64 bit packaie aiod caio be iiostall tio 64 bit O/SS tioly.
(ii). x86.rpm -----> 32 bit packaie aiod caio be iiostall tio 32 bit tr 64 bit O/SS tioly.
(iii). i 386.rpm -----> 32 bit packaie aiod caio be iiostall tio 32 bit tr 64 bit O/SS tioly.
(i ). i 486.rpm -----> " "
( ). i 586.rpm -----> " "
( i). i 686.rpm -----> 64 bit packaie aiod caio be iiostall tio 64 bit O/SS tioly.
( ii). iotarch.rpm -----> iot-architectgure aiod caio be iiostall tio either 32 bit tr 64 bit O/SS.
7. What is the syntax of rpm command with full options?
Ratnakar Page 90
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 91
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 92
[Pick the date] [LINUX NOTES FOR LEVEL 2]
called reptsittries which may be tioliioe tio a ioetwtrk aiod tr tio iiostallattio media. ygum is a
frtiot eiod tttl ftr rpm. It is gused tt restl e the depeiodeiocy which caioiott be dtioe by rpm. The
ygum ctmmaiod has access the reptsittry where the packaies are a ailable aiod caio iiostall
gupdate/Sgupirade remt e aiod qguery the packaies aguttmatcally.
9. What are the important files that are related to yum?
/etc/yum.conf -----> is the ygum ctiofigurattio fle.
/etc/yum.repos.d -----> is the directtry which ctiotaiios the ygum reptsittry ctiofigurattio fle.
/etc/yum.repos.d/xxxxx.repo ------> is the ygum reptsittry ctiofigurattio fle.
/var/lib/yum -----> is the directtry which ctiotaiios the ygum databases.
/var/log/yum.log -----> is the fle which sttres the ygum lti messaies.
10. How setup the yum server?
(i). Iiosert the RHEL DVD ittt that directtry aiod iiostall the sfpd packaie by # rpm -ivh
vsfpd*
(ii). Gttt /var/fp/pub directtry aiod create rhel6 directtry by # mkdir rhel6
(iii). Gttt DVD mtguioted directtry aiod ctpy all the DVD ctioteiot iiott /var/fp/pub/rhel
directtry by
# cp -rvpf /media/DVD/ /var/fp/pub/rhel6
(i ). Restart the sfpd ser ice by # service vsfpd restart ctmmaiod.
( ). Theio eioable the sfpd ser ice by # chkconfig vsfpd on ctmmaiod.
( i). Gttt /etc/yum.repos.d directtry aiod create tioe ygum reptsittry fle by # vim linux.repo
ctmmaiod.
( ii). Iio the abt e fle the ctioteiots are as beltw
[liiogux] (Liiogux rept id).
ioame=ygum rept ser er (ygum ser er ioame).
basegurl=fle:/S/S/S ar/Sfp/Spgub/Srhel6 tr basegurl=fp:/S/S<IP address tf the
system>/Spgub/Srhel6
ipicheck=0 (0 meaios while iiostalliioi it will iott ask aioy
siiioatgure keys tf ygum packaies If it is 1 theio it will ask the siiioatgure
keys while iiostalliioi the packaies).
+98gu eioabled=1 (if mgultple reptsittries are there
theio eioable this tioly).
(sa e aiod exit this fle).
( iii). # yum clean all (tt cleaio the tld tioe gupdate the ioew
reptsittry).
(ix).# yum repolist (it displays iot. tf packaies iio that
reptsittry).
11. How to setup the yum client?
(i). Gttt /etc/yum.repos.d directtry aiod create the reptsittry fle by # vim linux.repo
(ii). Type the eiotries as beltw
[liiogux] (Liiogux rept id).
Ratnakar Page 93
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 94
[Pick the date] [LINUX NOTES FOR LEVEL 2]
16. What is O/S patch and how to add those patches on production servers or how to upgrade
the kernel?
(i). O/SS patch is iotthiioi bgut gupdate the ioew kerioel. Ntrmally O/SS patch is stfware that
ctiotaiios stme prtirams tt fx the bguis iio O/SS ie. iio kerioel.
(ii). If tgur ser er is reiistered aiod ctiofigured iio RedHat ioetwtrk theio we will iet the
iioftrmattio abtgut that gupdated kerioel s iioftrmattio aiod theio dtwioltad that kerioel
gupdattios.
(iii). E ery O/SS patch is sgupplied with a dtcgumeiot abtgut pre-reqguisites tt apply that patch.
(i ). Check the pre-reqguisites space reqguiremeiots aiod tthers. if all are tk
( ). Theio we take the bgusiioess apprt al aiod make CRQ's (Chaioie reqguests)..
( i). Theio the prtject maioaier will iioitate the mail thread ie. seiodiioi the mail tr messaies tt
aritgus teams wht are dealiioi with that ser er.
( ii). We iet the resptiose frtm difeereiot teams which are iio tl iioi iio this prtcess.
(a). Ftr example MBtioittriioi team tt iiiotre alerts frtm that ser er if the system haiois tr
rebttted.
(b). D A team if database sttpped tr crashed tr system failed.
(c). Applicattio team if the applicattio efeects while patchiioi.
( iii). If the ser er is iio clguster theio mt e the ser ice irtgup aiod restgurces tt aiotther systems
maiogually called switch t er.
(ix). Iioftrm the Applicattio team tt sttp the applicattio aiod database team tt sttp the
database.
(x). If the ser er is iio clguster there is iot ioeed tf rebttt (iot dtwio tme). else dtwio tme ioeeded
tt rebttt.
(xi). Check the rttt disk is iio iotrmal fle system tr VxVMB.
(xii). If mirrtr disk is there split the mirrtr disk frtm triiiioal disk aiod bttt iio siioile guser mtde
aiod add the patch by # rpm -ivh <patch name> ctmmaiod.
(xiii). Theio rebttt the system aiod wtio't attach the mirrtr disk tt a tid aioy guioexpected
sitguattios tr prtblems aiod pgut that ser er guioder test guptt 1week tr 10 days depeiodiioi
tio the ctmpaioy's ptlicy.
(xi ). Afer the test peritd if there is iot prtblems raised theio attach the system iio li e mtde aiod
alst with mirrtr disk tt syioc the data tt gupdate the system.
(x ). Theio we iioftrm the Applicattio Database MBtioittriioi aiod tther teams wht are dealiioi
with that ser er tt test applicattio database mtioittriioi aiod tthers see the statgus.
(x i). Theio fioally cltse the issgue tr CRQ.
17. Afer installation of package or patch if the package or patch is removed then what will
happened?
(i). If kerioel patch is remt ed theio the system will haioi aiod ftr tthers there is iot efeect.
(ii). If packaie is remt ed theio the applicattio that beltiois tt that remt ed packaie will efeect.
18. Afer applying the patch need to reboot the system or not?
(i). If the patch is kerioel patch tr clgustered patch theio tioly the system rebttt is reqguired.
Ratnakar Page 95
[Pick the date] [LINUX NOTES FOR LEVEL 2]
(ii). If the patch is iotrmal patch theio there is iot ioeed tf the rebttt reqguired.
19. If the package is not installing. How to troubleshoot?
(i). Check the packaie pre-reqguisites tt iiostall the packaie.
(ii). If pre-reqguisites are iott matched with tgur system theio the packaie will iott be iiostalled i.e.
O/SS ctmpatbility tt iiostall that packaie.
(iii). If there is iot sgufcieiot space iio the system the packaie will iott be iiostalled.
(i ). If the packaie is iott prtperly dtwioltaded theio the packaie will iott be iiostalled.
20. If the patch is not applied successfully what will you do?
(i). Check whether the patch is iiostalled prtperly tr iott by # rpm -qa <patch name>
ctmmaiod.
(ii). Check the /var/log/yum.log fle tt erify tr see why the patch is iott sguccessfgully iiostalled.
(iii). If aioy ptssible tt restl ed thtse issgues restl e aiod remt e that patch with # rpm -e
<patch name> ctmmaiod.
(i ). If aioy rebttts reqguired tt efeect theio rebttt the system.
( ). Aiaiio add that patch by # rpm -ivh <patch name> ctmmaiod.
( i). Theio check the patch by # rpm -qa <patch name> ctmmaiod
Other useful yum commands :
# ygum reptiioft (tt list all the iioftrmattio tio all the
reptsittries).
# aygum reptiioft <rept id> (tt list all the iioftrmattio tio specifed
reptsittry).
# ygum iiostall <packaie ioame> -y (tt dtwioltad aiod iiostall the packaie aiod y
meaios yes).
# ygum iiostall <packaie ioame> -d (tt dtwioltad the packaie).
# ygum erase tr remt e <packaie ioame> -y (tt remt e tr guioiiostall the packaie aiod y
meaios yes).
# ygum list iiostalled (tt display the list tf all iiostalled packaies).
# ygum list a ailable (tt list all the a ailable packaies tt be
iiostalled).
# ygum list all | less (tt list all the iiostalled aiod iott iiostalled
packaies).
# ygum search <packaie ioame> (tt search a partcgular packaie is a ailable
tr iott).
# ygum iioft <packaie ioame> (tt display the iioftrmattio tio that packaie).
# ygum gupdate <packaie ioame> (if the gupdate ersitio tf the specifed
packaie is a ailable
theio gupdate that packaie).
# ygum gupdate all (tt gupdate all the packaies iotthiioi bgut whtle system
will be gupdated).
Ratnakar Page 96
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# ygum dtwioirade <packaie ioame>(tt re ert back ie. it back tt pre itgus ersitio tf that
packaie if ioew
ersitio is iott wtrkiioi prtperly).
# ygum histtry (tt display the ygum histtry).
# ygum histtry iioft < id > (tt display the iioftrmattio tf that histtry
id).
# ygum histtry guiodt < id > (tt remt e that histtry id).
# ygum histtry guiodt < id > (tt redt the abt e remt ed histtry id).
# ygum irtguplist (tt display the list tf irtgup packaies).
# ygum irtgupiiostall <packaie ioame> (tt iiostall the irtgup packaie).
# ygum iiostall@<irtgup packaie ioame> (tt iiostall the irtgup packaie iio aiotther
way).
# ygum irtgupiioft <irtgup packaie ioame> (tt display the irtgup packaie iioftrmattio).
# ygum irtguplist hiddeio (tt list all the irtgup packaies ioames
iioclgudiioi iiostalled tr iott
iiostalled aiod hiddeio irtgup packaies).
# ygum-ctiofi-maioaier disablerept=<rept id> (tt disable the ygum reptsittry. St we
caioiott iiostall aioy
Ratnakar Page 97
[Pick the date] [LINUX NOTES FOR LEVEL 2]
Ratnakar Page 98
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# tar <tpttios><destioattio fle ioame with path><stgurce fle tr directtry with path>
The tpttios are -c -----> create
- -----> erbtse
-f -----> fle ioame
-t -----> listioi
-t ----> ltioi listioi
-x -----> extract
-w ---->iioteract e
-C -----> specifc ltcattio (Capital C).
-gu -----> gupdate meaios addiioi ioew ctioteiots tt the existioi tar fle
--gupdate -----> " "
--delete -----> deletes the ctioteiots frtm the tar fle
-p ----> preser e the tld permissitios tf the fles/Sdirecttries wheio
extractioi the tar fle
-s ----> isip (iguio sip). ctmpressitio
-j ----> bsip2 (bguio sip). ctmpressitio
-J ----> xs ctmpressitio (frtm RHEL - 7).
Examples:
# tar -c f /Srttt/Setc.tar /Setc/S* (tt ctpy all the fles aiod directtries frtm /Setc aiod
make a siioile fle
aiod place iio the /Srttt/Setc.tar fle).
# tar -t f /Srttt/Setc/Star (tt ltioi listioi the ctioteiots tf the /Srttt/Setc.tar
fle).
# tar -x f /Srttt/Setc.tar -C /Srttt1/S (tt extract aiod ctpy the fles iio /Srttt1/S ltcattio).
# tar -xf /Srttt/Setc.tar (tt list the ctioteiots tf the tar fle).
# tar -f /Srttt/Setc.tar --gupdate tr -gu <fle ioame tr directtry> (tt add the ioew
ctioteiots tt the existioi
tar fle).
# tar -f /Srttt/Setc.tar --delete<fle ioame tr directtry> (tt delete the fle frtm the
tar).
# tar -gu /Srttt/Setc.tar /S ar (tt add the /S ar ctioteiots iiott the /Srttt/Setc.tar
fle).
# tar -c f mytar.tar /S --xattrs (tt archi e the ctioteiots altioi with SELiiogux aiod
ACL permissitios).
# dgu -h /Srttt/Setc.tar (tt see the sise tf the tar ctmpressed fle).
5. What are the compressing & uncompressing tools available for tar and explain them?
Compressing Tools Uncompressing Tools
# isip (.is). # iguiosip
Ratnakar Page 99
[Pick the date] [LINUX NOTES FOR LEVEL 2]
# ls <stgurce fle ioame> |cpit <tpttios>><destioattio fle ioame> (tt take a backgup tf the
stgurce directtry aiod sttred the
backgup iiott destioattio directtry).
The tpttios are -t -----> tt list the cpit ctioteiots
-i -----> tt resttre the cpit backgup
- -----> tt display tio the screeio ie. erbtse
-t -----> tt take a backgup
Examples :
# ls | cpit -t > /Stpt/Srttt.cpit (tt take a backgup tf rttt directtry aiod
sttred iio /Stpt ).
# cpit -i < /Stpt/Srttt.cpit (tt resttre the backgup).
# ls /Setc | cpit -t > /Stpt/Setc.cpit (tt take a backgup tf the /Setc directtry aiod
sttred iio /Stpt).
# cd /Setc (it tt that /Setc directtry).
# rm -rf * (tt remt e all the ctioteiots frtm /Setc).
# cpit -i < /Stpt/Setc.cpit (tt resttre the /Setc ctioteiots frtm the
cpit backgup).
8. What is dd and how to take a backup and restore using dd?
dd meaios disk tt disk backgup. Usiioi dd ctmmaiod we caio take a backgup tf the data frtm
tioe disk tt aiotther disk. It ctpies the data iio byte tt byte. It caio take a backgup tf the disk
iioclgudiioi bad bltcks.
# dd if = <disk 1> tf = <disk 2> (tt take a backgup frtm disk 1 aiod sttres iio
disk 2).
# dd if = /Sde /Ssert tf = /Srttt/Srajgu bs = 1MB ctguiot = 2048 (tt create aio empty fle with
2G sise).
# dd if = /Sde /Ssda tf = /Srttt/Smbr.bak bs = 1 ctguiot = 512 (tt take the backgup tf
/Sde /Ssda MBaster
ttt Rectrd).
# dd if = /Srttt/Smbr.bak tf = /Sde /Ssdb (tt resttre the MB R frtm backgup tt sectiod
disk /Sde /Ssdb).
# dd if = /Sde /Ssda1 tf = /Sde /Ssdb1 (tt take a backgup tf the eiotre /Sde /Ssda1
disk partttio).
# dd if = /Sde /Ssdb1 tf = /Sde /Ssda1 (tt resttre the /Sde /Ssda1 ctioteiots frtm
the abt e backgup).
# dd if = /Sde /Ssda tf = /Sde /Ssdb (tt take a backgup tf the eiotre /Sde /Ssda
disk iiott /Sde /Ssdb).
# dd if = /Sde /Scdrtm tf = /Srttt/Srhel6.ist (tt create a ISO imaie fle tf the CD/SDVD).
9. What is dump and how to take a backup and restore using dump and restore?
dgump is a ctmmaiod gused tt take a backgup tf fle systems tioly. We caioiott take a backgup tf
fles aiod directtries. We caioiott take a backgup tf disk tt disk backgup. It is iott rectmmeioded tt
take a backgup tio mtguioted fle systems. St guiomtguiot the fle system aiod theio take a backgup is
rectmmeioded. y defagult dgump is iott a ailable iio the system. st frst iiostall the dump
packaie aiod theio execgute the dgump ctmmaiods.
# ygum iiostall dgump* -y (tt iiostall the dgump packaie).
The syntax for dump :
# dgump <tpttios><destioattio fle ioame><stgurce fle ioame>(tt take a backgup tf the fle
systems).
The tpttios are -0----->fgull backgup
-(1 - 9). -----> iiocremeiotal backgups
-gu -----> gupdate the /Setc/Sdgumpdates fle afer sguccessfgul dgump
- -----> erbtse
-f ----->make the backgup iio a fle
-e -----> exclgude iiotde iogumber while backiioi gup
# dgump -0gu f /Stpt/Sfgull.dgump /Sctss (tt take a fgull backgup tf the /Sctss fle system aiod
ctpied it iio /Stpt).
# dgump -1gu f /Stpt/Sfgull.dgump /Sctss (tt take a backgup mtdifed fles frtm the last fgull
backgup iotthiioi
bgut iiocremeiotal backgup).
# dgump -2gu f /Stpt/Sfgull.dgump /Sctss (tt take a backgup mtdifed fles frtm the last
iiocremeiotal le el -1
backgup).
The syntax for restore :
# resttre <tpttios><dgump backgup fle> (tt resttre the backgup ctioteiots if that data is ltst).
The tpttios are -f -----> gused tt specify the dgump tr backgup fle
-C -----> gused tt ctmpare the dgump fle with triiiioal fle
- -----> erbtse
-e -----> exclgude the iiotde iogumber
-i -----> resttre iio iioteract e mtde
The commands in interactive mode are,
resttre> ls -----> list the fles aiod directtries iio the backgup fle
resttre> add ----> add the fles frtm dgump fle tt cgurreiot wtrkiioi directtry
resttre> cd -----> chaioie the directtry
resttre> pwd ---> displays the preseiot wtrkiioi directtry
resttre> extract ----> extract the fles frtm the dgump fle
resttre> qguit ---> tt qguit frtm the iioteract e mtde
# resttre -t /Stpt/Sfgull.dgump (tt list the dgump fle ctioteiots).
# resttre -rf /Stpt/Sfgull.dgump (tt resttre the dgump fle ctioteiots).
10. How many types of backup available?
There are maiioly three types tf backgups a ailable.
(i). Fgull backgup (Eiotre fle system backgup).
(ii). Iiocremeiotal backgup (backgup frtm the last fgull backgup tr iiocremeiotal backgup).
(iii). Cgumgulat e tr difeereiotal backgup (backgup frtm last fgull backgup tr cgumgulat e backgup).
11. What is the diference between incremental and diferential backup?
Incremental backup :
Takiioi a backgup frtm the last fgull backgup tr last iiocremeiotal backgup
Diferential backup :
Takiioi a backgup frtm last fgull backgup tr last cgumgulat e tr difeereiotal backgup
12. Which file will update when backing up with dump command?
/etc/dumpdates fle will be gupdated wheio backiioi gup with dgump ctmmaiod.
13. What are the dump devices?
(i). Tape dri es
(ii). Disks (ltcal disks).
(iii). Lguios (ioetwtrk disks).
14. What is snap shot?
(i). The ptiiot - iio - tme ctpy tf the fle system is called the sioap shtt.
(ii). It prt ides tioliioe backgup stlguttio tf the fle system.
(iii). We caio take a backgup while the fle system is mtguioted aiod it is iio mgult-guser mtde.
(i ). It tccgupied tioly as mguch disk space as the fle system ie. beiioi captgured.
( ). We caio alst create backgup delete qguery temptrary (read-tioly). sioap shtts gusiioi fssnap
ctmmaiod.
15. What are the diferences between tar and cpio commands?
(i). y tar we caio take backgup guptt 80G sise tf fle systems bgut gusiioi cpit there is iot limit.
(ii). Iio tar the backgup is iio archi e ftrmat ie. iio ctmpressed state bgut iio cpit there is iot
ctmpressitio.
(iii). Iio btth the types tioly the whtle backgup is ptssible.
16. How to take a backup on production servers?
(i). Ntrmally iio backgup eio irtiomeiot we ha e 3 ser ers.
(a). MBaster ser er (prtdgucttio ser ers -- 1 tr 2 iot's)..
(b). MBedia ser er (backgup ser er -- 1 tr 2 iot's)..
(c). Clieiot ser er (Ntrmal system).
(ii). ackgups caio be takeio iio types.
(a). Applicattio ackgup (Ntrmally applicattio gusers will take these types tf backgups).
(b). File system ackgup (O/SS backgup System Admiioistrattrs will take these types tf
backgups).
(c). Database ackgup (D A gusers will take these types tf backgups).
(iii). Ntrmally backgup is aguttmated thrtguih stme backgup tttls like Veritas Net backgup I MB
Ti tli aiod Aguttsys.
(i ). Usiioi crtio tttl alst we caio take backgup. gut crtio will iott iioftrm the failed backgup. The
tther tttls will iioftrm by seiodiioi messaies like why the backgup is failed wheio aiod where it
is failed ..etc.
( ). Oio prtdgucttio ser ers the backgup will ftlltw the prtcedgure
(a). MBaster ser er deptrt frtm prtdgucttio.
(b). Imptrt the master ser er tio MBedia ser er.
(c). Theio MBaster ser er will jtiio with the MBedia ser er.
(d). Syioc the data with the MBaster ser er.
(e). Take a backgup frtm MBaster ser er aiod sttre the ctpy tio MBedia ser er.
(f). Split the MBaster ser er frtm MBedia ser er.
(i). Deptrt the MBaster ser er frtm MBedia ser er.
(h). Imptrt the MBaster ser er tio prtdgucttio.
(i). Jtiio the MBaster ser er with prtdgucttio.
17. What is your company's backup policy?
(i). y dgump ctmmaiod we caio take backgups tio disks tapes aiod takes fgull iiocremeiotal aiod
difeereiotal tr cgumgulat e backgups.
(ii). le el 0 -- Fgull backgup (mtiothly tioce).
le el 3 -- Perftrmed tio e ery MBtioday (Iiocremeiotal frtm last fgull tr last
iiocremeiotal backgup).
le el 4 -- Perftrmed tio e ery Tguesday (Iiocremeiotal frtm last le el 3 backgup).
le el 5 -- Perftrmed tio e ery Wedioesday (Iiocremeiotal frtm last le el 4 backgup).
le el 6 -- Perftrmed tio e ery Thgursday (Iiocremeiotal frtm last le el 5 backgup).
le el 7 -- Perftrmed tio e ery Friday (Iiocremeiotal frtm last le el 6 backgup).
le el 8 -- Perftrmed tio e ery Satgurday (Iiocremeiotal frtm last le el 7 backgup).
le el 2 -- Perftrmed tio e ery Sguioday (difeereiotal tr cgumgulat e backgup frtm
last fgull backgup
ie. frtm MBtioday tt Satgurday).
18. What is the information is stored in /etc/dumpdates file?
/Setc/Sdgumpdates fle rectrds the backgup iioftrmattio if -gu tpttio is gused with dgump
ctmmaiod tt take a backgup. Iio this fle each liioe tells the fle system that was backed gup last
le el tf backgup the date day aiod tme tf the backgup.
(c). It will take mtre tme tt the system aiod (c). It will take less tme tt start the system aiod
ser ices. ser ices wheio ctmpared tt RHEL - 6.
(d). It will start the ser ices tioe by tioe. (d). It will start the ser ices parallel iott tioe by tioe.
(e). All the liiogux ser ices are eiods with letter
(e). All the liiogux ser ices are eiods with letter d.
d.ser ice
Example : sshd httpd crtiod ...etc.
Example : sshd.ser ice httpd.ser ice ...etc.
# kill (It seiods the specifed siiioal tt the specifed prtcess tr prtcess irtgup).
# pkill (It will seiod the specifed siiioal tt each prtcess iiostead tf listioi them tio
staiodard tgutpgut).
# pstree (tt shtw all the rguioioiioi prtcesses as a tree strguctgure. The tree is rttted
either pid tr iioit).
# ioice (tt rguio a prtiram with mtdifed schedguliioi pritrity ie. it rguios the prtcess
with aio
adjgustable ioiceioess).
# reioice (tt alter the schedguliioi pritrity tf tioe tr mtre rguioioiioi prtcesses).
# pirep (tt list the prtcess id's which matches with the pirep arigumeiot).
RHEL - 6 commands :
# ser ice <ser ice ioame> statgus (tt check the statgus tf the ser ice).
# ser ice <ser ice ioame> start (tt start the ser ice).
# ser ice <ser ice ioame> sttp (tt sttp the ser ice).
# ser ice <ser ice ioame> reltad (tt reltad the ser ice).
# ser ice <ser ice ioame> restart (tt restart the ser ice).
* These abt e ctmmaiods will chaioie the ser ice statguses temptrarily. St if we waiot tt chaioie
statguses tf the
prtcess aguttmatcally frtm ioext bttt tiowards we ha e tt eioable thtse ser ices as ii eio beltw.
# chkctiofi --list (tt check the a ailability tf the ser ices iio
difeereiot rguio le els).
# chkctiofi --list <ser ice ioame> (tt check the a ailability tf the ser ice iio
difeereiot rguio le els).
# chkctiofi <ser ice ioame> tio (tt make the ser ice a ailable afer restart).
# chkctiofi <ser ice ioame> tfe (tt make the ser ice guioa ailable afer ioext
bttt).
# chkctiofi --le el <1-6><ser ice ioame><tio/Stfe>(tt make the ser ice a ailable tr
guioa ailable tio the
partcgular rguio le el).
# chkctiofi --le el 5 sfpd tio (tt make the sfpd ser ice a ailable tio rguio le el 5).
# chkctiofi --le el 345 sfpd tio (tt make the sfpd ser ice a ailable tio rguio le els
3 4 aiod 5).
RHEL - 7 commands :
# systemctl statgus <ser ice ioame> (tt check the statgus tf the ser ice).
# systemctl start <ser ice ioame> (tt start the ser ice).
# systemctl sttp <ser ice ioame> (tt sttp the ser ice).
# systemctl reltad <ser ice ioame> (tt reltad the ser ice).
# systemctl restart <ser ice ioame> (tt restart the ser ice).
* These abt e ctmmaiods will chaioie the ser ice statguses temptrarily. St if we waiot tt chaioie
statguses tf the
prtcess aguttmatcally frtm ioext bttt tiowards we ha e tt eioable thtse ser ices as ii eio
beltw.
# systemctl eioable <ser ice ioame> (tt make the ser ice a ailable at ioext bttt).
# systemctl disable <ser ice ioame> (tt make the ser ice guioa ailable at ioext bttt).
# irep <striioi ioame><fle ioame> (tt display the specifed striioi iio that fle).
# irep -io <striioi ioame><fle ioame> (tt display the striioi with liioe iot's).
# irep -e <striioi ioame 1> -e <striioi 2><fle ioame> (tt display 2 tr mgultple striiois iio
that fle).
# irep -t <striioi ioame><fle ioame> (tt display tioly that striioi iio that fle iott whtle the
text tf that fle).
# irep - <striioi ioame><fle ioame> (tt display all the striiois except the specifed tioe).
# irep ^ this ctss (tt display the liioe which is startioi with the
specifed striioi).
A prtcess is a set tf iiostrgucttios which execgutes iio the memtry. It is created iio the memtry
wheio a prtiram tr ctmmaiod is execguted. E ery prtcess is ideiotfed by a guioiqgue iot. ie. PID
(Prtcess ID).. Se eral prtcesses are started at bttt tme aiod which are rguioioiioi at backirtguiod
called deamtios. The Liiogux kerioel is gused tt ctmmguioicate with the prtcesses by their prtcess
ID's (PID's).. Deamtio is a prtcess rguioioiioi iio the backirtguiod. These are haiodled by the system
aiod prtcess are haiodled by the gusers.
The frst prtcess iio RHEL - 6 is initd aiod it starts at bttt tme. It's prtcess ID is 1 where as iio
RHEL - 7 the frst prtcess is systemd aiod it starts at bttt tme. Tt maioaie tr tt see the
prtcesses there are twt ctmmaiods.
(i). # ps aiod (ii). # ttp
# ps :
It is jgust a sioap shtt tf the cgurreiot statgus tf the prtcesses. It ii es tioly tioe termiioal
iioftrmattio iott all the termiioals iioftrmattio.
# top :
Usiioi ttp ctmmaiod we caio mtioittr the prtcesses ctiotiogutgusly. y defagult e ery 3 sectiods
it will refresh the data.
2. How many process are run generally on Linux and explain them?
There are ieioerally three types tf prtcesses that rguio tio Liiogux. They are
(i). Iioteract e Prtcesses
(ii). System Prtcess tr deamtio
(iii). Aguttmatc tr batch.
Interactive Processes :
Iioteract e prtcesses are thtse prtcesses that are iio tked by a guser aiod caio iioteract with the
guser. Ftr example # i tr # im are the iioteract e prtcesses. Iioteract e prtcesses may be
rguio iio ftreirtguiod tr backirtguiod. The ftreirtguiod prtcess is the prtcess that we are cgurreiotly
iioteractioi with aiod is gusiioi the termiioal as its stdiio (staiodard iiopgut). aiod stdtgut (staiodard
tgutpgut).. The backirtguiod prtcess is iott iioteractioi with the guser aiod caio be iio tioe tf twt
states ie. pagused tr rguioioiioi.
System Processes or deamons :
Deamtio is refer tt prtcesses that are rguioioiioi tio the ctmpguter aiod prt ides ser ices bgut dt
iott iioteract with the ctiostle. MBtst ser er stfware is implemeioted as a deamtio. Ftr example
Apache samba sshd are the deamtios. Aioy prtcess caio bectme a deamtio as ltioi as it is rguio iio
the backirtguiod aiod dtes iott iioteract with the guser.
Automatic processes :
Aguttmatc prtcesses are iott ctioioected tt a termiioal aiod these are qguegued iiott a spttler area
where they wait tt be execguted tio a FIFO (First Iio - First Ogut). basis. Sguch tasks caio be
execguted gusiioi tioe tf twt criteria.
At certaiio date aiod tme : dtioe gusiioi the "at" ctmmaiod.
Wheio the tttal system ltad is ltw eiotguih tt accept extra jtbs : dtioe gusiioi the " cron "
ctmmaiod. y defagult tasks are pgut iio a qguegue where they wait tt be execguted guiotl the system
ltad is ltwer thaio 0.8 aiod crtio jtb prtcessiioi is alst gused ftr tptmisiioi system perftrmaioce.
3. What is parent process?
The prtcess which starts tr creates aiotther prtcess is called the pareiot prtcess. E ery
prtcess will be ha iioi a pareiot prtcess except iioitd prtcess. The iioitd prtcess is the pareiot
prtcess tt all the remaiioiioi prtcesses iio
Liiogux system becaguse it is the frst prtcess which iets started by the kerioel at the tme tf
btttioi aiod it's PID
is 1. Oioly afer iioitd prtcess iets started the remaiioiioi prtcesses are called by it aiod heioce it
is resptiosible ftr all the remaiioiioi prtcesses iio the system. The pareiot prtcess is ideiotfed by
PPID (pareiot prtcess ID)..
4. What is child process?
A prtcess which started tr created by the pareiot prtcess is called child prtcess aiod it is
ideiotfed by PID.
Useful # ps commands :
# ps -a (it displays all the termiioals prtcesses iioftrmattio).
# ps -agu (it displays all the termiioals prtcesses iioftrmattio with guser
ioames).
# ps -agux (it displays all the termiioals prtcesses iioftrmattio iioclgudiioi
backirtguiod
prtcesses with guser ioames).
* ? (qguesttio mark). if it is appeared at tty ctlgumio it iiodicates that is a backirtguiod prtcess.
# ps -ef (it displays the tttal prtcesses iioftrmattio with pareiot
prtcess ID (PPID).).
# ps -P <prtcess id> (it displays the prtcess ioame if we kiotw the prtcess ID
(pid).).
# pidtf<prtcess ioame> (tt see the prtcess ID tf the specifed prtcess).
# pidtf iioitd (tt see the prtcess ID tf the iioitd prtcess).
# pstree (tt display the pareiot aiod child prtcesses strguctgure iio tree
ftrmat).
# ps -gu <guser ioame> (tt display all the prtcesses tf the specifed guser).
# ps -gu rajgu (tt display all the prtcesses tf the guser rajgu).
# ps -G <irtgup ioame> (tt display all the prtcesses that are rguioioiioi by a partcgular
irtgup).
# ps -t pid ctmm %mem %cpgu (tt display prtcess id ctmmaiod %memtry aiod
%cpgu gutlisattio
iotthiioi bgut flteriioi the tgutpgut).
# ps -At pid ctmm %mem %cpgu (tt display the same iioftrmattio as abt e bgut
iioclgudiioi stme mtre
iioftrmattio).
# ps -t pid ctmm %mem %cpgu |strt -k <iot.> -r |head -io 10 (tt display which prtcess is
gutlisiioimtre
memtry tr cpgu iio re erse trder where -k meaios feld <iot.> meaios feld iot. aiod -r re erse
trder).
# ps -t pid ctmm %mem %cpgu |strt -k 3 -r |head -io 10 (tt display the prtcess
which tccgupies mtre
memtry aiod cpgu gutlisattio iio re erse trder).
# ps -agux |irep freftx (tt check whether the freftx is
rguioioiioi tr iott).
# pirep -U <guser ioame> (tt display all the prtcess ID's
tioly ftr that guser).
* Tt ctmmguioicate with the prtcesses # kill aiod # pkill ctmmaiods are gused.
# kill -----> It will kill the prtcesses gusiioi PID's.
# pkill -----> It will kill the prtcesses gusiioi prtcess ioames.
* We caio alst ii e stme siiioals while gusiioi the abt e ctmmaiods aiod we iet the siiioals
iioftrmattio by
# kill -l ctmmaiod. This ctmmaiod will list all the siiioals with iot's aiod there are 64 siiioals tt
pass.
5. What is signal in Process management?
Siiioals are a way tf seiodiioi simple messaies tt prtcesses. MBtst tf these messaies are already
defioed aiod htwe er siiioals caio tioly be prtcessed wheio the prtcess is iio guser mtde. E ery
siiioal has a guioiqgue siiioal ioame. Each siiioal ioame is a macrt which staiods ftr a ptsit e iioteier.
Siiioals caio be ieioerated by the prtcess itself tr they caio be seiot frtm tioe prtcess tt aiotther.
A ariety tf siiioals caio be ieioerated tr deli ered aiod they ha e maioy guses ftr prtirammers.
6. What are the important signals in process management?
1. SIGHUP -----> tt reltad (read the ctiofigurattio aiod ltad).
2. SIGINT -----> tt iioterrgupt frtm the keybtard (iotthiioi bgut Ctrl + c).
3. SIGQUIT -----> tt qguit the prtcess frtm keybtard (iotthiioi bgut Ctrl + l).
9. SIGKILL -----> tt kill the prtcess ftrcefgully (iotthiioi bgut guiobltckable).
15.SIGTERMB -----> wait ftr ctmpletioi the prtcess aiod theio termiioate (termiioate iracefgully).
18.SIGCONT -----> tt ctiotiogue tr resgume the prtcess if it is sttpped
19.SIGSTOP -----> tt termiioate the prtcess (If it is iott sttpped the prtcess we caioiott
ctiotiogue tr resgume that
prtcess by Ctrl + c tr Ctrl + s).
20.SIGHTSTP ----> tt sttp the prtcess (iotthiioi bgut Ctrl + s).
* gut the mtst ctmmtioly gused siiioals are 1 9 15 aiod 20.
* The defagult siiioal is 15 (iracefgully). wheio we iott specifed aioy siiioal.
# kill - <siiioal><prtcess ID> (tt kill the specifed prtcess gusiioi kill siiioal).
# kill -9 1291 (tt kill the prtcess which has the PID as
1291).
* If we iott specifed the siiioal iot. theio the defagult siiioal 15 will efeect.
# kill 1291 (tt kill the prtcess 1291 with defagult siiioal).
# pkill -gu <guser ioame> (tt kill all the prtcesses tf the specifed
guser).
# pkill -gu rajgu (tt kill all the prtcesses tf the guser rajgu).
# pkill -9 freftx (tt kill the freftx prtcess).
7. How many process states are there?
There are six prtcess states aiod they are
(i). Rguioioiioi prtcess (the prtcess which is iio rguioioiioi state aiod is iiodicated by " r " )..
(ii). Sleepiioi prtcess (the prtcess which is iio sleepiioi state aiod is iiodicated by " s " ).
(iii). Waitioi prtcess (the prtcess which is iio waitioi state aiod is iiodicated by " w " )..
(i ). Sttppiioi prtcess (the prtcess which is iio sttppiioi state aiod is iiodicated by " T " )..
( ). Orphaio prtcess (the prtcess which is rguioioiioi withtgut pareiot prtcess aiod is iiodicated by
" o " )..
( i). Ztmbie prtcess (the prtcess which is rguioioiioi withtgut child prtcess aiod is iiodicated by " Z
" )..
8. What is Orphan process?
The prtcesses which are rguioioiioi withtgut pareiot prtcesses are called Orphaio prtcesses.
Stmetmes pareiot prtcess cltsed withtgut kiotwiioi the child prtcesses. gut the child prtcesses
are rguioioiioi at that tme. These child prtcesses are called Orphaio prtcesses.
9. What is Zombie process?
Wheio we start pareiot prtcess it will start stme child prtcesses. Afer stme tme the child
prtcesses will died becaguse tf iott kiotwiioi the pareiot prtcesses. These pareiot prtcesses
(which are rguioioiioi withtgut child prtcesses). are called Zambie prtcesses. These are alst
called as defaguioct prtcesses.
10. How to set the priority for a process?
Prtcesses pritrity meaios maioaiiioi prtcesstr tme. The prtcesstr tr CPU will perftrm
mgultple tasks at the same tme. Stmetmes we caio ha e eiotguih rttm tt take tio mgultple
prtjects aiod stmetmes we caio tioly ftcgus tio tioe thiioi at a tme. Other tmes stmethiioi
imptrtaiot ptps gup aiod we waiot tt de tte all tf tgur eioeriy iiott stl iioi that prtblem while
pgutioi less imptrtaiot tasks tio the back bgurioer.
Iio Liiogux we caio set iguideliioes ftr the CPU tt ftlltw wheio it is lttkiioi at all the tasks it has tt
dt. These iguideliioes are called niceness tr nice value. The Liiogux ioiceioess scale ites frtm
-20 to 19. The ltwer the iogumber the mtre pritrity that task iets. If the ioiceioess algue is hiiher
iogumber like 19 the task will be set tt the ltwest pritrity aiod the CPU will prtcess it wheioe er it
iets a chaioce. The defagult ioice algue is 0 (zero)..
y gusiioi this scale we caio alltcate tgur CPU restgurces mtre apprtpriately. Ltwer pritrity
prtirams that are iott imptrtaiot caio be set tt a hiiher ioice algue while the hiiher pritrity
prtirams like deamtios aiod ser ices caio be set tt recei e mtre tf the CPU's ftcgus. We caio
e eio ii e a specifc guser a ltwer ioice algue ftr all his/Sher prtcesses st we caio limit their ability
tt sltw dtwio the ctmpguter's ctre ser ices.
There are twt tpttios tt redguce/Siiocrease the algue tf a prtcess. We caio either dt it gusiioi the
nice tr renice ctmmaiods.
Examples :
# ioice -io <ioice algue raioie frtm -20 tt 19><ctmmaiod> (tt set a pritrity tt a prtcess
beftre startioi it).
# ioice -io 5 cat > rajgu (tt set the medigum pritrity tt
cat ctmmaiod).
# ps -elf (tt check the ioice algue ftr that
ctmmaiod).
* Tt reschedgule the ioice algue tf existioi prtcess frst check the PID tf that prtcess by # ps
-elf ctmmaiod
aiod theio chaioie the ioiceioess tf that ctmmaiod by # renice <nice value (-20 to 19)>< PID >
ctmmaiod.
# reioice 10 1560 (tt reschedgule the PID
1560).
11. What is top command and what it shows?
top is a ctmmaiod tt see the prtcesses states aiod statguses iioftrmattio ctiotiogutgusly guiotl we
qguit by pressiioi " q ". y defagult ttp ctmmaiod will refresh the data ftr e ery 3 sectiods.
Wheio we ioeed tt see the rguioioiioi prtcesses tio tgur Liiogux iio real tme the ttp ctmmaiod will
be ery gusefgul. esides the rguioioiioi prtcesses the ttp ctmmaiod alst displays tther
iioftrmattio like free memtry btth physical aiod swap.
The frst liioe shtws the cgurreiot tme "up 1 day" shtws htw ltioi the system has beeio gup ftr
"3 user" htw maioy gusers ltiiio "load average : 0.01, 0.00, 0.23" the ltad a eraie tf the
system 1, 5 and 15 minutes.
The sectiod liioe shtws the iot tf prtcesses aiod their cgurreiot states.
The third liioe shtws CPU gutlisattio details like % tf the gusers prtcesses % tf the system
prtcesses % tf a ailable CPU aiod % tf CPU waitioi tme ftr I/SO (iiopgut aiod tgutpgut)..
The ftgurth aiod ffh liioes shtws the tttal physical memtry iio the system gused physical
memtry free physical memtry bgufeered physical memtry the tttal swap memtry iio the
system gused swap memtry free swap memtry aiod cached swap memtry ... etc.
Frtm sixth liioe tiowards the felds are as ftlltws.
PID Prtcess ID
USER Owioer tf the prtcess ie. which guser execguted that prtcess
PR Dyioamic Pritrity
NI Nice algue alst kiotwio as base algue
VIRT Virtgual sise tf the task iioclgudes the sise tf prtcesses execgutable biioary
RES The sise tf RAMB cgurreiotly ctiosgumed by the task aiod iott iioclguded the
swap ptrttio
SHR Shared memtry area by twt tr mtre tasks
S Task Statgus
% CPU The % tf CPU tme dedicated tt rguio the task aiod it is dyioamically
chaioied
% MEM The % tf memtry cgurreiotly ctiosgumed by the task
TIME+ The tttal CPU tme the task has beeio gused siioce it started. + siiio meaios
it is displayed with hguiodredth tf a sectiod iraiogularity. y
defagult TIMBE/STIMBE+ dtes iott acctguiot the CPU tme gused
by the task's dead childreio
COMMAND Shtwiioi prtiram ioame tr prtcess ioame.
* While rguioioiioi the ttp ctmmaiod jgust press the ftlltwiioi keys wtks aiod the tgutpgut will be
sttred iio real tme.
1 -----> 2iod CPU iioftrmattio Shif + > -----> Paie gup
h ----->Help Shif + < -----> Paie dtwio
Eioter -----> Refresh immediately io -----> Ngumber tf tasks
k -----> Kill the prtcess gu -----> guser prtcesses
MB -----> Strt by memtry gusaie P -----> Strt by CPU gusaie
T -----> Strt by cgumgulat e tme s -----> Ctltr display
r -----> Tt reschedgule the pritrity by reioice d -----> Chaioie the delay tme
(refresh tme).
b -----> Hiihliiht the rguioioiioi prtcess W -----> Write the iioftrmattio iio
/root/.toprc fle
q -----> qguit the ttp ctmmaiod
The status of the processes :
r -----> Rguioioiioi prtcess s -----> Sleepiioi prtcess
s -----> Ztmbie prtcess T -----> Sttpped prtcess
D -----> Uioiioterrgupted sleepiioi prtcess R< -----> Hiih pritrity
N > ----> Ltw pritrity t -----> Orphaio prtcess
+ -----> Ftreirtguiod prtcess ? -----> ackirtguiod prtcess
# reioice -io 10 5453 (tt chaioie the specifed rguioioiioi prtcess
pritrity tio liioe).
# ioice -io -15 freftx (tt start the freftx prtcess with pritrity
le el -15).
12. How to solve the issue if the CPU utilization is 99% ?
(i). First check which prtcess aiod wht execguted that prtcess is ctiosgumiioi mtre CPU gutlisattio
tr memtry gutlisattio by execgutioi # top ctmmaiod.
(ii). Theio iioftrm tt thtse gusers wht execguted that prtcess thtguih mail messaie tr raisiioi the
tcket.
(iii). If thtse gusers are iott a ailable tr iott resptiodiioi tt tgur mail theio we ha e tt chaioie the
pritrity tf that prtcess gusiioi # renice ctmmaiod.
(i ). eftre chaioiiioi the prtcess pritrity le el we ha e tt iet tr take apprt al frtm tgur team
lead tr prtject maioaier.
13. How to check the wwn no. of lun?
(i). First iiostall sysutils packaie tt execgute the ctmmaiods tt kiotw the wwio iogumber by
execgutioi ctmmaiod
# yum install sysutils -y
(ii). # systool -c fs_host -v |grep "port-name" (tt check the wwio iogumber).
14. How to remove the page caches and other caches?
# sysioc echt 2 > /Sprtc/Ssys/S m/Sdrtp_caches (tt remt e the paie caches).
# sysioc echt 3 > /Sprtc/Ssys/S m/Sdrtp_caches (tt remt e all types tf caches like
deiot cache
paie caches aiod tthers).
15. What is "sosreport" and how to generate it?
Sosreport is a ctmmaiod iio liiogux (RHEL / CentOS). which ctllects system configuration aiod
diaiiotstc iioftrmattio tf ytgur liiogux btx like rguioioiioi kerioel ersitio ltaded mtdgules aiod
system aiod ser ice ctiofigurattio fles. This ctmmaiod alst rguios exterioal prtirams tt ctllect
fgurther iioftrmattio aiod sttres this tgutpgut iio the resgultioi archi e.
Stsreptrt is reqguired wheio ytgu ha e tpeio a case with redhat ftr techioical sgupptrt. Redhat
sgupptrt Eioiiioeers will reqguire stsreptrt tf ytgur ser er ftr trtgubleshtttioi pgurptse.
Tt rguio stsreptrt sos packaie shtguld be iiostalled. Sts packaie is part tf defagult iiostallattio iio
mtst tf liiogux. If ftr aioy reastio this packaie is iot iiostalled theio guse beltw ygum ctmmaiod tt
iiostall sos package :
# ygum iiostall sts -y
Generate the sosreport :
Opeio the termiioal aiod type stsreptrt ctmmaiod :
# stsreptrt
This ctmmaiod will iotrmally ctmplete withiio a few minutes. Depeiodiioi tio ltcal ctiofigurattio
aiod the tpttios specifed iio stme cases the ctmmaiod may take ltioier tt fioish. Oioce
ctmpleted stsreptrt will ieioerate a ctmpressed a fle guioder /tmp ftlder. Difeereiot ersitios guse
difeereiot ctmpressitio schemes (gz, bz2, or xz).. The fle shtguld be prt ided tt Redhat sgupptrt
represeiotat e (iotrmally as aio attachmeiot tt aio tpeio case)..
Note: stsreptrt reqguires rttt permissitios tt rguio.
Diferent Options used in sosreport command :
The stsreptrt ctmmaiod has a modular structure aiod alltws the guser tt eioable aiod disable
mtdgules aiod specify mtdgule tpttios ia the ctmmaiod liioe. Tt list available modules (plgui-iios).
guse the ftlltwiioi ctmmaiod:
# stsreptrt -l
Tt turn of a mtdgule iioclgude it iio a ctmma-separated list tf mtdgules passed tt the -io/S–skip-
plguiiios tpttio. Ftr iiostaioce tt disable btth the k maiod amd mtdgules:
# stsreptrt -io k m amd
Iiodi idgual mtdgules may prt ide addittioal tpttios that may be specifed ia the -k option. Ftr
example tio Red Hat Eioterprise Liiogux 5 iiostallattios the sts rpm mtdgule ctllects "rpm -Va"
tgutpgut by defagult. As this may be time-consuming the beha itgur may be disabled ia:
# stsreptrt -k rpm.rpm a=tfe
16. What is the command to see the complete information on virtual memory?
# mstat is the ctmmaiod tt the ctmplete iioftrmattio tio irtgual memtry like iot tf
prtcesses memtry gusaie paiiioi memtry bltck I/SO (iiopgut /Stgutpgut). traps disk aiod
CPU act ity.
# mstat 2 10 (It will ii e the reptrt ftr e ery 2 sectiods guptt 10 tmes).
The felds are r -----> htw maioy waitioi prtcesses
b -----> htw maioy prtcesses are bgusy
swapd -----> htw mguch irtgual memtry gused
free -----> htw mguch memtry is freely a ailable
bgufeer -----> htw mguch temptrary memtry gusiioi
cachiioi -----> htw mguch cachiioi stll gusiioi
swapiio -----> htw mguch data traiosferred frtm RAMB tt swap
swaptgut ---> htw mguch data traiosferred frtm swap tt RAMB
bi -----> htw mguch bltck iiopgut
bt -----> htw mguch bltck tgutpgut
system iio ---> the iot. tf iioterrgupts
system cs ---> the iot. tf ctiotexts chaioied
# mstat -a (tt see the act e aiod iioact e prtcesses).
# mstat -d (tt see the statstcs tf the disk gused).
# cat /Sprtc/Smemiioft (tt see the preseiot memtry iioftrmattio).
17. What is the command to see the I/O statistics?
# itstat (tt see the Iiopgut aiod Ogutpgut statstcs iio the Liiogux system).
* This ctmmaiod is gused tt mtioittriioi the system iiopgut aiod tgutpgut statstcs aiod prtcesses
traiosfer rate.
* It is alst gused tt mtioittr htw maioy kilt bytes read per sectiod aiod htw maioy kilt bytes
read aiod write shtws CPU ltad a eraie statstcs siioce the last rebttt iio frst liioe
aiod mtst cgurreiot data is shtwio iio the sectiod liioe.
18. How many CPUs are there in the system?
# cat /proc/cpuinfo ctmmaiod will shtw iot. tf CPUs iot. tf ctres iot. tf threads iot. tf
stckets aiod the CPU architectgure ...etc. iioftrmattio.
# nproc ctmmaiod will ii e the iot. tf CPUs preseiot iio the system.
# lscpu ctmmaiod will ii e the iioftrmattio the architectgure tf the CPU (x86_64 tr x86_32).
iot. tf ctres iot. tf threads iot. tf stckets cache memtry sises (L 1 L 2 L 3 ...etc). CPU
speed aiod the eiodtr tf the CPU.
19. How to send the processor into offline?
# ls -l /sys/devices/system/cpu is the ctmmaiod tt see the iot. tf prtcesstrs preseiot iio the
system.
# echo 0 > /sys/devices/system/cpu/cpu4/online is the ctmmaiod tt seiod the CPU4 iiott
tffliioe.
# grep "processor" /proc/cpuinfo tr # cat /sys/devices/system/cpu/offline are the
ctmmaiod tt see the prtcesstr statgus whether tffliioe.
20. How to send the processor into online?
# ls -l /sys/devices/system/cpu is the ctmmaiod tt see the iot. tf prtcesstrs preseiot iio the
system.
# echo 1 > /sys/devices/system/cpu/cpu4/online is the ctmmaiod tt seiod the CPU4 iiott
tffliioe.
# grep "processor" /proc/cpuinfo tr # cat /sys/devices/system/cpu/online are the
ctmmaiod tt see the prtcesstr statgus whether tioliioe.
21. How to clear /var and /tmp directories?
(i). Ctpy all the eiotries tf thtse directtries iiott a separate ltcattios.
(ii). Redirect the iogull algues iio /S ar aiod /Stmp directtries by execgutioi the beltw ctmmaiods.
# cat /Sde /Siogull > /S ar (tt iogullifyiioi the /S ar directtry).
# cat /Sde /Siogull > /Stmp(tt iogullifyiioi the /Stmp directtry).
22. How to troubleshoot if df -k is giving error?
(i). First check which fle system is ii iioi errtr by # df -k ctmmaiod theio see whether aioy fles
are tpeioed tr iott. If tpeioed theio cltse thtse fles by iioftrmiioi thtse teams which are
gusiioi that fle system.
(ii). Uiomtguiot that fle system by takiioi apprt al frtm hiiher aguthtrites aiod rguio fsck tio that fle
system theio iotrmally it will be stl ed if we rguio fsck ctmmaiod.
(iii).If iott stl ed e eio thtguih we rguio fsck theio delete tr remt e that fle system recreate
that fle system mtguiot that fle system aiod resttre the data frtm receiot backgup.
23. What are the diferences between a deamon and a process?
(i). Deamtio is a ser ice tt prt ide stme ser ices tt the gusers where as a prtcess is tt dt stme
partcgular tasks.
(ii). We caio eioable tr disable the deamtio bgut we caioiott disable tr eioable the prtcess.
(iii).We caio dt start tr sttp the deamtio bgut we caioiott start tr sttp the prtcess. We tioly
kill the prtcess.
(i ). We caio eioable tr disable tt start the deamtios at bttt tme as per tgur reqguiremeiot ie. tio
demaiod is ptssible bgut it is iott ptssible if is a prtcess.
( ). Deamtio is a backirtguiod prtcess where as prtcess is a ftreirtguiod prtcess.
24. What is command to check the load average?
# uptime is the ctmmaiod tt check the system ltad preseiot tme frtm htw maioy htgurs the
system is rguioioiioi aiod ltad a eraie.
* The ltad a eraie shtws three felds. The 1st feld shtws the ltad a eraie frtm 1 miiogute
2iod feld shtws the ltad a eraie frtm 5 miiogutes aiod 3rd feld shtws the ltad
a eraie frtm 15 miiogutes.
25. How to assign or shif the process to the particular CPU?
(i). First iiostall util-linux packaie by # yum install util-linux -y ctmmaiod.
(ii). Check the specifed prtcess is assiiioed tt which prtcesstr ie. which CPU by # taskset -p
<pid> ctmmaiod.
(iii). Theio shif the prtcess tt aiotther a ailable CPU by # taskset -cp <cpu -list><pid>
ctmmaiod.
Examples:
# taskset -p 2125 (tt check which prtcesstr is assiiioed tt that
prtcess ID).
# taskset -cp 0 4 2125 (tt shif the prtcess tt the CPUs 0 aiod 4).
# taskset 0 freftx (tt assiiio the freftx prtcess tt the CPU 0).
26. How to limit the CPU usage of a linux process?
(a). First iiostall the cpulimit packaie by # yum install cpulimit -y ctmmaiod.
* This packaie is iott a ailable iio iotrmal Liiogux packaies aiod it is a ailable iio EPEL (Extra
Packaies ftr Eioterprise Liiogux).. St frst we ha e tt eioable the EPEL reptsittry
iio tgur system by ftlltwiioi steps.
(i). # ygum iiostall epel-release -y (tt iiostall the epel-release packaie
iio RHEL - 7).
(ii). # rpm -U h http:/S/Smirrtrs.kerioel.tri/Sfedtra-epel/S6/Si386/Sepel-release-6-8.iotarch.rpm
(tt iiostall the
EPEL packaie iio RHEL - 6).
(ii). # rpm -U h http:/S/Smirrtrs.kerioel.tri/Sfedtra-epel/S5/Si386/Sepel-release-5-4.iotarch.rpm
(tt iiostall the
EPEL packaie iio RHEL - 5).
(iii). # rpm --imptrt /Setc/Spki/Srpm-ipi/SRPMB-GPG-KEY-EPEL-5 (tt imptrt the ipi key if it
ask wheio execgutioi
the abt e ctmmaiod iio RHEL - 5).
(i ). # rpm --imptrt /Setc/Spki/Srpm-ipi/SRPMB-GPG-KEY-EPEL-6 (tt imptrt the ipi key if it
ask wheio
execgutioi the abt e ctmmaiod iio RHEL - 6).
( ). # rpm --imptrt /Setc/Spki/Srpm-ipi/SRPMB-GPG-KEY-EPEL-7 (tt imptrt the ipi key if it
ask wheio
execgutioi the abt e ctmmaiod iio RHEL - 7).
( i). # ygum reptlist (tt check EPEL reptlist).
(b). # cpgulimit -p <PID> -l 10 (tt see the CPU gusaie tf that prtcess aiod limit the
CPU gusaie tt
10%).
(c). # cpgulimit -e /Sgusr/Sltcal/Sbiio/Smyprti -l 20 (tt limit the CPU gusaie tf this ctmmaiod tt
20%).
27. How to capture the network trafc?
# tcpdump is the ctmmaiod tt captgure aiod aioalyse the ioetwtrk trafc. y gusiioi this ctmmaiod
we caio alst trtgubleshttt the ioetwtrk prtblems.
Examples :
# tcpdgump (tt captgure aiod aioalyse the ioetwtrk trafc).
# tcpdgump -i eth0 (tt captgure the ioetwtrk trafc frtm eth0 ctiotiogutgusly aiod
Ctrl + c tt exit).
# tcpdgump -c 30 -i eth0 (tt captgure the ioetwtrk trafc frtm eth0 guptt
30 packets tioly).
# tcpdgump -w /Srttt/Stcp.pcap -i eth0 (tt captgure the ioetwtrk trafc frtm eth0
aiod write that iio
/Srttt/Stcp.pcap fle).
# tcpdgump -t t t -r /Srttt/Stcp.pcap (tt read the ctioteiots tf the
abt e captgured fle).
# tcpdgump -i eth0 ptrt 22 (tt captgure the ioetwtrk trafc frtm
eth0 tf ssh trafc).
# tcpdgump -i eth0 dst 172.25.0.11 aiod ptrt 22 (tt captgure the ioetwtrk trafc frtm
172.25.0.11
system tf ssh trafc).
28. What is SAR utility and how to use it?
SAR staiods ftr System Act ity Reptrt. Usiioi SAR we caio check the iioftrmattio tf CPU
gusaie memtry swap I/SO disk I/SO ioetwtrkiioi aiod paiiioi. We caio iet the iioftrmattio
tf the preseiot statgus aiod ptst statgus (histtry gusiioi the data). guptt last 7 days becaguse
HISTORY=7 is there iio the ctiofigurattio fle. The lti messaies are sttred iio /var/log/sa/sa1,
/var/log/sa/sa2, /var/log/sa/sa3 ....etc. (where 1 2 3 ....etc. are dates).. The SAR
ctiofigurattio is sttred iio /etc/sysconfig/sysstat fle. Iio this fle the HISTORY=7 defagult
tpttio will be there. St we caio chaioie the defagult 7 days tt tgur reqguired algue.
eftre gusiioi the SAR gutlity frst we shtguld iiostall the SAR gutlity packaie by # yum install
sysstat* -y ctmmaiod.
Examples :
# sar 2 10 (It will ii e the system reptrt ftr e ery 2 sectiods
guptt 10 tmes).
# sar -p 2 10 (tt see the CPU gutlisattio ftr e ery 2 sectiods
guptt 10 tmes).
# sar -p ALL -f /S ar/Slti/Ssa/Ssa25 (tt check the CPU gutlisattio tio 25th day tf the
cgurreiot mtioth).
# sar -p ALL -f /S ar/Slti/Ssa/Ssa10 -s 07:00:00 -e 15:00:00 (tt check the CPU gutlisattio
tio 10th day tf the cgurreiot mtioth frtm 7:00 tt 15:00 hrs. where -s
meaios start tme -e eiod tme).
# sar -r 2 10 (tt see the memtry gutlisattio ftr e ery 2 sectiods
guptt 10 tmes).
# sar -r -f /S ar/Slti/Ssa/Ssa14 (tt check the memtry gutlisattio tio 14th day tf the
cgurreiot mtioth).
# sar -r -f /S ar/Slti/Ssa/Ssa10 -s 07:00:00 -e 15:00:00 (tt check the memtry gutlisattio
tio 10th day tf the cgurreiot mtioth frtm 7:00 tt 15:00 hrs. where -s
meaios start tme -e eiod tme).
# sar -S 2 10 (tt see the swap gutlisattio ftr e ery 2 sectiods
guptt 10 tmes).
# sar -S -f /S ar/Slti/Ssa/Ssa25 (tt check the swap gutlisattio tio 25th day tf the
cgurreiot mtioth).
# sar -S -f /S ar/Slti/Ssa/Ssa10 -s 07:00:00 -e 15:00:00 (tt check the swap gutlisattio tio
10th day tf the cgurreiot mtioth frtm 7:00 tt 15:00 hrs. where -s
meaios start tme -e eiod tme).
# sar -q 2 10 (tt see the ltad a eraie ftr e ery 2 sectiods
guptt 10 tmes).
# sar -q -f /S ar/Slti/Ssa/Ssa14 (tt check the ltad a eraie tio 14th day tf the
cgurreiot mtioth).
# sar -q -f /S ar/Slti/Ssa/Ssa10 -s 07:00:00 -e 15:00:00 (tt check the ltad a eraie tio
10th day tf the cgurreiot mtioth frtm 7:00 tt 15:00 hrs.
where -s meaios start tme -e eiod tme).
# sar - 2 10 (tt see the paiiioi iioftrmattio ftr e ery 2 sectiods
guptt 10 tmes).
# sar -d 2 10 (tt see the disk gusaie ftr e ery 2 sectiods
guptt 10 tmes).
# sar -m 2 10 (tt see the ptwer maioaiemeiot ftr e ery 2 sectiods
guptt 10 tmes).
# sar -b 2 10 (tt see the disk iiopgut aiod tgutpgut statstcs ftr e ery 2 sectiods
guptt 10 tmes).
29. What are the port no. for diferent services?
The Port no. list :
FTP (Ftr data traiosfer). 20 HTTP 80
FTP (Ftr ctioioecttio). 21 POP3 110
SSH 22 NTP 123
* Piioi is iott gused aioy ptrt iogumber. It is gused ICMBP (Iioterioet Ctiotrtl MBessaie Prtttctl).
tioly.
Other useful commands :
# guptme (tt see frtm htw ltioi the system is rguioioiioi aiod alst ii es the ltad a eraie
reptrt).
* The ltad a eraie is ha iioi 3 felds. 1 - preseiot statgus 2 - 5 miiogutes back aiod 3 - 15
miiogutes back.
# itstat 5 2 (tt mtioittr the iiopgut aiod tgutpgut statstcs ftr e ery 5 sectiods
guptt 10 tmes).
# ioprtc (tt check htw maioy prtcesstrs (CPUs). are
there iio the system).
# ttp 1 (tt see the iot. prtcesstrs (CPUs). are there
iio the system).
# iptraf (tt mtioittr the TCP tr ioetwtrk trafc statstcs iio
iraphical mtde).
* eftre gusiioi this ctmmaiod iiostall the iptraf packaie by # yum install iptraf* -y
ctmmaiod.
# ifraf -ioi -f eth0 (tt see the IP trafc statstcs iio
iraphical mtde).
# lscpgu (tt see the iot. tf CPUs preseiot iio
the system).
# lsgusb (tt see the iot. tf US de ices preseiot iio
the system).
# lsblk (tt see all the partttios tr bltck de ices
iioftrmattio).
# cat /Setc/Sredhat-release (tt see the RHEL
ersitio tf system).
# dmidectde (tt see the ctmplete hardware iioftrmattio
tf the system).
# Ctrl + s (tt
sttp the prtcess).
# bi % < Jtb ID > (tt restart the prtcess aiaiio
at backirtguiod).
* Wheio there are sttpped jtbs aiod waiot tt exit frtm the termiioal theio a warioiioi messaie
will be displayed. If we try aiaiio tt exit frtm the termiioal theio the sttpped tr
sguspeioded jtbs will be killed aguttmatcally.
1 What is FTP?
FTP staiods ftr File Traiosfer Prtttctl gused tt traiosfer fles frtm tioe htst tt aiotther htst t er
a TCP-based ioetwtrk.
2. How fp works?
FTP is bguilt tio clieiot-ser er architectgure aiod gutlises separate ctiotrtl aiod data ctioioecttio
betweeio the clieiot aiod ser er. FTP gusers may agutheiotcate themsel es gusiioi a clear-text
siiio-iio prtttctl bgut caio ctioioect aiotioymtgusly if the ser er is ctiofigured tt alltw it.
Usgually the FTP ser er which sttres fles tt be traiosferred guses twt ptrts ftr the traiosferriioi
pgurptse. Oioe ptrt ftr ctmmaiods aiod aiotther ptrt ftr seiodiioi aiod recei iioi data. Reqguestioi
frtm clieiot ctmpguters are recei ed at the ptrt 21 tf ser er. ie. it is exclgusi ely reser ed ftr
seiodiioi ctmmaiods thereftre it is called the Ctmmaiod Ptrt.
Oioce aio iioctmiioi reqguest is recei ed the data reqguested tr gupltaded by the clieiot ctmpguter is
traiosferred thrtguih a separate ptrt 22 aiod referred as Data Ptrt. At this ptiiot depeiodiioi tio
the Act e tr Passi e mtde tf the FTP ctioioecttio the ptrt iogumber gused ftr the Data Traiosfer
Varies.
3. What is Active FTP?
Iio Act e FTP ctioioecttio the ctioioecttio is iioitated by the Clieiot aiod the data ctioioecttio is
iioitated by the Ser er. Aiod as the ser er act ely establishes the data ctioioecttio with the
clieiot heioce it is called the Act e FTP. Here the clieiot tpeios gup a ptrt hiiher thaio 1024 aiod it
ctioioects tt the ser er thrtguih ptrt 21. Theio the ser er tpeios its ptrt 20 tt establish a data
ctioioecttio.
4. What is Passive FTP?
Iio Passi e FTP ctioioecttio btth ctmmaiod aiod data ctioioecttios are established by the clieiot.
Iio this the ser er acts as eiotrely passi e that's why it is called the Passi e FTP. Here the ser er
listeios ftr iioctmiioi reqguested ctioioecttios frtm clieiot thrtguih ptrt 21 aiod the clieiot alst
iioitates the data ctioioecttio at ptrt 20.
5. What is the main diference between the Active FTP and Passive FTP?
The maiio difeereioce betweeio the Act e FTP aiod the Passi e FTP is based tio wht iioitates the
data ctioioecttio betweeio the ser er aiod the clieiot. If the data ctioioecttio is iioitated by the
ser er that is called Act e FTP aiod if the data ctioioecttio is iioitated by the clieiot that is
called Passi e FTP.
6. What is the profile for FTP server?
(i). It is gused ftr gupltadiioi aiod dtwioltadiioi the fles aiod directtries caioiott be dtwioltaded.
(ii). The FTP ser er packaieis vsfpd.
(iii). The FTP clieiot packaies are fp aiod lfp.
(i ).The FTP ser er deamtio is vsfpd (Very Secgure FTP deamtio).
( ). The FTP scriptioi fle is /etc/initd/vsfpd
( i).Ptrt iogumbers 20 ftr data ctioioecttio aiod 21 ftr FTP ctmmaiod ctioioecttio.
( ii). The dtcgumeiot rttt ftr FTP is /var/fp
( iii). The FTP htme directtry is /var/fp
(ix). The FTP ctiofigurattio fles are
(a). /Setc/S sfpd/S sfpd.ctiof
(b). /Setc/S sfpd/Sguser_list
(c). /Setc/S sfpd/Sfpguser
(d). /Setc/Spam.d/S sfpd
7. How to configure the FTP server?
(i). Iiostall the FTP packaie by # yum install vsfpd* -y ctmmaiod.
(ii). Gttt FTP dtcgumeiot rttt directtry aiod create stme fles by # cd /var/fp/pub
# touch f(1..10}
(iii). Restart the FTP ser ice tr deamtio by # service vsfpd restart ctmmaiod iio RHEL - 6.
# systemctl restart vsfpd ctmmaiod iio RHEL - 7.
(i ). MBake the FTP ser ice tr deamtio eioable e eio afer rebttt the ser er by
# chkconfig vsfpd on ctmmaiod iio RHEL - 6 aiod # systemctl enable vsfpd ctmmaiod
iio RHEL - 7.
( ). Add the FTP ser ice tt the IP tables (RHEL - 6). aiod Firewalld (RHEL - 7)..
RHEL - 6 :
# iptables -A INPUT -m state --state NEW -m tcp -p tcp --deport 21 -j ACCEPT
# iptables -A OUTPUT -m state --state NEW -m tcp -p tcp --deport 21 -j
ACCEPT
rajgu
jguioiogu (sa e aiod exit the fle).
(iii). Restart the fp deamtio by # service vsfpd restart ctmmaiod iio RHEL - 6 tr
# systemctl restart vsfpd ctmmaiod iio RHEL - 7.
14. What is LFTP and how to configure LFTP?
LFTP is alst gused tt gupltad tr dtwioltad the fles. gut by gusiioi LFTP we caio ltiiio tt the FTP
ser er withtgut passwtrd becaguse It will iott ask aioy passwtrds. Tt guse LFTP we ha e tt iiostall
the LFTP packaie tio ser er.
(i). Iiostall the LFTP packaie by # yum install lfp* -y ctmmaiod.
(ii). Restart the lfp deamtio by # service lfpd restart ctmmaiod iio RHEL - 6 tr
# systemctl restart lfpd ctmmaiod iio RHEL - 7.
(iii). Gt tt clieiot system aiod access the LFTP ser er by
# lfp 172.25.9.11 (tt ctioioect the LFTP ser er).
lfp> cd pgub (tt mt e tt the pgub directtry).
lfp> iet f1 (tt dtwioltad the f1 fle).
lfp> miet f2 f3 f4 f5 (tt dtwioltad the f2 f3 f4 aiod f5 mgultple fles at a tme).
lfp> pgut f9 (tt gupltad the f9 fle).
lfp> mpgut f10 f11 f12 (tt gupltad the f10 f11 f12 mgultple fles at a tme).
lfp> qguit (tt qguit the fp ser er).
* Iio LFTP " Tab " key wtrks as gusgual bgut iio FTP " Tab " will iott wtrk.
15. How to allow the root user to access the FTP server?
y defagult rttt guser is bltcked tt access the FTP ser er. Tt alltw the rttt guser tt access the
FTP ser er ftlltw the beltw steps.
(i). Opeio the /etc/vsfpd/user_list fle by # vim /etc/vsfpd/user_list ctmmaiod.
(ii). Gt tt rttt guser liioe aiod ctmmeiot tio that liioe. Ftr example # root (sa e aiod
exit the fle).
(iii). Opeio the /etc/vsfpd/fpuser fle by # vim /etc/vsfpd/fpuser ctmmaiod.
(i ). Gt tt rttt guser liioe aiod ctmmeiot tio that liioe. Ftr example # root (sa e aiod
exit the fle).
( ). Restart the fp deamtio by # service vsfpd restart ctmmaiod iio RHEL - 6 tr
# systemctl restart vsfpd ctmmaiod iio RHEL - 7.
* E eio thtguih we chaioied the abt e the rttt guser caioiott access the FTP ser er becaguse
the htme directtry ctiotext is iott added. we caio stl e this as ftlltws.
( i). # getsebool -a | grep fp (tt check the SELiiogux ttleaio tf the rttt
htme directtry).
( ii). # setsebool -p fp_home_dir on (tt chaioie the ttleaio tf the rttt
htme directtry).
* Ntw it tt clieiot system aiod try tt ltiiio the FTP ser er as rttt guser. Here we caio access the
FTP ser er.
16. What are the diference between FTP and LFTP servers?
(i).The guser ioame aiod passwtrd are reqguired tt access the FTP ser er bgut LFTP dtes iott
reqguires passwtrds.
(ii). Iio fp>prtmpt the " Tab " key will iott wtrk bgut iio lfp> prtmpt the " Tab " key will
wtrk as gusgual.
Other useful FTP Commands :
# fp 172.25.9.11 (tt access the FTP ser er prt ide FTP guser ioame
aiod passwtrd).
fp > ls (tt see all the fles aiod directtries iio FTP
rttt directtry).
fp > !ls (tt see the ltcal iotthiioi preseiot wtrkiioi
directtry fles).
fp > pwd (tt see the FTP preseiot wtrkiioi directtry).
fp > !pwd (tt see the ltcal fle system's preseiot
wtrkiioi directtry).
fp > iet <fle ioame> (tt dtwioltad the specifed fle).
fp > miet <fle 1><fle 2><fle3> (tt dtwioltad mgultple fles at a tme).
fp > cd /S ar/Sfp/Spgub/Sgupltad (tt mt e tt gupltad directtry).
fp > pgut <fle ioame> (tt gupltad the specifed fle iiott the FTP
gupltad directtry).
fp > lcd /Srttt/SDtwioltads (tt chaioie tt the ltcal /Srttt/SDtwioltad
directtry).
fp > help (tt iet the help abtgut FTP ctmmaiods).
fp > bye tr qguit (tt qguit tr exit frtm the FTP ser er).
# lfp 172.25.9.11 (tt access the LFTP ser er withtgut askiioi
aioy passwtrds).
(i). NFS dtes iott sgupptrt crtss plat ftrms. ie. it will iott sgupptrt the shariioi the fles betweeio
Liiogux aiod Wiiodtws systems.
(ii). NFS dtes iott sgupptrt eiocrypttio tf the data aiod it sgupptrts tioly plaiio text ftrmat.
(iii). NFS dtes iott sgupptrt TCP Wrappers ie. NFS dtes iott sgupptrt /etc/hosts.allow and
/etc/hosts.deny becaguse there is iot libwrap.so mtdgule is iott ltaded with NFS ser ice.
(i ). NFS dtes iott sgupptrt agutheiotcattio. St tt t erctme this prtblem kerberts secgurity
system is gused.
3. What is the profile of NFS?
Packaie : iofs*
Ser ices : iofs (iio RHEL - 6).
iofs-ser er iofs-secgure-ser er (iofs with kerberts). (btth ftr
NFS ser er).
iofs-secgure (ftr NFS clieiot). (these three ser ices are iio
RHEL - 7).
Script : /Setc/Siioit.d/Siofs
Ptrt iogumbers : 2049 (ftr NFS ser er). aiod beltw 1024 (ftr NFS clieiot).
Ctiofigurattio Files : /Setc/Sexptrts aiod /Setc/Ssysctiofi/Siofs
Other Imptrtaiot Files : /S ar/Slib/Siofs/Setab aiod /S ar/Slib/Siofs/Srmtab
Versitios : NFS - 3 (defagult iio RHEL - 5). bgut it sgupptrts NFS - 4
NFS - 4 (defagult iio RHEL - 6). bgut It alst sgupptrts NFS - 3
NFS - 4 (defagult iio RHEL - 7). bgut it alst sgupptrts NFS - 3
Prtttctl : gudp prtttctl
4. What are the background deamons for NFS and explain them?
There are 6 backirtguiod deamtios ftr NFS.
(i). rpc . mountd :
This deamtio is resptiosible ftr execgutioi mtguiot aiod guiomtguiot reqguests by the clieiot.
(ii). rpc . nfsd :
This deamtio resptiods tt clieiots reqguests ftr fle access.
(iii). rpc . rquotad :
This deamtio is resptiosible ftr eioabliioi qguttas tio NFS shared de ices.
(i ). rpc . statd :
This deamtio is gused tt see the statstcs abtgut NFS ser er frtm NFS clieiot wheio
execgutioi the ctmmaiods # netstat or # nfsstat (tt see the I/SO statstcs tf NFS).
( ). rpc . lockd :
This deamtio maioaies fle ltcks aiod releases iiocase tf clieiot disctioioected.
( i). rpc . idmapd :
This deamtio is resptiosible ftr mappiioi guser id aiod irtgup id ttwards themsel es.
5. What are the diference between NFS 3 and NFS 4?
Iio NFS 3 there is iot secgurity tt prttect the data bgut iio NFS 4 there is a kerberts secgurity tt
prttect the data.
Iio NFS 3 there is iot ACL permissitios tio the shared directtry bgut iio NFS 4 there is aio ACL
permissitios tio the shared directtry.
6. In how many ways we can mount the NFS shared directory?
Iio trder tt access the NFS shared data we ha e tt mtguiot that shared directtry tio ltcal mtguiot
ptiiot. The mtguiotioi caio be direct mtguiot (maiogual mtguiot). aiod iiodirect mtguiot (agutt mtguiot)..
Direct mount :
First create the ltcal mtguiot ptiiot aiod theio mtguiot that shared NFS directtry tio tgur ltcal
systems mtguiot ptiiot by # mount <server host name or IP address> : <shared directory
with full path><mount point> ctmmaiod. gut this is temptrary mtguiot aiod we caio mtguiot it
permaioeiotly by pgut aio eiotry iio /etc/fstab fle.
Example :
# mtguiot 172.25.9.11:/Sprtdguct /Smiot/Siofs (tt mtguiot the directtry /Sprtdguct tio /Siofs
mtguiot ptiiot temptrarily).
# im /Setc/Sfstab (tpeio this fle aiod pgut aio eiotry tf mtguiot ptiiot tt
mtguiot permaioeiotly).
172.25.9.11:/Sprtdguct /Smiot/Siofs iofs defagults 0 0 (sa e aiod
exit this fle).
Indirect mount :
This methtd is gused tt mtguiot the NFS share by gusiioi the Aguttfs ser ice. Aguttfs guses the
aguttmtguiot daemtio tt maioaie tgur mtguiot ptiiots by tioly mtguiotioi them dyioamically wheio
they are accessed.
Aguttfs ctiosgults the master map ctiofigurattio fle /etc/auto.master tt determiioe which mtguiot
ptiiots are defioed. It theio starts aio aguttmtguiot prtcess with the apprtpriate parameters ftr
each mtguiot ptiiot. Each liioe iio the master map defioes a mtguiot ptiiot aiod a separate map fle that
defioes the fle systems tt be mtguioted guioder this mtguiot ptiiot. Ftr example
the /etc/auto.misc fle miiht defioe mtguiot ptiiots iio the /mnt directtry this relattioship
wtguld be defioed iio the /etc/auto.master fle.
Each eiotry iio auto.master has three felds. The frst feld is the mtguiot ptiiot. The sectiod feld is
the ltcattio tf the map fle aiod the third feld is tpttioal. The third feld caio ctiotaiio iioftrmattio
sguch as a tmetgut algue.
Ftr example tt mtguiot the directtry /product tio the remtte machiioe server9.example.com at
the mtguiot ptiiot /mnt/nfs tio ytgur machiioe add the ftlltwiioi liioe tt auto.master:
/mnt /etc/auto.misc --timeout 60
Next add the ftlltwiioi liioe tt /etc/auto.misc:
nfs -rw server9.example.com:/product
The frst feld iio /etc/auto.misc is the ioame tf the /mnt sgubdirecttry. This sgubdirecttry is
created dyioamically by aguttmtguiot. It shtguld iott actgually exist tio the clieiot machiioe. The sectiod
feld ctiotaiios mtguiot tpttios sguch asrw ftr read aiod write access. The third feld is the ltcattio
tf the NFS exptrt iioclgudiioi the htstioame aiod directtry.
The directtry /Smiot mgust be exits tio the ltcal fle system. There shtguld be iot sgub directtries tio
the ltcal fle system.
Tt start the aguttfs ser ice at a shell prtmpt type the ftlltwiioi ctmmaiod:
# servive autofs restart
Tt iew the act e mtguiot ptiiots type the ftlltwiioi ctmmaiod at a shell prtmpt:
# service autofs status
If ytgu mtdify the /etc/auto.master ctiofigurattio fle while aguttfs is rguioioiioi ytgu mgust tell the
aguttmtguiot daemtio(s). tt reltad by typiioi the ftlltwiioi ctmmaiod at a shell prtmpt:
# service autofs reload
7. How to configure NFS server?
(i). First iiostall the NFS packaie by # yum install nfs* -y ctmmaiod.
(ii). Create the NFS shared directtry tio ser er system by # mkdir /public ctmmaiod.
(iii). MBtdify the permissitios tf the /Spgublic directtry by # chmod 777 /public ctmmaiod.
(These permissitios may
be chaioied depeiod tio it's reqguiremeiot).
(i ). MBtdify the SELiiogux ctiotext tf the /Spgublic directtry if SELiiogux is eioabled by execgutioi the
beltw ctmmaiod. # chcon -t public_content_t /public
( ). create stme fles iio the /Spgublic directtry by # touch f{1..10} ctmmaiod.
( i). Opeio the fle NFS ctiofigurattio fle aiod pgut aio eiotry tf the NFS shared iioftrmattio by #
vim /etc/exports ctmmaiod aiod type as aio eiotry like <shared directory name> <to whom
to export the shared directory> (<permissions>, sync)
Ftr example
# im /Setc/Sexptrts
/Spgublic *.example.ctm (rt/Srw syioc). (sa e
aiod exit the fle).
* Where *.example.ctm meaios the shared directtry caio be exptrted tt all the systems
tf the example.ctm dtmaiio.
* Permissitios like rt (read tioly). tr rw (read & write). aiod syioc meaios the data will
always be syioced.
/Spgublic deskttp9.example.ctm (rw syioc). (tt exptrt the /Spgublic tt deskttp 5
system tioly).
/Spgublic *.example.ctm (rt syioc). (exptrt tt the eiotre example.ctm
dtmaiio with read tioly).
/Spgublic 172.25.0.0/S24 (rw syioc). (exptrt tt 172.25.0.0 ioetwtrk tioly with
read aiod write).
/Spgublic ser er [ 0 - 20 ].example.ctm (rw syioc). (exptrt tt ser er0 tt
ser er20 iio
example.ctm dtmaiio with read aiod write).
rw read/Swrite permissitios
rt read-tioly permissitios
iiosecgure Alltws the guse tf ptrts t er 1024
Specifes that all chaioies mgust be writteio tt disk beftre a
syioc
ctmmaiod ctmpletes
iot_wdelay Ftrces the writioi tf chaioies immediately
rttt_sqguash Pre eiots rttt gusers
( ii). Exptrt the abt e shared directtry tt the defioed clieiot systems by # exportfs -rv
ctmmaiod.
( iii). Restart the NFS ser ices by ftlltwiioi the ctmmaiods iio RHEL - 6 aiod RHEL - 7.
# service rpcbind restart (tt restart the rpcbiiod
ser ice iio RHEL - 6).
# service nfs restart (tt restart the NFS
ser ice iio RHEL - 6).
# systemctl restart nfs-server (tt restart the NFS ser ice iio
RHEL - 7).
(ix). MBake the NFS ser ice permaioeiotly bttt at ioext bttt tme tiowards as ftlltws.
# chkconfig rpcbind on (tt tio the rpcbiiod
ser ice iio RHEL - 6).
# chkconfig nfs on (tt tio the iofs
ser ice iio RHEL - 6).
# systemctl enable nfs-server (tt eioable the iofs-
ser er iio RHEL - 7).
(x). Exptrt the NFS shared directtry as ftlltws.
# exportfs -rv
(xi). Eioable the NFS ser ice tt the IP tables aiod Firewall iio RHEL - 6 aiod RHEL - 7 as ftlltws.
In RHEL - 6 :
(i). # setgup
(a). Select Firewall Ctiofigurattio.
(b). Select Cgusttmise ( MBake sgure frewall tpttio remaiio selected )..
(c). Select NFS4 ( by pressiioi spacebar tioce )..
(d). Select Ftrward aiod press Eioter.
(e). Select eth0 aiod Select Cltse bgutttio aiod press Eioter.
(f). Select tk aiod press Eioter.
In RHEL - 7 :
# frewall-cmd --permaioeiot -add-ser ice=iofs (tt eioable the iofs ser ice
at frewall).
# frewall-cmd --permaioeiot -add-ser ice=mtguiotd (tt eioable the mtguiotd
ser ice at frewall).
# frewall-cmd --permaioeiot -add-ser ice=rpc-biiod (tt eioable the rpc-biiod
ser ice at frewall).
# frewall-cmd --ctmplete-reltad (tt reltad the frewall).
8. What are requirements for NFS client?
(i). NFS ser er IP address tr htstioame.
(ii). Check the NFS shared ioame.
(iii). Create the ltcal mtguiot ptiiot.
(i ). MBtguiot the NFS shared ioame tio the ltcal mtguiot ptiiot.
( ). Gt tt mtguiot ptiiot (ltcal mtguiot ptiiot). aiod access the NFS shared data.
9. How to access the NFS shared directory from the client?
(i). Oio Clieiot system iiostall the nfs-utils packaie by # yum install nfs-utils* -y
ctmmaiod.
(ii). Check the exptrted NFS shared directtry by # showmount -e <IP address or
hostname of the server>
Example : # shtwmtguiot -e 172.25.9.11 tr # shtwmtguiot -e ser er9.example.ctm
(iii).Create tioe mtguiot ptiiot tt mtguiot the NFS shared directtry by # mkdir /<mount point>
ctmmaiod.
Example : # mkdir /Smiot/Siofs
(i ). MBtguiot the NFS shared directtry tio the abt e created mtguiot ptiiot.
# mount <IP address or server hostname> : <NFS shared directory><mount point>
Example : # mtguiot 172.25.9.11:/Spgublic /Smiot/Siofs tr
# mtguiot ser er9.example.ctm:/Spgublic /Smiot/Siofs
* These are temptrary mtguiot tioly. ie. If the system is rebttted these are guiomtguioted
aguttmatcally aiod we ha e tt mtguiot aiaiio afer the system is rebttted.
( ). St if we waiot tt mtguiot it permaioeiotly theio tpeio /etc/fstab fle aiod pgut aio eiotry tf the
mtguiot ptiiot.
# vim /etc/fstab (tt tpeio the fle).
<IP address or server hostname> : <shared name><mount point><file system> defaults
0 0
Example : 172.25.9.11:/Spgublic /Smiot/Siofs iofs defagults 0 0 ( tr ).
ser er9.example.ctm:/Spgublic /Smiot/Siofs iofs defagults 0 0 (sa e
aiod exit the fle).
( i). MBtguiot all the mtguiot ptiiots as meiottioed iio the abt e /Setc/Sfstab fle by # mount -a
ctmmaiod.
( ii). # df -hT ctmmaiod is gused tt check all the mtguioted partttios with fle system types.
10. Why root user cannot create the files in the NFS shared directory and how to make him to
create the files?
The rttt guser iotrmally has all the permissitios bgut iio NFS rttt guser is alst bectmes as a
iotrmal guser. St the rttt guser ha iioi iot permissitios tt create the fles tio the NFS shared
directtry.
The rttt guser bectmes as nfsnobodyguser aiod irtgup alst nfsnobody dgue tt root_squash
permissitio is there by defagult. St if we waiot tt make the rttt guser tt create fle tio the NFS
shared directtry theio it tt ser er side aiod tpeio the /etc/exports fle aiod type as beltw
<shared name> <domain name or systems names>(permissions, sync, no_root_squash)
Example : /public *.example.com(rw, sync, no_root_squash) (sa e
aiod exit the fle).
# exptrts -r (tt exptrt the shared directtry).
# ser ice iofs restart (tt restart the NFS ser ice iio RHEL - 6).
# systemctl restart iofs-ser er (tt restart the NFS ser ice iio RHEL - 7).
11. What are the disadvantages of the direct or manual mounting?
(i). MBaiogual mtguiotioi meaios we ha e tt mtguiot maiogually st it creates st maioy prtblems. Ftr
example if NFS ser ice is iott a ailable theio # df -hT ctmmaiod will haioi.
(ii). If the NFS ser er is dtwio while btttioi the clieiot the clieiot will iott bttt becaguse it
searches ftr NFS mtguiot ptiiot as aio eiotry iio /etc/fstab fle.
(iii). Aiotther disad aiotaie tf maiogual mtguiotioi is it ctiosgumes mtre memtry aiod CPU
restgurces tio the clieiot system.
St tt t erctme the abt e prtblems iotrmally iiodirect tr aguttmtguiot is gused gusiioi Aguttfs
tttl.
12. What is secure NFS server and explain it?
Secgure NFS ser er meaios NFS server with Kerberos security. It is gused tt prttect the NFS
exptrts. Kerbebtrs is a agutheiotcattio tttl tt prttect the NFS ser er shares. It guses the krb5p
methtd tt prttect by agutheiotcattio mechaioism aiod eiocrypt the data while ctmmguioicattio.
Ftr this tioe key fle is reqguired aiod this shtguld be sttred iio each aiod e ery clieiot which are
accessiioi the iofs secgure directtry. Theio tioly Kerberts secgurity will be a ailable. This key fle
shtguld be sttred iio /Setc/Skrb5.keytab fle. Ftr example the ftlltwiioi ctmmaiod will dtwioltad
aiod sttre the keytab.
# wiet http:/S/Sclassrttm.example.ctm/Spgub/Skeytabs/Sser er9.keytab -O /Setc/Skrb5.keytab
(where O is capital).
13. How to configure the secure NFS server?
(i). Iiostall the NFS packaie.
# yum install nfs* -y
(ii). Create a directtry tt share thrtguih NFS ser er.
# mkdir /securenfs
(iii).MBtdify the permissitios tf shared directtry.
# chmod 777 /securenfs
(i ).Chaioie the SELiiogux ctiotext tf the directtry if the SELiiogux is eioabled.
# chcon -t public_content_t /securenfs
( ). Opeio the NFS ctiofigurattio fle aiod pgut aio eiotry tf the shared directtry.
# vim /etc/exports
/Ssecgureiofs *.example.ctm(rw sec=krb5p). (sa e
aiod exit the fle).
( i).Dtwioltad the keytab aiod sttre it iio /etc/krb5.keytb fle.
# wget htp://classroom.example.com/pub/keytabs/server9.keytab -O
/etc/krb5.keytab
( ii).Exptrt the shared the directtry.
# exportfs -rv
( iii). Restart aiod eioable the NFS ser ices iio RHEL - 6 aiod RHEL - 7.
# service nfs restart (restart the NFS
ser ice iio RHEL - 6).
# service nfs-secure-server restart (restart the secgure NFS ser ice iio
RHEL - 6).
16. How to add the LDAP user shared directory and how the LDAP user access that directory on
client?
(i). Create a sgub-directtry iio /Ssecgureiofs directtry.
# mkdir /securenfs/secure
(ii). Chaioie the twioership tf the abt e sgub directtry tt LDAP guser.
# chown ldapuser9 /securenfs/secure
(iii). Assiiio the fgull permissitios tio that directtry tt LDAP guser.
# setfacl -m u : ldapuser9 : rwx /securenfs/secure
( ). Users dt iott ioeed tt ha e rttt pri ileiestt mtguiot tr guiomtguiot the mtguiot ptiiot.
( i). We caio redguce the CPU aiod memtry gutlisattios becaguse aguttfs will iott mtguiot
permaioeiotly.
( ii). We caio alst redguce hard disk gutlisattio becaguse permaioeiot mtguiot ptiiots tccgupies the
hard disk space.
22. What are the minimum requirements for Autofs?
(i). autofs packaie.
(ii). autofs deamtio.
(iii). Oioe shared directtry.
(i ). Oioe mtguiot ptiiot.
( ). Twt ctiofigurattio fles are
(a). /Setc/Sagutt.master
(b). /Setc/Sagutt.misc
23. How to configure Autofs?
(i). Iiostall the aguttfs packaie by # yum install autofs* -y ctmmaiod.
(ii). Opeio /etc/auto.master fle by # vim /etc/auto.master aiod at last type as beltw.
< Client's local mount point> /etc/auto.misc --timeout=60
Example :
/mnt /etc/auto.misc (sa e aiod
exit this fle).
( * Where tmetgut=60 meaios if the directtry is iott gused ftr 60 sectiods theio the shared
directtry is guiomtguioted aguttmatcally. Aiod the defagult is 5 miiogutes.).
(iii). Opeio /etc/auto.misc fle by # vim /etc/auto.misc aiod types as beltw.
< Client temporary mount point >-<permissions><IP address or hostname of the server> :
<shared
name>
Example :
nfs -ro (tr). -rw classroom.example.com:/public (sa e aiod
exit this fle).
( * where -rt meaios read-tioly aiod -rw meaios read-write).
(i ). Restart the aguttfs ser ice iio RHEL -6 aiod RHEL - 7.
# service autofs restart (restart the aguttfs ser ice
iio RHEL - 6).
# chkconfig autofs on (eioable the aguttfs ser ice at ioext bttt
iio RHEL - 6).
# systemctl restart autofs (restart the aguttfs ser ice
iio RHEL - 7).
# systemctl enable autofs (eioable the aguttfs ser ice at ioext bttt
iio RHEL - 7).
(i ). Gttt the Clieiot ltcal mtguiot ptiiot which is eiotered iio /et/auto.master fle by # cd
<mount point> ctmmaiod.
Example :
# cd /Smiot
( ). Gttt the Clieiot temptrary mtguiot ptiiot which is eiotered iio /etc/auto.misc fle as beltw.
# cd /mnt/<temporary mount point>
Example :
# cd iofs
# pwd (the tgutpgut
is /Smiot/Siofs).
24. What is LDAP server?
LDAP (Liihtweiiht Directtry Access Prtttctl). is a stfware prtttctl ftr eioabliioi aioytioe tt
ltcate triaioisattios iiodi idguals aiod tther restgurces sguch as fles aiod de ices iio a ioetwtrk
whether tio the pgublic Iioterioet tr tio a ctrptrate iiotraioet.LDAP is liihter becaguse iio its iioital
ersitio it did iott iioclgude secgurity featgures.
25. What is LDAP client?
LDAP Clieiot is a ioetwtrk guser creattio aiod act ity. LDAP guser meaios ioetwtrk guser. Netwtrk
guser meaios ltiiio the guser thrtguih ioetwtrk. If a guser waiots tt ltiiio tt the remtte system the
LDAP guser shtguld be created aiod ltiiio tt the remtte system thrtguih LDAP acctguiot.
Uptt RHEL -5 ftr this NIS (Netwtrk Iioftrmattio System). is gused. Frtm RHEL - 6 tiowards
LDAP is gusiioi. The maiio featgure tf the LDAP is tt share the gusers iioftrmattio iio ioetwtrk.
26. What are the requirements of LDAP and explain it?
(i). Packaies.
(a). aguthctiofi-itk (tt ctiofigure the LDAP clieiot).
(b). sssd (system secgurity ser ice deamtio).
(ii). LDAP clieiot ctiofigurattio fle is /etc/ldap.conf
(iii). LDAP kerberts ctiofigurattio fle is /etc/krb5.conf
(i ). sssd (systems secgurity ser ice deamtio). deamtio.
( ). LDAP ptrt iot. is 389.
( i). sssd deamtio resptiosibility is retrie iioi aiod cachiioi the agutheiotcattio iioftrmattio.
( ii). The ctiofigurattio fle tf sssd is /etc/sssd/sssd.conf
( iii). Thrtguih NIS the data is traiosferred iio plaiio text ftrmat. St there is iot secgurity. gut LDAP
will traiosfer the data iio eiocrypted ftrmat. St the data will be iio secgured way.
(ix). LDAP is gused by defagult sssd ie. kerberts.
27. What are the requirements for LDAP client?
(i). dc (dtmaiio ctiotrtller).
Example : If the dtmaiio is example.ctm theio dc=example dc=ctm
(ii). ldap server
Example : ldap:/S/Sclassrttm.example.ctm
(iii). Opeio the /Setc/Sagutt.misc fle by # vim /etc/auto.misc ctmmaiod aiod type as beltw.
ldapuesr9 -rw classrrom.example.com:/home/guests/ldapuser9 (sa e aiod
exit this fle).
(i ).Restart the aguttfs ser ices.
# service autofs restart (restart the aguttfs ser ice iio RHEL
- 6).
# chkconfig autofs on (eioable the aguttfs ser ice at ioext
bttt iio RHEL - 6).
# systemctl restart autofs (restart the aguttfs ser ice iio RHEL
- 7).
# systemctl enable autofs (eioable the aguttfs ser ice at ioext
bttt iio RHEL - 7).
(ii). Pgut aio eiotry tf the mtguiot ptiiot details iio /Setc/Sfstab fle.
# vim /etc/fstab
/S/S<samba ser er htst ioame tr IP address>/S<shared directtry ioame><mtguiot ptiiot> cifs
defagults guserioame=<samba guser ioame>
passwtrd=<guser's samba passwtrd> 0 0
Example : /S/Sser er9.example.ctm/Ssamba /Smiot/Ssamba cifs defagults guserioame=rajgu
passwtrd=<samba passwtrd> 0
0 (sa e aiod exit this fle).
(iii). MBtguiot all the mtguiot ptiiots which are ha iioi eiotries iio /Setc/Sfstab fle.
# mount -a
(i ). Check all the mtguiot ptiiots by # df -hT ctmmaiod.
8. How to mount the samba shared directory using credential file?
(i). Create tioe fle aiod pgut aio eiotries tf the guser ioame aiod passwtrd details.
# vim /root/smbuser
guserioame=rajgu
passwtrd=<guser's samba passwtrd> (sa e
aiod exit the fle).
(ii). Opeio /Setc/Sfstab fle aiod pgut aio eiotries tf the abt e credeiotal details tf guser.
# vim /etc/fstab
/S/Sser er9.example.ctm/Ssamba /Smiot/Ssamba cifs credeiotals=/Srttt/Ssmbguser
mgultguser sec=iotlmssp
0 0
(sa e aiod exit this fle).
9. How to access the samba share directory if it already mounted?
(i). Gt tt Clieiot system aiod switch tt samba guser.
# su - raju
$ cd /mnt/samba
$ ls (permissitio deioied messaie will be
displayed).
$ cifscreds add <host name or IP address of the samba server>(tt add cifs credeiotals
tt the ser er).
$ ls (tt see the ctioteiots tf the samba
shared directtry).
10. How to access the samba server from windows system?
(i). Gttt Wiiodtws system click tio START bgutttio click tio Rguio aiod type as
\\172.25.9.11\samba ctmmaiod.
(ii). Theio prt ide samba guser ioame aiod passwtrd if it prtmpts gus.
(iii). Theio see the ctioteiots tf the samba shared directtry.
Other useful commands :
* MBake a ctmmeiot tio liioe iogumbers 21 22 aiod 23. Theio it tt liioe iogumber 24 aiod type
as beltw.
server <ntp server host name> (sa e aiod
exit this fle).
Example : ser er classrttm.example.ctm
(iii).Restart the iotpd ser ice by # service ntpd restart ctmmaiod.
(i ). Eioable the iotp ser ice at ioext bttt by # chkconfig ntpd on ctmmaiod.
( ). Check whether the NTP is ctiofigured tr iott by # ntpq -p ctmmaiod.
Chrony :
(i). Chrtioy packaie is iott iiostalled becaguse by defagult it is iiostalled. If it iott iiostalled theio
iiostall the packaie by # yum install chrony* -y ctmmaiod.
(ii). Opeio the chrtioy ctiofigurattio fle by # vim /etc/chrony.conf ctmmaiod.
* MBake a ctmmeiot tio liioe iogumbers 3 4 aiod 5. Theio it tt liioe iogumber 6 aiod type as
beltw.
server <ntp server host name> iburst (sa e aiod
exit this fle).
Example : ser er classrttm.example.ctm ibgurst
(iii).Restart the chrtioy ser ice by # systemctl restart chronyd ctmmaiod.
(i ). Eioable the chrtioy ser ice at ioext bttt by # systemctl enable chronyd ctmmaiod.
( ). Check whether the Chrtioy is ctiofigured tr iott by # chronyc sources -v ctmmaiod.
# timedatectl (tt check whether the clieiot's tme is syiochrtioised tt the
ser er's tme).
# timedatectl list-timezones (tt list the difeereiot tme stioes).
# timedatectl set-time <hh : mm : ss> (tt set the tme).
# timedatectl set-timezone Asia/Kolkata (tt set the tme stioe iio RHEL - 7).
# tzselect Asia/Kolkata (tt set the tme stioe iio RHEL - 6).
18. DNS (Domain Naming System)
1. What is DNS?
DNS staiods ftr Dtmaiio Namiioi System. The DNStraioslates Iioterioet dtmaiio aiod htst ioames
tt IP addresses. DNS aguttmatcally ctio erts the ioames we type iio tgur Web brtwser address
bar tt the IP addresses tf Web ser ers htstioi thtse sites.
DNS implemeiots a distribguted database tt sttre this ioame aiod address iioftrmattio ftr all
pgublic htsts tio the Iioterioet. DNS assgumes IP addresses dt iott chaioie (are statcally assiiioed
rather thaio dyioamically assiiioed)..
2. What is DNS server and how it works?
Iio aioy ioetwtrk the htsts primarily ctmmguioicate betweeio each tther thrtguih IP addresses. Ftr
example if my ctmpguter is dtiioi a ittile search my ctmpguter is actgually ctmmguioicatioi with the
IP address tf tioe tf the web ser ers tf ittile.ctm. Htwe er e eio if the ctmpguter is
efcieiot with iogumbers hgumaios tio the tther haiod wtrk better with ioames. Ftr this reastio the
TCP/SIP prtttctl iioclgudes the Domain Name System (DNS) tt liiok betweeio IPs aiod ctmpguter
ioames i.e. htstioames. The DNS is a distribguted database tf ctmpguters that is resptiosible ftr
restl iioi htstioames aiaiiost IP addresses aiod ice- ersa.
Aioy DNS qguery iio tl es twt parts.
(i). The Resolver: The restl er ftrms gup tr iioitates the qguery. The restl er itself dtes iott rguio as
a prtiram. /etc/resolve.conf is aio example tf a restl er.
(ii). Name Server: The Name Ser er is the ser ice rguioioiioi iio the ser er that resptiods tt the DNS
qguery ieioerated by the restl er i.e. aioswers tt the qguesttio tf the
restl er.
The working DNS :
(i). The clieiot iioitates a qguery tt fiod a dtmaiio example.ctm. The clieiot seiods the qguery tt the
DNS ser er tf the ISP. (The DNS Ser er IP iio the clieiot ctmpguter is set as the IP address tf
the DNS Ser er tf the ISP).
(ii). The DNS Ser er tf the ISP frst checks it's twio cache tt check whether it already kiotws the
aioswer. gut as the aioswer is iott preseiot it ieioerates aiotther qguery. As the Top Level
Domain tf example.ctm is .com st the DNS ser er qgueries the Internet Registration
Authority tt fiod wht is resptiosible ftr example.ctm.
(iii).The Iioterioet Reiistrattio Aguthtrity resptiods tt the ISP by aiosweriioi the qguery.
(i ). Oioce the ISP DNS Ser er kiotws the aguthtritat e ioame ser ers it ctiotacts the aguthtritat e
ioame ser ers tt fiod tgut the IP address ftr www.example.ctm i.e. the IP address tf
htst www iio the domain example.ctm. ( ). example.com resptiods tt the ISP DNS Ser er by
aiosweriioi the qguery aiod prt idiioi the IP address tf the web ser er i.e. www
( i). The ISP DNS Ser er sttres the aioswer iio it's cache ftr fgutgure guse aiod aioswers tt the clieiot
by seiodiioi the IP address tf the www ser er.
( ii). The clieiot may sttre the aioswer tt the DNS qguery iio it's twio cache ftr fgutgure guse. Theio the
clieiot ctmmguioicates directly with the www ser er tf dtmaiio example.com gusiioi
the IP address.
( iii). The www ser er resptiods by seiodiioi the iiodex.html paie.
3. What is the format of the domain name?
Like a physical address iioterioet dtmaiio ioames are hierarchical way. If the Fgully Qgualifed
Dtmaiio Name is www.google.co.in the www is the Htstioame google is the Dtmaiio co
is the Sectiod Le el Dtmaiio aiod in is the Ttp Le el Dtmaiio.
4. What are the files we have to edit to configure the DNS?
There are ftgur fles tt edit tt ctiofigure the DNS. They are /etc/named.conf,
/etc/named.rfc1912.zones, Forward Lookup Zoneaiod Reverse Lookup Zone. DNS prt ides a
ceiotralised database ftr restlguttio. Ztioe
is sttraie databasewhich ctiotaiios all the rectrds.
Forward Lookup Zone is gused tt restl eHostnames tt IP addresses.
Reverse Lookup Zone is gused tt restl e IP addresses tt Hostnames.
5. What are the DNS record and explain them?
# vim /etc/hosts (tpeio this fle aiod it tt last liioe aiod type as beltw iio
RHEL - 6 tioly).
<IP address> <fully qualified domain name> <hostname>
172.25.9.11 ser er9.example.ctm ser er9 (ftr example tf the abt e
syiotax).
# vim /etc/sysconfig/network (tpeio this fle aiod it tt last liioe aiod type as beltw iio
RHEL - 6 tioly).
HOSTNAME=<fully qualified domain name>
HOSTNAMBE=ser er9.example.ctm (ftr example tf the abt e
syiotax).
(ii). Opeio the DNS maiio ctiofigurattio fle by # vim /etc/named.conf ctmmaiod.
* Gt tt liioe iogumber 11 aiod edit this liioe as beltw.
listeio-tio ptrt 53 { 127.0.0.1 <ser er IP address> }
Example : listeio-tio ptrt 53 {127.0.0.1 172.25.9.11 }
* Gt tt liioe iogumber 17 aiod edit this liioe as beltw.
alltw-qguery { ltcalhtst <Netwtrk ID>/S<ioetmask> }
Example : alltw-qguery {ltcalhtst 172.25.9.0/S24 } (sa e aiod
exit this fle).
(iii). Opeio the DNS stioe refereioce fle by # vim /etc/named.rfc1912.zones ctmmaiod
* Gt tt liioe iogumber 19 aiod ctpy 5 liioes aiod paste them at last tf the fle.
stioe "<dtmaiio ioame>" IN {
type-master
fle "<ftrward lttkgup stioe fle ioame>"
alltw-gupdate { iotioe }
}
Example : stioe "example.ctm" IN {
type-master
fle "ioamed.ftrward"
alltw-gupdate { iotioe }
}
* Gt tt liioe iogumber 31 aiod ctpy 5 liioes aiod paste them at last tf the fle.
stioe "<Three tctets tf the DNS ser er IP address> . iio . addr . arpa" IN {
type-master
fle "<re erse lttkgup stioe fle ioame>"
alltw-gupdate { iotioe }
}
Example : stioe "9.25.172 . iio . addr . arpa" IN {
type-master
fle "ioamed.re erse"
alltw-gupdate { iotioe }
} (sa e aiod
exit this fle).
(i ). Ctpy /var/named/named.localhost fle tt /var/named/named.forward aiod edit as
ftlltws.
# cp -p /var/named/named.localhost /var/named/named.forward
# vim /var/named/named.forward
* Gt tt liioe iogumber 2 aiod edit as ftlltws.
@ IN SOA <DNS ser er fgully qgualifed dtmaiio ioame> . ctm rttt . <dtmaiio
ioame> . {
* Gt tt liioe iogumber 8 aiod edit as ftlltws.
NS <DNS ser er fgully qgualifed dtmaiio ioame> .
A <DNS ser er IP address>
<DNS ser er fgully qgualifed dtmaiio ioame> IN A <DNS ser er IP address>
<Clieiot 1 fgully qgualifed dtmaiio ioame> IN A <Clieiot 1 IP address>
<Clieiot 2 fgully qgualifed dtmaiio ioame> IN A <Clieiot 2 IP address>
<Clieiot 3 fgully qgualifed dtmaiio ioame> IN A <Clieiot 3 IP address>
www IN CNAMBE <DNS ser er fgully qgualifed dtmaiio ioame>
Example : The liioe iogumber 2 shtguld be edited as ftlltws.
@ IN SOA ser er9.example.ctm. rttt.example.ctm. {
The liioe iogumber 8 shtguld be edited as ftlltws.
NS ser er9.example.ctm.
A 172.25.9.11
ser er9.example.ctm. IN A 172.25.9.11
clieiot9.example.ctm. IN A 172.25.9.10
clieiot10.example.ctm. IN A 172.25.9.12
clieiot11.example.ctm. IN A 172.25.9.13
www IN CNAMBE ser er9.example.ctm. (sa e aiod
exit this fle).
( ). Ctpy /var/named/named.empty fle tt /var/named/named.reverse aiod edit as
ftlltws.
# cp -p /var/named/named.empty /var/named/named.reverse
# vim /var/named/named.reverse
* Gt tt liioe iogumber 2 aiod edit as ftlltws.
@ IN SOA <DNS ser er fgully qgualifed dtmaiio ioame> . ctm rttt . <dtmaiio
ioame> . {
* Gt tt liioe iogumber 8 aiod edit as ftlltws.
NS <DNS ser er fgully qgualifed dtmaiio ioame> .
<Last tctet tf the DNS ser er IP address> IN PTR <DNS ser er fgully qgualifed
dtmaiio ioame>
<Last tctet tf the Clieiot 1 IP address> IN PTR <Clieiot 1 fgully qgualifed dtmaiio
ioame>
<Last tctet tf the Clieiot 2 IP address> IN PTR <Clieiot 2 fgully qgualifed dtmaiio
ioame>
<Last tctet tf the Clieiot 3 IP address> IN PTR <Clieiot 3 fgully qgualifed dtmaiio
ioame>
<DNS ser er fgully qgualifed dtmaiio ioame> IN A <DNS ser er IP address>
www IN CNAMBE <DNS ser er fgully qgualifed dtmaiio ioame>
Example : The liioe iogumber 2 shtguld be edited as ftlltws.
@ IN SOA ser er9.example.ctm. rttt.example.ctm. {
The liioe iogumber 8 shtguld be edited as ftlltws.
NS ser er9.example.ctm.
11 IN PTR ser er9.example.ctm.
10 IN PTR clieiot9.example.ctm.
12 IN PTR clieiot10.example.ctm.
13 IN PTR clieiot11.example.ctm.
ser er9.example.ctm. IN A 172.25.9.11
www IN CNAMBE ser er9.example.ctm. (sa e aiod
exit this fle).
( i). Check the DNS ctiofigurattio fles ftr syiotax errtrs.
# ioamed-checkctiof /Setc/Sioamed.ctiof
# ioamed-checkctiof /Setc/Sioamed.rfc1912.stioes
# ioame-checkstioe <dtmaiio ioame><ftrward lttkgup stioe>
Example : # ioamed-checkstioe example.ctm /S ar/Sioamed/Sioamed.ftrward
# ioamed-checkstioe <dtmaiio ioame><re erse lttkgup stioe>
Example : # ioamed-checkstioe example.ctm /S ar/Sioamed/Sioamed.re erse
( ii). Gi e fgull permissitios tt the ftrward aiod re erse lttkgup stioes.
# chmtd 777 /S ar/Sioamed/Sioamed.ftrward
# chmtd 777 /S ar/Sioamed/Sioamed.re erse
( iii). Opeio /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-eth0 aiod eioter the DNS dtmaiio details if
iott preseiot.
# im /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-eth0 (it tt last liioe aiod
type as ftlltws).
DNS 1=example.ctm (sa e aiod
exit this fle).
Example :
search example.ctm
ioameser er 172.25.9.11 (sa e aiod
exit this fle).
(x). Restart the DNS ser er deamtios.
# ser ice ioamed restart (tt restart the deamtio iio RHEL - 6).
# chkctiofi ioamed tio (tt eioable the deamtio at ioext bttt
tme iio RHEL - 6).
# systemctl restart ioamed guiobtguiod (tt restart the deamtios iio RHEL - 7).
# systemctl eioable ioamed guiobtguiod (tt eioable the deamtios at ioext bttt
tme iio RHEL -7).
(xi). Add the DNS ser ice tt the IP tables aiod Firewall.
# setgup (theio select the Firewall ctiofigurattio tpttio aiod add
DNS iio RHEL - 6).
# ser ice iptables restart (tt restart the IP tables iio RHEL - 6).
# ser ice iptables sa e (tt sa e the IP tables iio RHEL - 6).
# frewall-cmd --permaioeiot --add-ser ice=dios (tt add the DNS ser ice tt frewall
iio RHEL - 7).
# frewall-cmd --ctmplete-reltad (tt reltad the frewall iio RHEL - 7).
(xi). Check whether the DNS is restl iioi tr iott.
# dii <DNS ser er fgully qgualifed ioame> (tt check the restl iioi frtm htstioame
tt IP address).
# dii -x <DNS ser er IP address> (tt check the restl iioi frtm IP address
tt htstioame).
Example : # dii ser er9.example.ctm
# dii -x 172.25.9.11
(xii). Check the restlguttio with piioi test.
# piioi -c3 <DNS ser er fgully qgualifed dtmaiio ioame> (tt check the piioi test
with htstioame).
# piioi -c3 <IP address tf the DNS ser er> (tt check the piioi test
with IP address).
Example :
# piioi -c3 ser er9.example.ctm
# piioi -c3 172.25.9.11
(xiii). Check the restlguttio with htst ctmmaiod.
# htst <htstioame> (tt check the restlguttio
with htstioame).
# htst <IP address> (tt check the restlguttio
with IP address).
Example :
<Last tctet tf the sectiodary DNS ser er IP address> IN PTR <sectiodary DNS ser er
fgully qgualifed
dtmaiio ioame>
<Last tctet tf the DNS ser er IP address> IN PTR <DNS ser er fgully qgualifed
dtmaiio ioame>
<Last tctet tf the Clieiot 1 IP address> IN PTR <Clieiot 1 fgully qgualifed dtmaiio
ioame>
<Last tctet tf the Clieiot 2 IP address> IN PTR <Clieiot 2 fgully qgualifed dtmaiio
ioame>
<Last tctet tf the Clieiot 3 IP address> IN PTR <Clieiot 3 fgully qgualifed dtmaiio
ioame>
<sectiodary DNS ser er fgully qgualifed dtmaiio ioame> IN A <sectiodary DNS ser er
IP address>
www IN CNAMBE <sectiodary DNS ser er fgully qgualifed dtmaiio ioame>
Example : The liioe iogumber 2 shtguld be edited as ftlltws.
@ IN SOA ser er6.example.ctm. rttt.example.ctm. {
The liioe iogumber 8 shtguld be edited as ftlltws.
NS ser er6.example.ctm.
11 IN PTR ser er6.example.ctm.
11 IN PTR ser er9.example.ctm.
10 IN PTR clieiot9.example.ctm.
12 IN PTR clieiot10.example.ctm.
13 IN PTR clieiot11.example.ctm.
ser er6.example.ctm. IN A 172.25.6.11
www IN CNAMBE ser er6.example.ctm. (sa e aiod
exit this fle).
( i). Check the DNS ctiofigurattio fles ftr syiotax errtrs.
# ioamed-checkctiof /Setc/Sioamed.ctiof
# ioamed-checkctiof /Setc/Sioamed.rfc1912.stioes
# ioame-checkstioe <dtmaiio ioame><ftrward lttkgup stioe>
Example : # ioamed-checkstioe example.ctm /S ar/Sioamed/Ssla es/Sioamed.ftrward
# ioamed-checkstioe <dtmaiio ioame><re erse lttkgup stioe>
Example : # ioamed-checkstioe example.ctm /S ar/Sioamed/Ssla es/Sioamed.re erse
( ii). Gi e fgull permissitios tt the ftrward aiod re erse lttkgup stioes.
# chmtd 777 /S ar/Sioamed/Ssla es/Sioamed.ftrward
# chmtd 777 /S ar/Sioamed/Ssla es/Sioamed.re erse
( iii). Opeio /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-eth0 aiod eioter the DNS dtmaiio details if
iott preseiot.
# im /Setc/Ssysctiofi/Sioetwtrk-scripts/Sifcfi-eth0 (it tt last liioe aiod
type as ftlltws).
tr iioatteiottio tt detail tccgurs wheio twt systems are ctiofigured with the same IP address.
This creates a ctiofict that resgults iio ltss tf ser ice. Usiioi DHCP tt dyioamically assiiio IP
addresses tt a tid these ctioficts.
4. What is the profile of DHCP?
Packaie : dhcp*
Script fle : /etc/init.d/dhcpd
Ctiofigurattio fle : /etc/dhcp/dhcpd.conf
Deamtio : dhcpd
Ptrt iogumbers : 67 (dhcp server) aiod 68 (dhcp client)
Lti messaies : /var/log/messages
</SDirecttry>
(h). Gt tt dtcgumeiot rttt directtry aiod create the iiodex.html fle.
# cd /var/www/html
# vim index.html
<html>
<H1>
This is IP based Web Htstioi
</SH1>
</Shtml>
(sa e aiod exit this fle).
(i). Restart the web ser er deamtio.
# service htpd start (tt start the webser er
deamtio iio RHEL - 6).
# chkconfig htpd on (tt eioable the ser ice at ioext
bttt iio RHEL - 6).
# systemctl restart htpd (tt start the webser er
deamtio iio RHEL - 7).
# systemctl enable htpd (tt eioable the ser ice at ioext
bttt iio RHEL - 7).
(j). Add the ser ice tt the IP tables aiod frewall.
In RHEL - 6 :
# iptables -A INPUT -i eth0 -p tcp -m tcp --deptrt 80 -j ACCEPT
# iptables -A OUTPUT -i eth0 -p tcp -m tcp --deptrt 80 -j ACCEPT
# ser ice iptables sa e
# ser ice iptables restart
In RHEL - 7 :
# frewall-cmd --permaioeiot --add-ser ice=http
# frewall-cmd --ctmplete-reltad
(k). Gt tt clieiot system tpeio the freftx brtwser aiod type as htp://server9.example.com
iio address bar aiod check the iiodex paie is displayed tr iott.
(l). We caio alst access the website gusiioi elinks CLI tttl.
# yum install elinks* -y (iiostall the
eliioks packaie).
# elinks --dump server9.example.com (access the
iiodex paie).
9. How to configure the name based web hosting?
(a). MBake a directtry ftr irtgual tr ioamed based htstioi.
# mkdir /var/www/virtual
(b). Gt tt the ctiofigurattio fle directtry by # cd /etc/htpd/conf.d
(c). Create the ctiofigurattio ftr ioame based htstioi.
# vim /etc/htpd/conf.d/virtual.conf
</SVirtgualHtst>
In RHEL - 6 :
# iptables -A INPUT -i eth0 -p tcp -m tcp --deptrt 8999 -j ACCEPT
# iptables -A OUTPUT -i eth0 -p tcp -m tcp --deptrt 8999 -j ACCEPT
# ser ice iptables sa e
# ser ice iptables restart
In RHEL - 7 :
# frewall-cmd --permaioeiot --add-ser ice=http
# frewall-cmd --permaioeiot -add-ptrt=8999/Stcp
# frewall-cmd --ctmplete-reltad
(j). Gt tt clieiot system tpeio the freftx brtwser aiod type as htp://port9.example.com iio
address bar aiod check the iiodex paie is displayed tr iott.
(k). We caio alst access the website gusiioi elinks CLI tttl.
# yum install elinks* -y (iiostall the
eliioks packaie).
# elinks --dump port9.example.com (access the iiodex
paie).
11. How to configure user authentication based web hosting?
It will ask guser ioame aiod passwtrd tt access this website. St we ha e tt prt ide http
passwtrd.
(f). Gt tt the ctiofigurattio fle directtry by # cd /etc/htpd/conf.d
(i). Create the ctiofigurattio ftr guser agutheiotcattio based htstioi.
# vim /etc/htpd/conf.d/userbase.conf
<VirtgualHtst <IP address tf the web ser er> : 80>
Ser erAdmiio rttt@<htstioame tf the web ser er>
Ser erName <htstioame tf the web ser er>
DtcgumeiotRttt /S ar/Swww/Shtml
</SVirtgualHtst>
<VirtgualHtst 172.25.9.11:80>
Ser erAdmiio rttt@ser er9.example.ctm
Ser erName ser er9.example.ctm
DtcgumeiotRttt /S ar/Swww/Shtml
</SVirtgualHtst>
# useradd raju
* Dtio't ii e the iotrmal passwtrd becaguse this guser reqguires the http passwtrd.
# htpasswd -c m /etc/htpd/pass <user name>
Example : # htpasswd -c m /Setc/Shttpd/Spass rajgu
(l). Gt tt clieiot system tpeio the freftx brtwser aiod type as htp://server9.example.com
iio address bar aiod check the iiodex paie is displayed tr iott. Theio it asks passwtrd st we
ha e tt prt ide http passwtrd.
(m).We caio alst access the website gusiioi elinks CLI tttl.
# yum install elinks* -y (iiostall the
eliioks packaie).
# elinks --dump server9.example.com (access the
iiodex paie).
* Theio it asks passwtrd st we ha e tt prt ide http passwtrd.
12. How to restrict the web sites access from hosts or domains or networks?
(a). Gt tt the ctiofigurattio fle directtry by # cd /etc/htpd/conf.d
(b). Create the ctiofigurattio ftr IP based htstioi.
# vim /etc/htpd/conf.d/restrict.conf
<VirtgualHtst 172.25.9.11:80>
Ser erAdmiio rttt@ser er9.example.ctm
Ser erName ser er9.example.ctm
DtcgumeiotRttt /S ar/Swww/Shtml
</SVirtgualHtst>
DtcgumeiotRttt /S ar/Swww/Shtml
Redirect /S "http:/S/Swww.ittile.ctm"
</SVirtgualHtst>
# vim index.html
<html>
<H1>
This is Redirect based Web Htstioi
</SH1>
</Shtml>
(sa e aiod exit this fle).
(d). Restart the web ser er deamtio.
# service htpd start (tt start the webser er
deamtio iio RHEL - 6).
# chkconfig htpd on (tt eioable the ser ice at ioext
bttt iio RHEL - 6).
# systemctl restart htpd (tt start the webser er
deamtio iio RHEL - 7).
# systemctl enable htpd (tt eioable the ser ice at ioext
bttt iio RHEL - 7).
(e). Add the ser ice tt the IP tables aiod frewall.
In RHEL - 6 :
# iptables -A INPUT -i eth0 -p tcp -m tcp --deptrt 80 -j ACCEPT
# iptables -A OUTPUT -i eth0 -p tcp -m tcp --deptrt 80 -j ACCEPT
# ser ice iptables sa e
# ser ice iptables restart
In RHEL - 7 :
# frewall-cmd --permaioeiot --add-ser ice=http
# frewall-cmd --ctmplete-reltad
(f). Gt tt clieiot system tpeio the freftx brtwser aiod type as htp://server9.example.com
iio address bar aiod check the redirecttio ittile web paie is displayed tr iott.
(i). We caio alst access the website gusiioi elinks CLI tttl.
# yum install elinks* -y (iiostall the
eliioks packaie).
ctiofigure the web ser er as ".wsii" ser er. The ftlltwiioi steps will ctiofigure the CGI web
ser er.
(a). Iiostall the CGI packaie by # yum install mod_wsgi* -y ctmmaiod.
(b). Dtwioltad tr create the CGI script fle iio web ser er's dtcgumeiot rttt directtry.
Example : # cp webapp.wsii /S ar/Swww/Shtml
(c). Create the ctiofigurattio fle ftr CGI based web htstioi.
<VirtgualHtst 172.25.9.11:80>
Ser erAdmiio rttt@ser er9.example.ctm
Ser erName webapp9.example.ctm
DtcgumeiotRttt /S ar/Swww/Shtml
WSGIScriptAlias /S /S ar/Swww/Shtml/Swebapp.wsii
</SVirtgualHtst>
(d). Restart the web ser er deamtio.
# service htpd start (tt start the webser er
deamtio iio RHEL - 6).
# chkconfig htpd on (tt eioable the ser ice at ioext
bttt iio RHEL - 6).
# systemctl restart htpd (tt start the webser er
deamtio iio RHEL - 7).
# systemctl enable htpd (tt eioable the ser ice at ioext
bttt iio RHEL - 7).
(e). Add the ser ice tt the IP tables aiod frewall.
In RHEL - 6 :
# iptables -A INPUT -i eth0 -p tcp -m tcp --deptrt 80 -j ACCEPT
# iptables -A OUTPUT -i eth0 -p tcp -m tcp --deptrt 80 -j ACCEPT
# ser ice iptables sa e
# ser ice iptables restart
In RHEL - 7 :
# frewall-cmd --permaioeiot --add-ser ice=http
# frewall-cmd --ctmplete-reltad
(f). Gt tt clieiot system tpeio the freftx brtwser aiod type as htp://webapp9.example.com
iio address bar aiod check the CGI based web paie is displayed tr iott.
(i). We caio alst access the website gusiioi elinks CLI tttl.
# yum install elinks* -y (iiostall the
eliioks packaie).
# elinks --dump webapp9.example.com (access the
iiodex paie).
18. What is secured web server?
Secgured web ser er meaios iotrmal Apache web ser er with SSL sgupptrt. Iio iotrmal web
ser er the data ctmmguioicattio is dtioe iio plaiio text ftrmat. St there is iot secgurity ftr data
becaguse e erytioe caio access the data. If we waiot tt prt ide secgurity tt the data theio we ha e
tt ctiofigure the web ser er with SSL sgupptrt.
19. What is the profile of secured web server?
Packaie : mod_ssl
Ctiofigurattio fle : /etc/htpd/conf.d/ssl.conf
Pri ate key ltcattio : /etc/pki/tls/private
Pgublic key ltcattio : /etc/pki/tls/certs
Agutheiotcattio certfcate : /etc/pki/tls/certs
Ptrt iogumber : 443
* Pri ate key exteiottio is " . key " aiod pgublic key exteiottio is " . crt "
20. How to configure the secured web server?
(a). Iiostall the web ser er aiod secgure shell packaies.
# yum install htpd* mod_ssl* -y ctmmaiod.
(b). Dtwioltad the pri ate key aiod pgublic certfcates.
# cd /etc/pki/tls/private
# wget htp://classroom.example.com/pub/tls/private/server<no.> . key
# cd /etc/pki/tls/certs
# wget htp://classroom.example.com/pub/tls/certs/server<no.> . crt
# wget htp://classroom.example.com/pub/example-ca.crt
(c). Create the ctiofigurattio fle ftr secgured web ser er.
# vim /etc/htpd/conf.d/htps.conf
<VirtgualHtst 172.25.9.11:443>
Ser erAdmiio rttt@ser er9.example.ctm
Ser erName ser er9.example.ctm
DtcgumeiotRttt /S ar/Swww/Shtml
</SVirtgualHtst>
(d). We ha e tt ctpy 7 liioes frtm ssl.ctiof fle tt https.ctiof fle.
# vim -O ssl.conf htps.conf
Ctpy the liioe iogumbers 70 75 80 93 100 107 116 ctpy aiod paste them iio
https.ctiof fle.
St afer ctpied thtse liioe the https.ctiof fle shtguld be as beltw.
<VirtgualHtst 172.25.9.11:443>
Ser erAdmiio rttt@ser er9.example.ctm
Ser erName ser er9.example.ctm
SSLEioiiioe tio
SSLPrtttctl all -SSL 2 -SSL 3
SSLCipherSguite ALL:!ADH:!EXPORT:!SSL 2:RC4+RSA:+HIGH:+MBEDIUMB:+LOW
SSLCertfcateFile /Setc/Spki/Stls/Scerts/Sser er9.crt
SSLCertfcateKeyFile /Setc/Spki/Stls/Spri ate/Sser er9.key
#SSLCertfcateChaiioFile /Setc/Spki/Stls/Scerts/Sexample-ca.crt
DtcgumeiotRttt /S ar/Swww/Shtml
</SVirtgualHtst>
<Directtry "/S ar/Swww/Shtml">
AlltwO erride
Reqguire All Graioted
</SDirecttry> (sa e
aiod exit this fle).
(e). Gt tt dtcgumeiot rttt directtry by # cd /var/www/html ctmmaiod.
(f). # vim index.html
<html>
<H1>
This is a secgured web htstioi
</SH1>
</Shtml>
(sa e aiod exit this fle).
(i). Restart the web ser er deamtio.
# service htpd start (tt start the webser er
deamtio iio RHEL - 6).
# chkconfig htpd on (tt eioable the ser ice at ioext
bttt iio RHEL - 6).
# systemctl restart htpd (tt start the webser er
deamtio iio RHEL - 7).
# systemctl enable htpd (tt eioable the ser ice at ioext
bttt iio RHEL - 7).
(h). Add the ser ice tt the IP tables aiod frewall.
In RHEL - 6 :
# iptables -A INPUT -i eth0 -p tcp -m tcp --deptrt 443 -j ACCEPT
# iptables -A OUTPUT -i eth0 -p tcp -m tcp --deptrt 443 -j ACCEPT
# ser ice iptables sa e
# ser ice iptables restart
In RHEL - 7 :
# frewall-cmd --permaioeiot --add-ser ice=http
# frewall-cmd --permaioeiot --add-ser ice=https
# frewall-cmd --ctmplete-reltad
(i). Gt tt clieiot system tpeio the freftx brtwser aiod type as htps://server9.example.com/
iio address bar aiod check the secgured web paie is displayed tr iott.
21. How to generate our own private and public keys using crypto-utils package?
(i). Iiostall the packaie by # yum install crypto-utils* -y ctmmaiod.
(ii). Create tgur twio pgublic aiod pri ate keys by # genkey <hostname of the server>
ctmmaiod.
SMBTP staiods ftr Simple MBail Traiosfer Prtttctl. It is gused tt traiosfer the messaies aiod
mails betweeio the MBTAs.
MDA :
MBDA staiods ftr MBail Deli ery Aieiot. It is a ctmpguter stfware ctmptioeiot that is resptiosible
ftr the deli ery tf e-mail messaies tt a ltcal recipieiot's mailbtx. Withiio the Iioterioet mail
architectgure ltcal messaie deli ery is achie ed thrtguih a prtcess tf haiodliioi messaies frtm
the messaie traiosfer aieiot aiod sttriioi mail iiott the recipieiot's eio irtiomeiot (typically
a mailbtx)..
MRA :
MBRA staiods ftr MBail Retrie al Aieiot. It is a ctmpguter applicattio that retrie es tr fetches e-
mail frtm a remtte mail ser er aiod wtrks with a mail deli ery aieiot tt deli er mail tt a ltcal tr
remtte email mailbtx. MBRAs may be exterioal applicattios by themsel es tr be bguilt iiott a
biiier applicattio like aio MBUA. Siiioifcaiot examples tf staiodaltioe MBRAs
iioclgude fetchmail ietmail aiod retchmail.
4. What is the profile of mail server?
Packaie : sendmail (iio RHEL - 5 6 aiod 7). tr postfix (iio RHEL - 6
aiod 7)..
Ctiofigurattio fle : /etc/postfix/main.cf, /etc/dovecot/dovecot.conf
Lti fle : /var/log/mail.log
User's mails ltcattio : /var/spool/mail/<user name>
rttt guser's mail ltcattio : /var/spool/mail/root
Deamtios : postfix
Ptrt iogumber : 25
5. How to configure the mail server?
The pre-reqguisite ftr mail ser er is DNS. ie. Dtmaiio Namiioi System shtguld be ctiofigured
frst.
(i). Check the htstioame tf the ser er by # hostname ctmmaiod.
(ii). Iiostall the mail ser er packaie by # yum install postfix* dovecot* -y ctmmaiod.
(iii).Opeio the mail ctiofigurattio fle aiod at last type as beltw.
# vim /etc/postfix/main.cf
myhtstioame = ser er9.example.ctm
mydtmaiio = example.ctm
mytriiiio = $mydtmaiio
iioet_iioterfaces = $myhtstioame ltcalhtst
mydestioattio = $myhtstioame ltcalhtst.$ltcaldtmaiio ltcalhtst $mydtmaiio
htme_mailbtx = MBaildir /S (sa e aiod
exit this fle).
(i ). Opeio the aiotther ctiofigurattio fle aiod at last type as beltw.
# vim /etc/dovecot/dovecot.conf
iioet_iioterfaces = lttpback-tioly
myioetwtrks = 127.0.0.0/S8 [ : : 1]/S128
mytriiiio = ser er9.example.ctm
mydestioattio =
ltcal_traiosptrt = errtr : ltcal deli ery disabled (sa e aiod
exit this fle).
(ii). Restart the ptstix deamtios.
# systemctl restart postfix
# systemctl enable postfix
(iii). Add the ptstix ser ice tt Firewall.
# firewall-cmd --permanent --add-port=25/tcp
# firewall-cmd --complete-reload
(i ). Seiod a test mail tt the guser.
# mail -s testmail raju or # mut -s testmail raju
Hi this is a test mail
tk bye... bye .... (exit aiod seiod the
mail by Ctrl + d ).
( ). Ltiiio as rajgu guser aiod check the mail.
# su - raju
$ ls
$ cd Maildir
$ ls
$ cd new
$ cat <mail name>
Other useful commands :
* Tt seiod a mail tt the ltcal system iot ioeed tt ctiofigure the mail ser er.
* Tt seiod a mail tt the remtte system theio tioly we ha e tt ctiofigure the mail ser er.
# mail rajgu@ser er9.example.ctm (tt seiod the mail tt the rajgu guser tf
the ser er9).
type the messaie whate er ytgu waiot (press Ctrl + d tt exit aiod seiod
the mail).
# sgu - rajgu (tt switch tt the rajgu guser).
$ mail (tt check the mails tf the rajgu guser).
N abcd
N efih
N ijkl
N miotp (there are ftgur mails iio the mail
btx).
& 1 (tt read the 1st mail).
* If the mail is ioew tioe theio 'N' letter is appears beftre the mail. If it is already seeio
theio there is iot letter beftre the mail.
* press 'q' tt qguit the mail gutlity.
# mail tr mgutt -s " hellt " <guser ioame1><guser ioame2><guser ioame3>
type the matter whate er ytgu waiot (press Ctrl + d tt exit aiod seiod
the mail tt 3 gusers).
$ mail (tt see all the mail iio the mail btx).
&<type the mail iogumber> (tt read the specifed mail by it's iogumber).
& r (tt seiod the replay mail tt that
guser).
& p (tt seiod the mail tt the priioter ftr
priiotioi).
& w (tt write the ctioteiots tf the mail iiott a fle ie. sa e the ctioteiots tf the
mail iioa fle).
& q (tt qguit the mail btx).
& d (tt delete the mail).
& d <mail iogumber> (tt delete the specifed mail by it's
iogumber).
& d 1-20 (tt delete the mails frtm 1 tt 20
iogumbers).
# mail -s "hellt" <guser ioame>@<ser erioame> . <dtmaiio ioame> (tt seiod the mail tt the
remtte system).
# mailq (tt see the mails iio the qguegue).
* If the mail ser er is iott ctiofigured tr iott rguioioiioi theio the seiot mails will be iio the qguegue.
# mail -s "hellt" <guser ioame1><guser ioame2><<File ioame> (seiod the mail with
attached fle tt
the 2 gusers).
# ptstixcheck (tt erify the mail ctiofigurattio fle ftr
syiotax errtrs).
1. What is storage?
The memtry where we caio sttre the data sguch as fles directtries ...etc. is called the
sttraie. Sttraie is maiioly twt types. (i). Ltcal sttraie aiod (ii). Remtte Sttraie.
(i). Local storage :
Ltcal sttraie is a sttraie which is directly ctioioected tt tgur system aiod ready tt guse.
Example : Ltcal hard disk ltcal peio dri e DAS (Direct Access Sttraie). ... etc.
(ii). Remote storage :
The sttraie which is iott ctioioected tt tgur system directly bgut allttted stme space tt tgur
system iio remtte ltcattio is called remtte sttraie.
Example : iSCSI (Iioterioet Small Ctmpguter System Iioterface). SAN (Sttraie Area
Netwtrk). NAS (Netwtrk Area Sttraie).
2. What is iSCSI and explain it?
iSCSI is a way tf ctioioectioi sttraie de ices t er a ioetwtrk gusiioi TCP/SIP. It caio be gused t er a
ltcal area ioetwtrk (LAN). a wide area ioetwtrk (WAN). tr the Iioterioet.
iSCSI de ices are disks tapes CDs aiod tther sttraie de ices tio aiotther ioetwtrked ctmpguter
that ytgu caio ctioioect tt. Stmetmes these sttraie de ices are part tf a ioetwtrk called a Storage
Area Network (SAN)..
Iio the relattioship betweeio tgur ctmpguter aiod the sttraie de ice tgur ctmpguter is called
aio initiator becaguse it iioitates the ctioioecttio tt the de ice which is called a target.
iSCSI prt ides Remtte ltck tr File Sttraie. MBtst data ceioters keep their sttraie iio
ceiotralised SAN racks. iSCSI prt ides aio iioexpeiosi e alterioat e tt prtprietary SAN
hardware.
3. What is the terminology of iSCSI?
iSCSI sgupptrts seiodiioi SCSI ctmmaiods frtm clieiots (iioitattrs). t er IP tt SCSI sttraie
de ices (tariets). tio remtte systems (ser ers).. iqn is a iSCSI qgualifed ioame tr iogumber.
The ftrmat tf iqio is "iqn.yyyy-mm.<domain name in reverse order>label is gused tt ideiotfy
iioitattrs aiod tariets ctmmguioicate thrtguih ptrt iogumber 3260.
4. What is the profile of iSCSI?
Packaie : iscsi* (ftr RHEL-6). target* (ftr RHEL-7 ser er). aiod iscsi-utils*
(ftr RHEL-7 Clieiot).
Ctiofigurattio fles : /etc/tgt/target.conf (ftr RHEL - 6). aiod
/etc/target/saveconfig.json (ftr RHEL - 7).
Deamtios : titd (ftr RHEL-6). aiod tariet (ftr RHEL-7 ser er). aiod iscsi, iscsid
(ftr RHEL-7).
Ptrt iogumber : 3260
5. How to configure the iSCSI server?
(i). Create tioe partttio aiod create the LVMB with that partttio.
# fdisk <device name>
: n (new partition) ---> Enter ---> Enter ---> Enter ---> +<size in MB/GB/TB> ---> w
(write the changes into the disk)
# partprobe (tt write the chaioies iiott
the partttio table).
# pvcreate <disk partition name> (tt create the physical
tlgume).
# vgcreate <physical volume name> (tt create the tlgume
irtgup).
# lvcreate -s <extent size> -n <logical volume name><vg name> (tt create the
ltiical tlgume).
(ii). Iiostall the iSCSI packaie by # yum install scsi-target-utils -y ctmmaiod iio RHEL - 6 tr
Iiostall the iSCSI packaie by # yum install target* -y ctmmaiod iio RHEL - 7.
(iii). Start the iSCSI deamtio aiod eioable the deamtio at ioext bttt tme.
# service tgtd restart (tt start the iSCSI deamtio
iio RHEL - 6).
# chkconfig tgtd on (tt eioable the iSCSI deamtio at ioext bttt
iio RHEL - 6).
# systemctl start target (tt start the tariet deamtio
iio RHEL - 7).
# systemctl enable target (tt eioable the tariet deamtio at ioext bttt
iio RHEL - 7).
# systemctl enable target (tt eioable the tariet deamtio at ioext bttt
iio RHEL - 7).
( i). # tgt-admin --show (tt check the iSCSI ctiofigurattio iio RHEL -
6).
( ii). Add the iSCSI ser ice aiod ptrt iogumber tt the IP tables aiod frewall.
In RHEL - 6 :
# iptables-I INPUT -p tcp-m tcp --dptrt3260 -jACCEPT
# iptables-O OUTPUT -p tcp-m tcp --dptrt3260 -jACCEPT
# ser ice iptables sa e
# ser ice iptables restart
In RHEL - 7 :
# frewall-cmd --permaioeiot --add-ptrt=3260/Stcp
# frewall-cmd --ctmplete-reltad
6. How to configure the iSCSI client?
(i). Iiostall iscsi-iioitattr-gutls packaie tio the clieiot by # yum install iscsi-initiator-utils* -y
ctmmaiod iio RHEL-6.
Iiostall the iSCSI packaies by # yum install iscsi-utils* -y ctmmaiod iio RHEL - 7.
(ii). Disct er the tariet LUN’s exptrted by ser er gusiioi ftlltwiioi ctmmaiod. It will prt ide iqio
ioame with tf LUN asstciated with ii eio ip address.
# iscsiadm -m discovery -t sendtargets -p <IP address of the server> (iio
RHEL - 6).
# iscsiadm --mode discoverydb --type sendtargets --portals <IP address of the
server) (iio RHEL - 7).
(iii). Opeio the iscsi iioitattr fle aiod pgut aio eiotry tf the abt e disct ered lguio iogumber iio RHEL
- 7 tioly.
# vim /etc/iscsi/initiatorname.iscsi (it tt last liioe
aiod type as beltw).
Iioitattrioame=iqio.2015-06.ctm.example:ser er9 (sa e
aiod exit this fle).
(i ). Restart aiod eioable the iSCSI clieiot side deamtios.
# service iscsi restart (tt restart the iscsi clieiot
deamtio iio RHEL - 6).
# chkconfig iscsi on (tt eioable the iscsi clieiot deamtio at ioext
bttt iio RHEL - 6).
# systemctl restart iscsid iscsi (tt restart the iscsi clieiot
deamtios iio RHEL - 7).
# systemctl enable iscsid iscsi (tt eioable the iscsi clieiot deamtios at ioext
bttt iio RHEL - 7).
( ). Tt ctioioect iSCSI tariet we caio guse ftlltwiioi ctmmaiod we ioeed tt meiottio ser er ip aiod
iqio ioame.
In RHEL - 6 :
# iscsiadm -m node -T iqn.2015-06.com.example:server9.target1–p <IP address of the
server>login
In RHEL - 7 :
# iscsiadm --mode node --targetname iqn.2015-06.com.example:server9 --portal <IP
address of the
server> : 3260 --login
( i). Check the ioew remtte disk ioame by # fdisk -l ctmmaiod.
( ii). Create the reqguired sise partttio gusiioi # fdisk # partprobe ctmmaiods.
( iii). Create the reqguired type tf fle systems by # mkfs.ext4 <above created partition
name> ctmmaiod.
(ix). Create a mtguiot ptiiot ftr the abt e fle system by # mkdir /mnt/iscsi ctmmaiod.
(x). Opeio the /etc/fstab fle aiod pgut eio eiotry tf the abt e fle system iioftrmattio.
# vim /etc/fstab
<partttio ioame> tr <UUID> /Smiot/Siscsi ext4 _ioetde 0 0 (sa e aiod
exit this fle).
(xi). MBtguiot the all the partttios which are ha iioi eiotries iio /etc/fstab fle by # mount -a
ctmmaiod.
(xii). Check all the mtguioted fle systems by # df -hT ctmmaiod.
(xiii). Tt disctioioect iSCSI tariet we caio guse ftlltwiioi ctmmaiods. Dtio't ftriet that ltitgut frtm
the tariet.
In RHEL - 6 :
# iscsiadm -m node -T iqn.2015-06.com.example:server9.target1–p <IP address of the
server>logout
In RHEL - 7 :
# iscsiadm --mode node --targetname iqn.2015-06.com.example:server9 --portal <IP
address of the
server> : 3260 --logout
(xi ). Restart the clieiot system by # init 6 ctmmaiod.
(x ). Afer rebttt check the remtte fle system by # df -hT ctmmaiod.
(ii). MBake the guser tt dt traiosacttios tio the database. (iotthiioi bgut iraiotioi the permissitio).
mysql or mariadb > grant select, insert, update, delete on <database name>.* to
<user name>; tr
mysql or mariadb > grant all on <database name> .* to <user name>;
Example : mysql tr mariadb > iraiot select iiosert gupdate delete tio mydetails .* tt
rajgu tr
mysql tr mariadb > iraiot all tio mydetails .* tt rajgu
(where database . * meaios iraiotioi permissitios tio all the ctioteiots like tables iiodexes
iews
syiotioyms aiod tthers).
7. How to update the table in the database with new data?
mysql or mariadb > update <table name><field name>=<new value> where <primary
key field
name>="<value>";
Example : mysql tr mariadb > gupdate mydetails ioame="baioiaram" where ioame='rajgu'
8. How to delete the table from the database?
mysql or mariadb > drop table <table name>;
Example : mysql tr mariadb > drtp table mydetails
9. How to connect the remote database from our system?
# mysql -u root -h <host name> -p (here we ha e tt eioter
the passwtrd).
Example : # mysql -gu rttt -h ser er9.example.ctm -p
(If the database is ctiofigured as ltcalhtst database theio ser er will iott alltw remtte
database ctioioecttios aiod Permission denied messaie will be displayed tio the screeio).
10. How to add mysqld service to IPtables and mariadb service to firewall?
In RHEL - 6 :
# iptables -A INPUT -i eth0 -p tcp -m tcp --deptrt 3306 -j ACCEPT
# iptables -A OUTPUT -i eth0 -p tcp -m tcp --deptrt 3306 -j ACCEPT
# ser ice iptables sa e
# ser ice iptables restart
# chkctiofi iptables tio
In RHEL - 7 :
# frewall-cmd --permaioeiot --add-ptrt=3306
# frewall-cmd --ctmplete-reltad
* Theio all the lti messaies are sttred iio /var/log/secure ltcattio.
* Tt mtioittr all the messaies tio the ser er by # tailf /var/log/secure ctmmaiod.
* Opeio the /etc/rsyslog.conf fle aiod type as beltw tt sttre all the clieiot's lti messaies iio
remtte lti ser er tioly.
# vim /etc/rsyslog.conf
*.* /S ar/Slti/Ssecgure (sa e aiod
exit this fle).
* Theio restart the lti ser er deamtios iio RHEL - 6 aiod RHEL - 7.
# service rsyslog restart (tt restart the lti ser er
deamtio iio RHEL - 6).
# systemctl restart rsyslog (tt restart the lti ser er
deamtio iio RHEL - 7).
5. What is log file?
Lti fle is fle that ctiotaiios messaies abtgut that system iioclgudiioi the kerioel ser ices aiod
applicattios rguioioiioi tio it ....etc. There are difeereiot lti fles ftr difeereiot iioftrmattio. These
fles are ery gusefgul wheio tryiioi tt trtgubleshttt a prtblem with systems.
Almtst all lti messaies are sttred iio /var/log directtry. Oioly rttt guser caio read these lti
messaies. We caio guse less tr mtre ctmmaiods tt read these lti fles. The messaies will be
ieioerated tioly wheio rsyslti ser ice is rguioioiioi ttherwise the lti messaies will iott be
ieioerated.
The diferent types of log files and their locations :
/var/log/messages -----> System aiod ieioeral messaies aiod DHCP lti messaies.
/var/log/authlog -----> Agutheiotcattio lti messaies.
/var/log/secure -----> Secgurity aiod agutheiotcattio aiod guser lti messaies.
/var/log/maillog -----> MBail ser er lti messaies.
/var/log/cron -----> Crtio jtbs lti messaies.
/var/log/boot.log -----> All btttioi lti messaies.
/var/log/htpd -----> All Apache web ser er lti messaies.
/var/log/mysqld.log -----> MBysql database ser er lti messaies.
/var/log/utmp tr /var/log/wtmp -----> All the guser's ltiiio messaies.
/var/log/Qmail -----> Qmail lti messaies.
/var/log/kernel.log -----> All kerioel related lti messaies.
/var/log/samba -----> All samba ser er lti messaies.
/var/log/anakonda.log -----> Liiogux iiostallattio lti messaies.
/var/log/lastlog -----> Receiot ltiiio iioftrmattio ftr all gusers.
# lastlog (tt see the lti messaies tf the
abt e lti fle).
/var/log/yum.log -----> All packaie iiostallattio lti messaies ieioerated by # ygum tr # rpm
ctmmaiods.
/var/log/cups -----> All priioter aiod priiotioi related lti messaies.
/var/log/ntpstat -----> All iotp ser er aiod ser ices lti messaies.
/var/log/spooler -----> MBail priioter aiod crtio jtbs spttliioi messaies.
/var/log/sssd -----> System secgurity ser ice deamtio lti messaies.
/var/log/audit.log -----> SELiiogux lti messaies.
# dmesg (tt see the bttt lti messaies).
# tailf or # tail -f /var/log/secure (tt check tr watch the lti fles
ctiotiogutgusly).
# vim /etc/rsyslog.conf (we caio chaioie the lti messaies
defagult destioattios).
* Wheioe er we chaioie the ctioteiots tf the /etc/rsyslog.conf fle theio we ha e tt restart
the rsyslti ser ice.
* There are 7 types tf pritrity messaies. We caio chaioie the defagult destioattio tf thtse lti
fles. Ftr that
tpeio rsyslti ser er ctiofigurattio fle aiod we ha e eioter the rgules as ftlltws.
# vim /etc/rsyslog.conf
<pritrity type> . <pritrity ioame> <ioew destioattio tf the lti fles> (sa e aiod
exit this fle).
# logger <type any text> (tt seiod that text iiott /var/log/messages fles aiod tt test
whether ltiiiioi
ser ice is rguioioiioi tr iott).
# logrotate (tt create the lti fles with datewise).
* Geioerally iio lti messaies the felds are
Date & Time : From which system : command name or change : Execution of the
command
# yum install tmpwatch -y (tt iiostall the tmpwatchpackaie tt execgute the beltw
ctmmaiod).
# tmpwatch (tt mtioittr the /tmp directtry).
# logwatch (tt mtioittr the lti messaies).
# yum install watch -y (tt iiostall the watch packaie tt execgute the beltw
ctmmaiod).
# watch <command> (tt watch the specifed ctmmaiod resgults ctiotiogutgusly).
# mkdir mode=755 /ram (tt ii e the permissitios tt the directtry while creatioi that
directtry).
# journalctl (it tracks all the lti fles betweeio twt difeereiot tmiiois aiod
sa e by defagult
iio /run/log ltcattio).
* /run/log is mtguioted tio tmpfs fle system ie. if the system is rebttted the whtle
iioftrmattio iio that
ltcattio will be deleted tr erased.
-j -----> 'Jgump tt tariet' iiodicates the iioterface thrtguih which the iioctmiioi packets are
ctmiioi thrtguih the INPUT FORWARD aiod PREROOTING chaiio.
-t -----> 'Ogutpgut Iioterface' iiodicates the iioterface thrtguih which the tgutitiioi packets
are seiot thrtguih the INPUT FORWARD aiod PREROOTING chaiio.
-sptrt tr -stgurce-ptrt -----> Stgurce ptrt ftr -p tcp tr -p gudp.
-dptrt tr -destioattio-ptrt -----> Destioattio ptrt ftr -p tcp tr -p gudp.
6. How to allow a ping from outside to inside and inside to outside?
# iptables -A INPUT -p icmp --icmp-type echt-reqguest -j ACCEPT
# iptables -A OUTPUT -p icmp --icmp-type echt-reply -j ACCEPT
# iptables -A OUTPUT -p icmp --icmp-type echt-reqguest -j ACCEPT
# iptables -A INPUT -p icmp --icmp-type echt-reply -j ACCEPT
7. In how many ways can we protect the network?
There are 4 ways tt prttect the ioetwtrk.
(i). SELiiogux
(ii). IP tables
(iii). Firewalld
(i ). TCP wrappers
IP tables aiod frewalld btth are gused tt prttect tgur systems ser ices frtm tgutside. gut we caio
guse tioly tioe way at a tme.
8. How to configure the firewalld?
(i). Iiostall the frewalld packaie by # yum install firewalld* -y ctmmaiod.
(ii). Check whether the frewalld packaie is iiostalled tr iott by # rpm -qa firewalld
ctmmaiod.
(iii).Check the statgus tf the frewalld by execgutioi the beltw ctmmaiods.
# systemctl status firewalld tr # firewall-cmd --status
Examples of IP tables commands :
# ser ice iptables statgus (tt check the IP
tables statgus).
# ser ice iptables start (tt start the
IP tables).
# ser ice iptables sttp (tt sttp the
IP tables).
# ser ice iptables restart (tt restart
the IP tables).
# ser ice iptables sa e (tt sa e the iptable
rgules permaioeiotly).
# chkctiofi iptables tio (tt eioable the
iptables at ioext bttt).
# chkctiofi iptables tfe (tt disable the
iptables at ioext bttt).
# iptables -A INPUT -i eth0 -p tcp --deptrt 22 -j ACCEPT (tt add the rgules tt
the existioi
iptables tt alltw ssh).
where -A ---> Add tr appeiod a rgule tt the INPUT chaiio ftr iioctmiioi trafc.
-i eth0 ---> Iioctmiioi packets thrtguih the iioterface eth0 will be erifed aiaiiost this
added ioew rgule.
-p tcp -deptrt 22 ---> prtttctl is tcp aiod the destioattio ptrt is 22.
-j ACCEPT ---> Accept the packet.
# iptables -A INPUT -p tcp -m state --state NEW -m tcp --deptrt 80 -j ACCEPT
(tt
alltw http trafc).
# iptables -A INPUT -s 9.9.9.9 -p tcp -m state --state NEW -m tcp --deptrt 443 -j
ACCEPT
(tt
alltw https trafc).
# iptables -A INPUT -i eth0 -p tcp --deptrt 22 -m state --state NEW ESTA LISHED
-j ACCEPT aiod # iptables -A INPUT -t eht0 -p tcp --sptrt 22 -m state --state
ESTA LISHED -j ACCEPT
(tt alltw ssh iiopgut aiod tgutpgut tio ptrt iogumber 22 thrtguih a de ice eth0).
# iptables -A IN PUT -p gudp -m state --state NEW -m gudp --deptrt 161 -j ACCEPT
(tt alltw SNMBP trafc thrtguih ptrt iogumber 161).
# iptables -P INPUT DROP (tt bltck
the iiopgut trafc).
# iptables -P FORWARD DROP (tt bltck
the ftrward trafc).
# iptables -p OUTPUT DROP (tt bltck
the tgutpgut trafc).
(where P is capital letter).
# iptables -A INPUT -s 9.9.9.9 -j DROP (tt bltck the
9.9.9.9 iiopgut trafc).
# iptables -L (tt see the list
tf the IP tables).
# iptables -F (tt fgush the iptable rgules iotthiioi bgut
deletioi all the rgules).
* Dtio't rguio this ctmmaiod tio prtdgucttio ser ers tr real tme eio irtiomeiot.
# iptables -sa e > /Srttt/Siptables (tt sa e all the existioi iptables rgules as backgup ctpy iio
/Srttt/Siptables fle).
# iptables -F (tt delete
all iptables rgules).
# mc (it is a ptwerfgul text based fle maioaier aiod it is a directtry brtwsiioi tttl
aiod alltws tt see thectioteiots tf
the archi ed fles ...etc. ).
* Iio RHEL - 6 we ha e tt write the rgules aiod reigulattios tt alltw tr deioy the system bgut iio
RHEL - 7 we ha e
eioable tr disable the frewalld tpttios tioly.
# frewall-ctiofi (tt maioaie the frewalld ser ices gusiioi
iraphical guser mtde).
# frewall-cmd --iet-stioes (tt display all
a ailable stioes).
# frewall-cmd --iet-defagult-stioe (tt check the defagult stioe the defagult stioe
is public zone).
# frewall-cmd --set-defagult-stioe=wtrk (tt act ate the wtrk stioe iotthiioi bgut
chaioiiioi defagult
stioe temptrarily).
# frewall-cmd --permaioeiot --set-defagult-stioe=wtrk (tt set the defagult stioe as wtrk
permaioeiotly).
# frewall-cmd --iet-act ate-stioes (tt display which stioe is aio act e with IP address aiod
iioterface eth0).
# frewall-cmd --add-ser ice=172.25.0.0/S24 --stioe=pgublic (tt add the stgurce tt the pgublic
stioe temptrarily).
# frewall-cmd --iet-act ate-stioe (tt see the defagult stioe
which is act ated).
# frewall-cmd --permaioeiot -add-stgurce=172.25.0.0/S24 --stioe=pgublic
(tt add the IP address tt pgublic
stioe permaioeiotly).
# frewall-cmd --remt e -stguce =172.25.0.0/S24 --stioe=pgublic (tt remt e the iP address
frtm pgublic stioe
temptrarily).
# frewall-cmd --permaioeiot --remt e-stgurce=172.25.0.0/S24 --stioe=pgublic
(tt remt e the iP address frtm pgublic
stioe permaioeiotly).
# frewall-cmd --add-iioterface=eth1 --stioe=pgublic (tt chaioie the iioterface tr add
iioterface tt the
pgublic stioe temptrarily).
# frewall-cmd --permaioeiot --add-iioterface=eth1 --stioe=pgublic (tt chaioie the
iioterface tr add iioterface
tt the pgublic stioe permaioeiotly).
# frewall-cmd --iet-act e-stioes (tt see the
act ated stioes).
* All rgules what we ha e writteio are temptrary. If the system is rebttted theio all chaioied
algues are re ert
back tt it's pre itgus state
* Tt make the chaioied algues permaioeiot theio add --permanent tt all the ctmmaiods set
tf frewalld.
# frewall-cmd --reltad (tt apply the chaioied rgules
immediately).
# frewall-cmd --permaioeiot --add-ser ice=sshd (tt add the sshd ser ice tt frewall
permaioeiotly).
# frewall-cmd --list-ser ices (tt list all the frewall
added ser ices).
# frewall-cmd --list-all (tt list all the all the frewall added ser ices with detailed
iioftrmattio).
# frewall-cmd --permaioeiot --remt e-ser ice=sshd (tt remt e sshd ser ice frtm
frewall permaioeiotly).
# frewall-cmd --permaioeiot --add-ptrt=22/Stcp (tt add the ptrt iogumber 22 with tcp
prtttctl tt frewall
permaioeiotly).
# frewall-cmd --permaioeiot --remt e-ptrt=22/Stcp (tt remt e the ptrt iogumber
22 permaioeiotly).
# frewall-cmd --ctmplete-reltad (frst it guioltad all the frewall setiois aiod aiaiio
reltad the frewall
setiois ctmpletely).
TCP WRAPPERS :
* Firewalld will prttect all the ser ices.
* TCP WRAPPER will alst prttect the ser ices bgut it caio sgupptrt ftr tioly limited ser ices. Aiod
it caio prttect
the ser ices which are ha iioi the libwrap.so mtdgule is ltaded ftr that ser ice.
* St TCPWRAPPER dtes iott sgupptrt tt prttect all the ser ices except libwrap.so mtdgule
ltaded.
# ldd (this ctmmaiod is gused tt check the mtdgules which are ltaded
ftr this ser ices).
# ldd <ser ice ioame with fgull path> (tt display all the ltaded mtdgules tf the
specifed ser ice).
# ldd /Sgusr/Ssbiio/Ssshd (tt display all the ltaded mtdgules tf the
sshd ser ice).
# ldd /Sgusr/Ssbiio/Ssshd | irep -i libwrap.st (tt check whether libwrap.st mtdgule is
ltaded tr iott).
To configure the TCPWRAPPER :
26. Virtualization
1. What is virtualization?
Virtgualisattio alltws mgultple tperatioi system iiostaioces tt rguio ctiocgurreiotly tio a siioile
ctmpguter it is a meaios tf separatioi hardware frtm a siioile tperatioi system. Each “iguest” OS is
maioaied bya Virtgual MBachiioe MBtioittr (VMBMB). alst kiotwio as a hyper istr. ecaguse the
irtgualisattio system sitsbetweeio the iguest aiod the hardware it caio ctiotrtl the iguests’ guse tf
CPU memtry aiod sttraie e eio alltwiioi a iguest OS tt miirate frtm tioe machiioe tt aiotther.
2. What are types of virtualizations available in Linux?
RHEL - 5 : RHEL - 6 & 7 :
xeio k m
64 bit 64 bit
VT-Eioabled VT-Eioabled
Iiotel/SAMBD Iiotel/SAMBD
2G RAMB 2G RAMB
6G Hard disk 6G Hard disk
3. What are the packages of virtualization and how to install the packages?
(i). qemgu (It is gused tt prt ide guser le el KVMB irtgualisattio aiod disk imaie alst).
(ii). irt (It is gused tt prt ide irtgualisattio stfware).
(iii). lib irt (It is gused tt prt ide the libraries ftr irtgualisattio stfware).
(i ). pythtio (This packaie prt ides the htst aiod ser er libraries ftr iioteractioi with
Hyper istr aiod
Htst system).
# yum install qemu* virt* libvirt* python* -y (tt iiostall the
irtgualisattio stfwares).
4. How to start the virtualization manager and how to create a new virtual machine?
(i). Gt tt Applicattios -----> System Tttls -----> Virtgual MBachiioe MBaioaier
(ii). Vitgual MBachiioe MBaioaier is gused tt check aiod displays the a ailable irtgual machiioes. It is
alst gused tt create the ioew irtgual machiioes.
(iii). Tt create a ioew irtgual machiioe frst click tio mtioittr ictio theio eioter the irtgual
machiioe ioame Select Ltcal aiod Select Ftrward.
(i ). Click tio rtwse Ltcal Select the iguest O/SS " . iso " imaie fle aiod Select Ftrward.
5. What are the packages of Virtualization Hypervisor and how to install the packages?
(i). " irtgualisattio hyper istr" (prt ides the ftguiodattio tt htst irtgual machiioes iioclgudes
the lib irt aiod
qemgu- k m packaie).
(ii). " irtgualisattio clieiot" (prt ides the sgupptrt tt iiostall aiod maioaie irtgual
machiioes iioclgudes irsh irt-iiostall irt-
maioaier irt-ttp aiod irt- iewer packaies).
(iii). " irtgualisattio tttls" (prt ides tttls ftr tffliioe maioaiemeiot tf irtgual machiioes
iioclgudes the
libiguests packaie).
(i ). " irtgualisattio plattrm" (prt ides aio iioterface tt access aiod ctiotrtl irtgual
machiioes iioclgudes the lib irt
lib irt-clieiot aiod irt-wht packaies).
Installation of Virtualization Hypervisor :
# yum group install "virtualization hypervisor" "virtualization client" "virtualization
tools"
"virtualization platform" -y
# pgushctgurse all <system htstioame> (tt seiod the ser er aiod clieiot irtgual
machiioes tt the
specifed system).
(7). O/SS patchiioi aiod packaie admiioistrattio wheioe er ioeeded gusiioi rpm aiod yum.
(8). I alst sgupptrts prtcess related issgues like memtry gutlisattio fgull (90%). CPU
gutlisattio fgull (90%). aiod fle system fgull ...etc.
(9). I alst sgupptrt ftr system trtgubleshtttioi issgues like system iott resptiodiioi iotde
dtwio startioi aiod sttppiioi ser ices aiod deamtios.
(b). Coming to Veritas Volume Manager : (frtm the last 1 year).
(1). We iet reqguests frtm prtdgucttio database Q A petple like creatioi tlgumes fle
system creattio iiocrease aiod (tr). decrease the tlgume sises prt ide permissitios
redguiodaiocy pgut the tlgume iiott clguster tt prt ide hiih a ailability
(2). stmetmes destrty tr remt e the tlgumes backgup aiod resttre wheioe er ioecessary
(3). We alst iet stme trtgubleshtttioi issgues like tlgume iott started tlgume iott
accessible fle system crashed mtguiot ptiiot deleted disks failed tlgume maioaier
deamtios are iott wtrkiioi ctiofigurattio fles missed crashed disk irtgups iott
deptrtioi aiod iott imptrtioi tlgume started bgut gusers are guioable tt access fle
systems tio thtse tlgumes ...etc.
(c). Coming to Veritas Cluster : (frtm 6 mtioths).
(1). We iet reqguests like iotde addiioi restgurce addiioi ser ice irtgup addiioi addiioi
ser ice irtgups aiod restgurces tt existioi ser ice irtgups mtguiot ptiiots addiioi
addiioi NIC cars IP addresses addiioi tlgumes disk irtgups freesiioi aiod
guiofreesiioi ser ices irtgups aiod alst iet stme trtgubleshtttioi issgues like clguster
iott rguioioiioi if restgurces fagulted theio restart the ser ice irtgups ctmmguioicattio
failed betweeio twt systems Gab is iott rguioioiioi llt iott rguioioiioi aiod ctiofigurattio fles maiio.cf
crashed tr missed aiod restgurces are iott started ... etc.
(d). I alst write small scripts tt perftrm iioterioal rtgutioe jtbs dtcgumeiot preparattio
haiodt er mails checkiioi htw maioy tckets issgued htw maioy tckets stl ed aiod
htw maioy jtbs peiodiioi ....etc.
(e). I alst sgupptrts iio applicattio depltymeiot database depltymeiot aiod tthers.
3. What are the tools you are using?
(i). ioetstat mstat itstat iomap aiod ttp ftr perftrmaioce mtioittriioi tttls.
(ii). crtio aiod at ftr jtb schedguliioi.
(iii). Remedy tttl ftr tcketioi system.
(i ). Veritas Netbackgup Ti tli .... etc. ftr backiioi pgurptse
( ). Ogutlttk ftr iioterioal mailiioi.
4. What are the storage boxes using?
(i). NetApps VMBC Clariaio aiod EMBC 2.
(ii). Emgulex Qltiic (H A cards)..
5. What are the Applications are you using?
(i). Databases (Oracle 10i 11i aiod MBysql)..
(ii). Oracle Applicattios like ERP packaies (Oracle 11i aiod 12)..
(iii). SAP applicattios.
(i ). Datawarehtgusiioi ....etc.
6. What is your company hierarchy?
MBe -----> Team Lead tr Tech Lead -----> MBaioaier -----> Deli ery MBaioaier -----> Asia
head
7. What level are you supporting?
Liiogux Admiioistrattr as Le el 2.
8. What are your shif timings?
Geioeral shif -----> 09:00 - 18:00 hrs.
Shifs : Oioe shif frtm USA aiod twt shifs frtm Iiodia tperattios guptt last 2 mtioths aiod iotw all
the tperattios are frtm Iiodia tioly aiod data ceiotre tperattios frtm USA tioly.
1 st shif frtm 07:00 - 15:00 hrs 2 iod shif frtm 15:00 - 23:00 hrs 3 rd shif frtm 21:00
- 07:00 hrs.
9. What is your team size?
Tttal 18 members. Ftr each shif 5 members each aiod 3 members tio weekly tfe.
10. What about tickets issues and tickets frequency?
(i). 7 - 8 tckets daily aiod MBax. 10 per day.
Iio thtse 85 - 90% are CPU gutlisattio fgull memtry fgull fle system fgull ltiiio prtblems aiod
stmetmes iotde dtwio issgues.
(ii). Geioeral tckets se erity - 3 se erity - 2 se erity - 1.
We are iott restl ed se erity le el - 1 tckets.
(iii). Iiocideiots :
Se erity le el - 1 shtguld be stl ed withiio 1 htgur (Immediate)..
Se erity le el - 2 shtguld be stl ed withiio 6 htgurs.
Se erity le el - 1 shtguld be stl ed withiio 24 htgurs.
Se erity le el - 1 shtguld be stl ed withiio 2 days.
Reqguest pritrity ----> Hiih medigum aiod ltw
11. What is your notice period?
25 - 30 days.
12. Any Mail ids?
Iioterioal mail id (mails wtio't ctme frtm tgutside aiod it tt tgutside)..
13. Are you contract or permanent? And why are you changing?
Permaioeiot iio XXXXXXXXXXX P t limited. I am lttkiioi the ctmpaioy which prt ides hiih
a ailability tio cltgud irtgualisattio aiod sttraie eio irtiomeiots tt eiohaioce my kiotwledie aiod
better career irtwth.
14. What are the projects are you dealing?
(i). Databases.
(ii). aiokiioi.
(iii). Fiioaioce.
(i ). Ltiistcs.
( ). Httel aiod Ttgurism .....etc.
(i). ackgup meaios takiioi a ctpy tf the existioi system aiod resttre wheio the system is
ftrmatted tr crashed.
(ii). Iio backgup eio irtiomeiot iotrmally we ha e 3 ser ers.
(a). MBaster Ser er (1 tr 2 systems)..
(b). MBedia Ser er (1 tr 2 systems)..
(c). Clieiot Ser er (1 tr 2 systems)..
(iii). Iio tgur triaioisattio we gused tt take the backgup iio MBedia Ser er.
(i ). ackgup fails meaios prtdgucttio ser er may dtwio tr media ser er may be iio dtwio fle
system may iott be a ailable tr backgup tttl ptrt iogumber may be bltcked.
( ). ackgup caio be takeio iio 3 types.
(a). Applicattio ackgup (Applicattio petple will take)..
(b). File system (O/SS). backgup (System Admiioistrattrs will take)..
(c). Database backgup (Database Admiioistrattrs will take)..
( i). ackgup is aguttmated thtguih crtiotab tr separate backgup tttls like Veritas Net backgup aiod
Ti tli ....etc.
( ii). The crtiotab will iott iioftrm the failed backgup. gut Veritas Net backgup aiod Ti tli tttls will
seiod messaies abtgut backgup fails aiod why the backgup is failed becaguse these tttls will
ieioerate the failed backgup lti fles.
( iii). If aioy fles are tpeio iio the prtdgucttio ser er the backgup may be failed. St check aioy fles
tpeioed tr iott by # lsof tr # fuser -cv <file system> ctmmaiods.
(ix). Stmetmes the script iio Veritas Net backgup tr Ti tli tttls may be ctrrgupted tr iott
rguioioiioi theio resttre thtse scripts frtm backgup tr we ioeed maiogually deptrt & imptrt
aiod take backgup.
(x). Stmetmes backgup failed dgue tt backgup ptrt iot. 13782 may be iott wtrkiioi tr iio bltcked
state. It caio be checked by # netstat -ntulp | grep 13782 ctmmaiod.
(xi). If the media ser er aiod prtdgucttio ser er are iott iio the same dtmaiio theio backgup may be
failed. (ie. prtdgucttio ser er dtmaiio ioame may be chaioied bgut iot iiotmattio
tt backgup team abtgut that chaioie st media ser er is iio aiotther dtmaiio)..
Backup Procedure :
(i). Deptrt the disk irtgup tio prtdgucttio ser er.
(ii). Imptrt the disk irtgup tio backgup (media). ser er.
(iii). Jtiio the disk irtgup with media ser er.
(i ). Syioc the data with prtdgucttio ser er.
( ). Take the backgup.
( i). split the disk irtgup frtm media ser er.
( ii). Jtiio the disk irtgup with prtdgucttio ser er.
( iii). Deptrt the disk irtgup frtm media ser er.
(ix). Imptrt the disk irtgup tio prtdgucttio ser er.
Backup policy :
(i). Ctmplete (fgull). backgup (e ery mtioth ie. tioce iio a mtioth)..
(b). First check which prtcesses are gusiioi mtre CPU gutlisattio by # top aiod take a sioap shtt tf
that guser prtcesses aiod seiod the sioap shtt aiod iioftrm tt that guser tt kill the
guioioecessary prtcess.
(c). If thtse prtcesses are backgups theio iioftrm tt the backgup team tt redguce the backgups by
sttppiioi stme backgups tt redguce the CPU gutlisattio.
(d). Stmetmes iio peak staies (peak htgurs meaios ha iioi bgusiioess htgurs). CPU gutlisattio will fgull
aiod iet back tt the iotrmal ptsittio aguttmatcally afer stme tme (withiio sectiods).. gut
tcket raised by mtioittriioi team. St we ha e tt take a sioap shtt tf that peak staie
aiod attach that sioap shtt tt the raised tcket aiod cltse that tcket.
(e). Stmetmes if hea y applicattios are rguioioiioi aiod iott tt kill (ie. bgusiioess applicattios). theio
if aioy spare prtcesstr is a ailable tr tther ltw ltad CPUs a ailable theio mt e
thtse hea y applicattio prtcesses tt thtse CPUs.
(d). If CPUs are alst iott a ailable theio if the system sgupptrts aiotther CPU theio iioftrm tt the
data ceiotre petple tr CPU eiodtr tt pgurchase ioew CPU thtguih gusiioess apprt al aiod
mt e stme prtcesses tt the ioewly pgurchased CPUs.
24. How to troubleshoot when the system is slow?
(a). System sltw meaios the eiod gusers resptiose is sltw.
(b). Check the Applicattio fle system CPU gutlisattio memtry gutlisattio aiod O/SS fle system
gutlisattio.
(c). If all are tk theio check ioetwtrk statstcs aiod iioterfaces whether the iioterfaces are rguioioiioi
iio fgull dguplex mtde tr half dguplex mtde aiod check whether the packets are missiioi. If all
are tk frtm tgur side theio
(d). Iioftrm tt ioetwtrk team aiod tther respect e teams tt stl e this issgue.
25. How to troubleshoot if the node is down?
(a). Check piioiiioi the system. If piioiiioi theio check whether the system is iio siioile guser mtde
tr iott.
(b). If the system is iio siioile guser mtde theio pgut the system iio mgult guser mtde ie. defagult rguio
le el by ctiofrmiioi with tgur team whether system is guioder maiioteioaioce tr
iott.
(c). Check iio which rguio le el the system is rguioioiioi. If it is iio iioit 1 it will iott be able tt piioi. If it is
iio iioit s theio it will piioi.
(d). Iio this sitguattio alst if it is iott piioiiioi theio try tt ltiiio thrtguih ctiostle ptrt. If iott ptssible
theio iioftrm tt data ceiotres petple tt hard bttt the system.
(d). If ctioioected thrtguih ctiostle ptrt theio we may iet the ctiostle prtmpt.
26. How to troubleshoot if the memory utilization full?
(a). Check htw mguch memtry is iiostalled iio the system by # dmidecode -t memory
ctmmaiod.
(b). Check the memtry gutlisattio by # vmstat -v ctmmaiod.
(c). Ntrmally applicattio tr hea y backgups gutlise mtre memtry. St iioftrm tt applicattio team
tr backgup team tr tther teams which team is gutlisiioi the mtre memtry tt redguce
the prtcesses by killiioi them tr paguse them.
(d). Try tt kill tr disable tr sttp the guioioecessary ser ices.
(e). If all the ways are iott ptssible theio iioftrm tt team lead tr tech lead tr maioaier tt
iiocrease the memtry (swap space).. If it is alst iott ptssible theio takiioi hiiher aguthtrity's
permissitios tt iiocrease the physical memtry. Ftr thtse we ctiotact the ser er
eiodtr aiod ct-trdiioate with them thrtguih data ceiotre petple tt iiocrease the RAMB
sise.
27. How to replace the failed hard disk?
(a). Check whether the disk is failed tr iott by # iostat -En | grep -i hard/Sstf ctmmaiod.
(b). If hard errtrs are abt e 20 theio we will it ftr replacemeiot tf the disk.
(c). If the disk is frtm SAN petple theio we will iioftrm tt them abtgut the replacemeiot tf the
disk. If it is iioterioal disk theio we raise the CRQ tt replace the disk.
(d). Ftr this we will ctiosidered twt thiiois.
(i). whether the system is withiio the warraioty.
(ii). withtgut warraioty.
(e). We will directly call tt the ttll free iot. tf the system eiodtr aiod raise the tcket. They will
issgue the case iot. This is the iot. we ha e tt meiottio iio all ctrresptiodeioces tt eiodtr
reiardiioi this issgue.
(f). If it is ha iioi warraioty they asks rack iot. system iot. aiod tther details aiod replace the hard
disk with ct- trdiioate tf the data ceiotre petple.
(i). If it is iott ha iioi warraioty we ha e tt stl e the prtblem by tgur twio tr re-aireemeiot tt
exteiod the warraioty aiod stl e that prtblem.
28. How to replace the processor?
(a). Check the prtcesstr's statgus gusiioi # lscpu tr # dmidecode -t processor ctmmaiods.
(b). If it shtws aioy errtrs theio we ha e tt replace the prtcesstr.
(c). Theio raise the case tt eiodtr by ttll free iot. with hiiher aguthtrites permissitio.
(d). The eiodtr will ii e case iot. ftr fgutgure refereioces.
(e). They alst asks rack iot. system iot. tf the data ceiotre ftr prtcesstr replacemeiot.
(f). We will iioftrm tt the Data ceiotre petple tt ct-trdiioate with eiodtr.
29. How replace the failed memory modules?
Causes :
(a). The system is ctiotiogutgusly rebtttioi .
(b). Wheio iio peak bgusiioess htgurs if the hea y applicattios are rguioioiioi the system iet paioic
aiod rebttted. This is repeatioi reigularly.
Solution :
(a). First we check htw mguch RAMB preseiot iio the system with # dmidecode -t memory
ctmmaiod.
(b). Theio we raise the case tt eiodtr with the help tf hiiher aguthtrites.
(c). Theio the eiodtrs will prt ide the case iot. ftr fgutgure refereioce.
(d). They will alst asks rack iot. system iot. tt replace the memtry.
(e). we will iioftrm the data ceiotre petple tt ct-trdiioate with the eiodtr.
30. What is your role in DB patching?
Iio Database patchiioi the ftlltwiioi teams will be iio tl ed.
(i). Database Admiioistrattr (D A). team.
(ii). Liiogux Admiioistrattrs team.
(iii). MBtioittriioi team.
(i ). Applicattio team.
(i). DBA team :
This is the team tt apply the patches tt the databases.
(ii). Linux team :
This team is alst iio tl ed if aioy prtblems tccgur. If the database tlgume is ha iioi a mirrtr
we shtguld frst break the mirrtr aiod theio the D A petple will apply the patches. Afer 1 tr
2 days there is iot prtblem aiaiio we ioeed syioc the data betweeio mirrtred tlgume tt
patch applied tlgume. If there is iot space ftr patch we ha e tt prt ide space tt
D A team.
(iii).Monitoring team :
This team shtguld recei e reqguests tr sguiiesttios tt iiiotre aioy prtblems tccgurs. Afer
applied the patch if the system is aguttmatcally rebttted theio mtioittriioi team will
raise the tcket "Ntde dtwio" tt system admiioistrattrs team. St tt a tid
thtse type tf tckets we ha e tt seiot reqguests tt iiiotre thtse type alerts.
(i ).Application team :
Ftr applyiioi aioy patches the databases shtguld iott be a ailable tt applicattio. St if
sguddeioly database is iott a ailable theio applicattio may be crashed. St frst the
applicattio shtguld be sttpped. This will be dtioe by applicattio team.
31. What is SLA?
A ser ice-le el aireemeiot (SLA). is simply a dtcgumeiot describiioi the le el tf ser ice expected by
a cgusttmer frtm a sgupplier layiioi tgut the metrics by which that ser ice is measgured aiod the
remedies tr peioaltes if aioy shtguld the aireed-guptio le els iott be achie ed. Usgually SLAs are
betweeio ctmpaioies aiod exterioal sguppliers bgut they may alst be betweeio twt departmeiots
withiio a ctmpaioy.
32. What is Problem Management?
The tbject e tf Prtblem MBaioaiemeiot is tt miioimise the impact tf prtblems tio the
triaioisattio. Prtblem MBaioaiemeiot plays aio imptrtaiot rtle iio the detecttio aiod prt idiioi
stlguttios tt prtblems (wtrk artguiod& kiotwio errtrs). aiod pre eiots their retccgurreioce.
A 'Prtblem' is the guiokiotwio caguse tf tioe tr mtre iiocideiots tfeio ideiotfed as a resgult tf
mgultple similar
iiocideiots.A 'Kiotwio errtr' is aio ideiotfed rttt caguse tf a Prtblem.
33. What is Incident Management?
Aio 'Iiocideiot' is aioy e eiot which is iott part tf the staiodard tperattio tf the ser ice aiod which
caguses tr may caguse aio iioterrgupttio tr a redgucttio tf the qguality tf the ser ice.
The tbject e tf Iiocideiot MBaioaiemeiot is tt resttre iotrmal tperattios as qguickly as ptssible
with the least ptssible impact tio either the bgusiioess tr the guser at a ctst-efeect e price.
Iiopguts ftr Iiocideiot MBaioaiemeiot mtstly ctme frtm gusers bgut caio ha e tther stgurces as well
like maioaiemeiot Iioftrmattio tr Detecttio Systems. The tgutpguts tf the prtcess are RFC’s
(Reqguests ftr Chaioies). restl ed aiod cltsed Iiocideiots maioaiemeiot iioftrmattio aiod
ctmmguioicattio tt the cgusttmer.
34. What is Change Management?
Chaioie maioaiemeiot is a systematc apprtach tt dealiioi with chaioie btth frtm the
perspect e tf aio triaioisattio aiod tio the iiodi idgual le el. chaioie maioaiemeiot has at least
three difeereiot aspects iioclgudiioi adaptioi tt chaioie ctiotrtlliioi chaioie aiod efeectioi
chaioie. A prtact e apprtach tt dealiioi with chaioie is at the ctre tf all three aspects.Iio aio
iioftrmattio techiotltiy (IT). system eio irtiomeiot chaioie maioaiemeiot refers tt a systematc
apprtach tt keepiioi track tf the details tf the system (ftr example what tperatioi
system release is rguioioiioi tio each ctmpguter aiod which fxes ha e beeio applied)..
35. What is Request Management?
ser ice reqguest maioaiemeiot (SRMB). is the guioderlyiioi wtrkftw aiod prtcesses that eioable aio IT
prtcguremeiot tr ser ice reqguest tt be reliably sgubmitted rtguted apprt ed mtioittred aiod
deli ered. SRMB is the prtcess tf maioaiiioi a ser ice reqguest thrtguih its lifecycle frtm
sgubmissitio thrtguih deli ery aiod ftlltw-gup.
SRMB may be maiogual tr aguttmated. Iio a maiogual system a guser calls a help desk tt reqguest a
ser ice aiod help desk perstioioel create a ser ice tcket tt rtgute the ser ice reqguest. Iio aio
aguttmated system the guser sgubmits a reqguest thrtguih aio tioliioe ser ice catalti aiod the
applicattio stfware aguttmatcally rtgutes the reqguest thrtguih the apprtpriate prtcesses ftr
apprt al aiod ser ice deli ery. These systems alst typically eioable gusers tt track the statgus tf their
ser ice reqguests aiod maioaiemeiot tt mtioittr ser ice deli ery le els ftr qguality ctiotrtl pgurptses.
36. What is grep?
(i). grep meaios Gltbally search ftr Reigular Expressitio.
(ii). Usiioi irep we caio flter the resgults tt iet a partcgular iioftrmattio.
(iii).We caio iet tioly iioftrmattio abtgut what striioi we ha e specifed iio irep ctmmaiod.
37. What are pipes and filters in Linux?
Pipes :
(a). Pipes are iotthiioi bgut addiioi twt ctmmaiods aiod make as tioe ctmmaiod.
(b). Ntrmally we caioiott ctmbiioe twt ctmmaiods bgut gusiioi pipes we iet tioe ctmmaiod by
ctmbiioiioi twt ctmmaiods.
(c). St we caio iet the resgults as what we reqguired.
Filters :
(a). Filters are iotthiioi bgut flteriioi the resgults what we reqguired.
(b). Usiioi flters we caio iet exact resgults depeiods guptio what we specifed iio the expressitio.
(c). St there is iot wastaie tf tme becaguse it flters resgults what we specifed iio the ctmmaiod
expressitio.
38. What is the full form of COMPUTER ?
C ----->Ctmmtioly
O -----> Operated
M -----> MBachiioe
P -----> Partcgularly
U ----->Used
T ----->Techioical aiod
E ----->Edgucattioal
R -----> Research
39. What is the command in sar to monitor NIC devices received/transmited packets?
# sar -io DEV 1 5
This will shtw 5 ctiosecgut e tgutpgut each with a tme iioter al tf 1 sec ftr all the etherioet
de ices
40. What is Linux Kernel?
It acts as aio iioterpreter betweeio Liiogux OS aiod its hardware. It is the fguiodameiotal ctmptioeiot tf
Liiogux OS aiod ctiotaiios hardware dri ers ftr the de ices iiostalled tio the system. The kerioel is a
part tf the system which ltads frst aiod it stays tio the memtry.
41. What are the main parameters efect on server performance?
The tioe tf the mtst imptrtaiot task tf aioy Liiogux Admiio iioclgudes perftrmaioce mtioittriioi which
iioclgudes a parameter "Load Average" tr "CPU Load".
42. What is load average?
Ltad A eraie is the algue which represeiots the ltad tio ytgur system ftr a specifc peritd tf
tme. Alst it caio be ctiosidered the ratt tf the iogumber tf act e tasks tt the iogumber tf
a ailable CPUs.
43. How to check?
We caio guse either ttp tr guptme ctmmaiod tt iew the tgutpgut tf the ltad a eraie as shtwio
beltw.
# guptme
00:07:00 gup 4 days 6:14 1 guser ltad a eraie: 0.11 0.14 0.09
# ttp
ttp - 00:07:12 gup 4 days 6:15 1 guser ltad a eraie: 0.09 0.13 0.09
44. What are the three values?
As ytgu caio see three algues represeiotioi the ltad a eraie ctlgumio. These shtw the ltad tio ytgur
system t er a siiioifcaiot peritd tf tme (tioe tr cgurreiot f e aiod ffeeio miiogutes a eraies)..
The mtst imptrtaiot qguesttio as iio mtst cases I ha e seeio htw dt ytgu determiioe ytgur system
has hiih ltad.
Does a high value represents high load average and that your system requires atentonn
What is the threshold value for load averagen
How can we conclude if the load average value is good or badn
A Ceiotral Prtcessiioi Uioit iio earlier days gused tt be ha iioi tioly tioe prtcesstr aiod the ctre
ctiocept was iott their iio thtse days. gut with the ad aiocemeiot iio techiotltiy aiod the gurie tf
hiiher speed tt meet gup demaiods tf IT iiodgustry mgultple prtcesstr were iioteirated iio the
same CPU makiioi it mgult-prtcesstr.
Htwe er iiocreasiioi the iot. tf prtcesstr did iiocreased the wtrkiioi speed tf maioy tasks aiod
perftrmaioce bgut it alst leads tt iiocrease iio sise ctmplexity aiod heat issgues. St iio trder tt
ctiotiogue imprt emeiot tf perftrmaioce the ctre ctiocept was iiotrtdguced.
Iiostead tf ha iioi twt CPUs aiod a mttherbtard capable tf htstioi them twt CPUS are takeio
ttiether aiod ctmbiioed tt ftrm a dgual ctre prtcesstr which will gutlise aio iiodi idgual stcket gusiioi
less ptwer aiod sise capable tf perftrmiioi the same amtguiot tf task as dgual prtcesstr CPU.
Botom Line is that Ltad algue depeiods tio the iot. tf ctres iio ytgur machiioe. Ftr example a dgual
ctre is rele aiot tt 2 prtcesstr tr 2 ctres aiod qguad ctre is rele aiot tt 4 prtcesstr tr ftgur ctres as
the maximgum algue ftr ltad.
46. How do I check the no. of cores on my Linux system?
The iioftrmattio which ytgu see guioder /Sprtc/Scpguiioft caio be ctiofgusiioi at tmes. If ytgu rguio the
beltw ctmmaiod
# less /Sprtc/Scpguiioft | irep prtcesstr
prtcesstr :0
prtcesstr :1
prtcesstr :2
prtcesstr :3
prtcesstr :4
prtcesstr :5
St as per the abt e ctmmaiod my system has 16 prtcesstrs iio it. Htwe er it really has 8
prtcesstrs with hyper threadiioi eioabled. The hyper threadiioi preseiots 2 ltiical CPUs tt the
tperatioi system ftr each actgual ctre st it efeect ely dtgubles the iot. tf ltiical CPU iio ytgur
system.
47. How to find if hyper threading is enabled
Lttk tgut ftr "ht" iio the fais secttio iioside cpguiioft with the beltw ctmmaiod
# less /Sprtc/Scpguiioft | irep fais | guioiq | irep -i "ht"
flags : fpgu me de pse tsc msr pae mce cx8 apic sep mtrr pie mca cmt pat pse36 clfgush dts
acpi mmx fxsr sse sse2 ss ht tm syscall iox rdtscp lm ctiostaiot_tsc iotiosttp_tsc pioi mtioittr
ds_cpl mx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 ptpciot lahf_lm.
The felds we ioeed tt ctmpare tt fiod the iot. tf ctre are "physical id" aiod "core id". Rguio the
beltw ctmmaiod
# less /Sprtc/Scpguiioft | irep "physical id" | strt|guioiq | wc -l
2
# less /Sprtc/Scpguiioft | irep "ctre id" | strt|guioiq | wc -l
4
St the iot. tf ctres wtguld be 2x4 = 8 cores.
48. What do you understand the Load Average?
If the iogumber tf act e tasks gutlisiioi CPU is less as ctmpared tt a ailable CPU ctres theio the
ltad a eraie caio be ctiosidered iotrmal bgut if the iot. tf act e tasks starts iiocreasiioi with
respect tt a ailable CPU ctres theio the ltad a eraie will start risiioi.For example,
# guptme
00:43:58 gup 212 days 14:19 4 gusers ltad a eraie: 6.07 7.08 8.07
49. How to check all the current running services in Linux?
To find the status of any single service :
# ser ice sfpd statgus
sfpd (pid 5909). is rguioioiioi...
To get the status of all the running services :
# ser ice --statgus-all | irep rguioioiioi
acpid (pid 5310). is rguioioiioi...
atd (pid 6528). is rguioioiioi...
aguditd (pid 5012). is rguioioiioi...
A ahi daemtio is iott rguioioiioi
A ahi DNS daemtio is iott rguioioiioi
The Peiasgus CIMB Listeioer is rguioioiioi.
The Peiasgus CIMB Object MBaioaier is rguioioiioi.
crtiod (pid 6242). is rguioioiioi...
dcerpcd (pid 5177). is rguioioiioi...
e eiotltid (pid 5223). is rguioioiioi...
In case you don't use grep you will be able to see all the services on your machine :
# ser ice --statgus-all
NetwtrkMBaioaier is sttpped
acpid (pid 5310). is rguioioiioi...
aioacrtio is sttpped
atd (pid 6528). is rguioioiioi...
aguditd (pid 5012). is rguioioiioi...
aguttmtguiot is sttpped
A ahi daemtio is iott rguioioiioi
A ahi DNS daemtio is iott rguioioiioi
hcid is sttpped
sdpd is sttpped
You can also check the active ports along with their services using :
# ioetstat -iotlp
Act e Iioterioet ctioioecttios (tioly ser ers).
Prtttctl Rec -Q Seiod-Q Ltcal Address Ftreiiio Address State
PID/SPrtiram ioame
tcp 0 0 0.0.0.0:52961 0.0.0.0:* LISTEN
5223/Se eiotltid
tcp 0 0 0.0.0.0:5988 0.0.0.0:* LISTEN
6116/Scimser er
tcp 0 0 0.0.0.0:5989 0.0.0.0:* LISTEN 6116/Scimser er
tcp 0 0 0.0.0.0:678 0.0.0.0:* LISTEN 5160/Srpc.statd
tcp 0 0 0.0.0.0:14247 0.0.0.0:* LISTEN 6460/Sja a
tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN
5857/Ssiompd
tcp 0 0 0.0.0.0:135 0.0.0.0:* LISTEN 5177/Sdcerpcd
50. How do you check Linux machine is Physical or Virtual remotely?
There is iot hard aiod fast rgule tt check whether the machiioe is physical tr irtgual bgut stll we dt
ha e stme ctmmaiods which caio be gused ftr the same pgurptse.
The ctmmaiod gused tt iew all the reqguired hardware related iioftrmattio ftr aioy Liiogux
machiioe is
# dmidectde
gut the tgutpgut wtguld be ery ltioi aiod hard tt fiod tgut the specifc details lttkiioi ftr. St let's
ioarrtw it dtwio.
Physical Servers:
# dmidectde -s system-prtdguct-ioame
System x3550 MB2 -[7284AC1]-
Ntw tt iet mtre details abtgut the system
# dmidectde | less (Aiod search ftr "System Iioftrmattio").
System Iioftrmattio
MBaiogufactgurer: I MB
Prtdguct Name: System x3550 MB2 -[7284AC1]-
Versitio: 00
Wake-gup Type: Other
SKU Ngumber: XxXxXxX
Family: System x
Virtual Servers :
# dmidectde -s system-prtdguct-ioame
VMBware Virtgual Plattrm
# dmidectde | less
System Iioftrmattio
MBaiogufactgurer: VMBware Iioc.
Prtdguct Name: VMBware Virtgual Plattrm
Versitio: Ntioe
Wake-gup Type: Ptwer Switch
SKU Ngumber: Ntt Specifed
Family: Ntt Specifed
On a virtual server running VMware you can run the below command to verify :
# lspci | irep -i mware
00:0f.0 VGA ctmpatble ctiotrtller: VMBware SVGA II Adapter
51. How to find the bit size of your linux machine?
# guioame -m
i686
# guioame -m
x86_64
If we iet i386 i586 aiod i686 that siiioifes ytgur machiioe is 32-bit bgut if we
ietx86_64 tr ia64 theio ytgur machiioe will be 64-bit.
# ietctiof LONG_ IT
32
# ietctiof LONG_ IT
64 (Here we iet aio tgutpgut tf bit sise either 32 tr 64).
52. How can you add a banner or login message in Linux?
y editioi these twt fles
/Setc/Sissgue
/Setc/Smttd
53. What is the diference between normal kernel and kernel-PAE?
kerioel iio 32 bit machiioe sgupptrts max tf 4 G RAMB whereas
kerioel PAE iio 32 bit liiogux machiioe sgupptrts tll 64 G RAMB
54. Tell me the command to find all the commands in your linux machine having only 2 words like
ls, cp, cd etc.
# fiod /Sbiio /Ssbiio/Sgusr/Sbiio /Sgusr/Ssbiio -ioame ?? -type f
55. Which file is generally used to configure kickstart?
aioactioda.cfi
56. Which log file will you check for all authentication related messages?
/S ar/Slti/Ssecgure
57. What is the command used to find the process responsible for a particular running file?
# fguser fleioame
# lstf fleioame
58. What is the command to take remote of any Linux machine?
# rdeskttp
59. What are the three values shown in load average section of top command?
It shtws the cgurreiot 5 miio back aiod 15 miio back ltad a eraie algue.
60. How to check all the process running by a particular user?
# ps -gu<guserioame>
61. What is an orphan process?
Aio trphaio prtcess is a prtcess that is stll execgutioi bgut whtse pareiot has died.
62. What is a defunct process?
These are alst termed as stmbie prtcess. These are thtse prtcess wht ha e ctmpleted their
execguttio bgut stll has aio eiotry iio the prtcess table. Wheio a prtcess eiods all tf the memtry
aiod restgurces asstciated with it are de-alltcated st they caio be gused by tther prtcesses.Afer
the stmbie is remt ed its prtcess ideiotfer (PID). aiod eiotry iio the prtcess table caio theio be
regused.
Ztmbies caio be ideiotfed iio the tgutpgut frtm the Uioix ps ctmmaiod by the preseioce tf a "Z" iio
the "STAT" ctlgumio
63. How do you limit maximum connections in your apache server?
Chaioie the beltw parameter algue iioside httpd.ctiof
MBaxClieiots 256
64. Which command do you use to download a file from fp or htp website using CLI?
# wiet path_tt_the_fle
65. What is the default port for ssh? How will you change it to some other random port no.?
SSH ptrt iot. by defagult is 22. Tt chaioie the defagult ptrt iot. we ioeed make reqguired chaioies
iioside sshd_ctiofi fle iio the beltw meiottioed liioe
#Port 22 (Uioctmmeiot the abt e liioe aiod defioe the ioew ptrt iot).
Restart the ser ices ftr chaioies tt take efeect.
66. What is the diference between A record and CNAME record in DNS?
A record :
It is the Address rectrds alst kiotwio as htst rectrds
Ptiiots tt the IP address refectioi the dtmaiio
Used ftr ftrward lttkgup tf aioy dtmaiio ioame
For example:
Ogur website is ctiofigured tio 50.63.202.15 IP st the A rectrd tf my dtmaiio ioame will ptiiot
ttwards that IP.
E ery tme a qguery ftr itliioguxhgub.ctm is made the iioterioet will lttkgup ftr ctioteiots sttred tio
the machiioe with 50.63.202.15 this IP.
CNAME Record :
(d). Type the Rttt passwtrd aiod Re-type the same tt ctiofrm the rttt passwtrd.
(e). Select the Tariet Architectgure (x86_64 tr 32 bit).
(i ). Installation Method is the sectiod tpttio.
(a). Iiostallattio MBethtd. (Select aioy tioe tpttio).
(1). Perftrm New Iiostallattio
(2). Upirade aio existioi iiostallattio
(b). Iiostallattio Stgurce. (Select aioy tioe
tpttio).
(1). CD-ROMB/SDVD
(2). NFS
(3). FTP
(4). HTTP
(5). Hard Dri e
( ). Boot Loader options is the ioext tpttio iio kickstart ctiofigurattio.
(a). Select Install New Boot Loader tpttio.
( i). Partition Information is the ioext tpttio.
(a). MBaster ttt Rectrd (Select aioy tioe
tpttio).
(1). Create MBaster ttt Rectrd
(2). Dt iott create MBaster ttt Rectrd
(b). Partttios (Select aioy tioe
tpttio).
(1). Remt e all existioi partttios
(2). Remt e existioi Liiogux partttios
(3). Preser e existioi partttios
(c). Disk Label (Select aioy tioe
tpttio).
(1). Iioitalise the disk label
(2). Dt iott iioitalise the disk label
(d). Select Add bgutttio aiod select MBtguiot ptiiot File system type aiod Sises tt create the
partttios.
( ii). Network Configuration is the ioext tpttio.
(a). Select Add Network Device tt add the NIC de ice ctiofigure the IP address either
DHCP tr Statc aiod select eioable the NIC at bttt tme tr iott.
( iii). Authentication is the ioext tpttio.
Select the agutheiotcattio mechaioism like Shadtw passwtrds NIS LDAP tr Kerberts...
etc.
(ix). Firewall Configuration is the ioext tpttio.
Select whether act ate the SELiiogux tr iott Secgurity Le el aiod Firewall Iioftrmattio.
(x). Display Configuration is the ioext tpttio.
Select the display ctiofigurattio tf the O/SS either GUI tr CLI mtde.
(xi). Package Selection is the ioext tpttio.
Select the reqguired packaies ftr iiostallattio. (we caioiott select the
packaies iio RHEL - 7).
(xii). aiod (xiii). Pre-Installation Scripts aiod Post-Installation Scripts are the last tpttios.
If we ha e aioy Pre-iiostallattio tr Ptst-iiostallattio scripts theio we ha e tt specify the
ltcattios tf thtse.
(xi ). Sa e this fe by select the Save tpttio iio File meiogu.
(x ). Exit frtm the Kickstart Ctiofigurattio wiiodtw by select the Quit tpttio iio File meiogu.
(x i). Opeio the kickstart fle aiod the defagult kickstart fle at tme by the ftlltwiioi ctmmaiod.
# vim -O <kickstart file><anaconda file>
Gt tt packaie secttio iio aioactioda fle ctpy the select the packaies aiod paste them iio
the kickstart fle.
(x ii). Check the kickstart fle ftr syiotax errtrs by # ksvalidator <kickstart file> ctmmaiod.
(x iii). Iiostall the webser er packaie by # yum install htpd* -y ctmmaiod.
(xix). Ctpy the kickstart fle iio Dtcgumeiot Rttt tf the webser er aiod preser er the permissitios.
# cp -p <kickstart file> /var/www/html/
(xx). Restart the webser er deamtios iio RHEL - 6 aiod RHEL - 7.
# service htpd restart (tt restart the webser er deamtio iio RHEL - 6).
# chkconfig htpd on (tt eioable the webser er deamtio at ioext
bttt iio RHEL - 6).
# systemctl restart htpd (tt restart the webser er deamtio iio RHEL -
7).
# systemctl enable htpd (tt eioable the webser er deamtio at ioext
bttt iio RHEL - 7).
(xxi). Add the webser er ser ice tt IPtables aiod Firewall.
In RHEL - 6 :
# setup
Select Firewall ctiofigurattio -----> Select HTTP aiod HTTPS tt the frewall
# service iptables save
# service iptables restart
# chkconfig iptables on
In RHEL - 7 :
# firewall-cmd --permanent --add-service=htp
# firewall-cmd --permanent --add-service=htps
# firewall-cmd --complete-reload
4. How to install on client system using kickstart file?
(i). ttt the clieiot system gusiioi RHEL - 6 DVD aiod press Esc key.
(ii). Theio it prtmpts gus boot : screeio.
(iii). Type the ftlltwiioi iioftrmattio abtgut the kickstart fle its ser er aiod alst assiiio stme IP
address tt the clieiot system tt ctmmguioicate with kickstart ser er.
boot : linux ip=< IP address to the client> netmask=<netmask of that IP> ks=fp://< IP
address of the kickstart server>/<kickstart file name with full path>
(press Eioter key).
* Theio the iiostallattio will ctiotiogue by takiioi the iiostallattio iioftrmattio frtm the kickstart
fle.
5. In how many ways can we install RedHat Linux through network?
(i). FTP
(ii). NFS
(iii). HTTP
(i ). PXE
6. How to install RedHat Linux though FTP?
(i). First ctiofigure the FTP ser er aiod ctpy the eiotre RedHat Liiogux DVD iio that FTP dtcgumeiot
rttt directtry.
(ii). Iiostallattio tf Liiogux thrtguih ioetwtrk reqguires tioe boot.iso imaie tr RHEL DVD.
To make a DVD/Pendrive bootable using boot.iso image :
(a). Dtwioltad the bttt.ist imaie frtm redhat website.
# cdrecord /root/boot.iso (/Srttt/Sbttt.ist is the path tf
bttt.ist imaie).
(b). Ctpy the bttt.ist imaie iiott DVD tr peiodri e.
# dd if=/root/boot.iso of=/dev/sdb1 (/Sde /Ssdb1 is the address tf the
US tr peiodri e).
(iii). ttt the system with the abt e created bttt.ist imaie aiod press Esc key tt iet the
boot : prtmpt.
(i ). Theio execgute the beltw ctmmaiod tt iiostall the O/SS.
boot : linux askmethod (Press Eioter key).
( ). Select the preferred laioiguaie ftr iiostallattio (ftr example Eioilish)..
( i). Select the Keybtard laytgut as US.
( ii). Select the urltpttio ftr the iiostallattio media (ftr example FTP/SNFS/SHTTP)..
( iii). Select IP 4 tr IP 6 tt defioe ioetwtrk setiois aiod select dyioamic tr statc tpttios.
(ix). Assiiio the same raioie IP address aiod ioetmask tt the clieiot system tt ctmmguioicate
with ser er.
(x). Theio specify the FTP ser er IP address aiod path tf the iiostallattio media tt iiostall the
O/SS.
7. How to install RedHat Linux through NFS?
(i). MBake aio eiotry iio /Setc/Sexptrts tt exptrt the RHEL media.
# vim /etc/exports
<iiostallattio media directtry> <ioetwtrk ID>(rw syioc). (sa e aiod
exit this fle).
Example :
/S ar/Sfp/Spgub/Srhel6 172.25.9.0(rw syioc). (If the iiostallattio media is iio
/S ar/Sfp/Spgub/Srhel6).
(ii). Exptrt the abt e NFS shared directtry by # exportfs -rv ctmmaiod.
(iii). Theio restart the NFS ser ice by # service restart nfs ctmmaiod aiod add the NFS tt
IPtables tr frewall.
(i ).Iiostallattio tf Liiogux thrtguih ioetwtrk reqguires tioe boot.iso imaie tr RHEL DVD.
To make a DVD/Pendrive bootable using boot.iso image :
(a). Dtwioltad the bttt.ist imaie frtm redhat website.
# cdrecord /root/boot.iso (/Srttt/Sbttt.ist is the path tf
bttt.ist imaie).
(b). Ctpy the bttt.ist imaie iiott DVD tr peiodri e.
# dd if=/root/boot.iso of=/dev/sdb1 (/Sde /Ssdb1 is the address tf the
US tr peiodri e).
( ). ttt the system with the abt e created bttt.ist imaie aiod press Esc key tt iet the boot
: prtmpt.
( i). Theio execgute the beltw ctmmaiod tt iiostall the O/SS.
boot : linux askmethod (Press Eioter key).
( ii). Select the preferred laioiguaie ftr iiostallattio (ftr example Eioilish)..
( iii). Select the Keybtard laytgut as US.
(ix). Theio select the NFS directory tpttio aiod specify the NFS ser er IP address aiod NFS
shared directtry aiod the iiostallattio will be dtioe.
8. How to install the RedHat Linux through HTTP?
(i). First iiostall the http webser er by # yum install htpd* -y ctmmaiod.
(ii). Ctpy the eiotre RHEL DVD ctioteiots iiott /var/www/html/rhel6 by
# cp -rvpf /media/RHEL/*.* /var/www/html/rhel6
(iii). If iott ptssible tt dt the abt e step2 theio create a liiok betweeio the /S ar/Sfp/Spgub/Srhel6
aiod /S ar/Swww/Shtml by # ln -s /var/fp/pub/rhel6
/var/www/html/rhel6 ctmmaiod.
(i ). Restart the http ser ices aiod add it tt the frewall.
In RHEL - 6 :
# service htpd restart (tt restart the http ser ice iio RHEL -
6).
# chkconfig htpd on (tt eioable the http ser ice at ioext
bttt iio RHEL - 6).
# setup (thrtguih the setgup ctmmaiod add the http ser ice
tt the IP tables).
# service iptables save (tt sa e the iptables ctiofigurattio).
# service iptables restart (tt restart the iptables ser ice).
In RHEL - 7 :
# systemctl restart htpd (tt restart the http ser ice iio RHEL -
7).
# systemctl enable htpd (tt eioable the http ser ice at ioext
bttt iio RHEL - 7).
# firewall-cmd --permanent -add-service=htp (tt add the http ser ice tt the
frewall iio RHEL - 7).
# firewall-cmd -complete-reload (tt reltad the frewall ctiofigurattio).
( ). Iiostallattio tf Liiogux thrtguih ioetwtrk reqguires tioe boot.iso imaie tr RHEL DVD.
To make a DVD/Pendrive bootable using boot.iso image :
(a). Dtwioltad the bttt.ist imaie frtm redhat website.
# cdrecord /root/boot.iso (/Srttt/Sbttt.ist is the path tf
bttt.ist imaie).
(b). Ctpy the bttt.ist imaie iiott DVD tr peiodri e.
# dd if=/root/boot.iso of=/dev/sdb1 (/Sde /Ssdb1 is the address tf the
US tr peiodri e).
( i). ttt the system with the abt e created bttt.ist imaie aiod press Esc key tt iet the
boot : prtmpt.
( ii). Theio execgute the beltw ctmmaiod tt iiostall the O/SS.
boot : linux askmethod (Press Eioter key).
( iii). Select the preferred laioiguaie ftr iiostallattio (ftr example Eioilish)..
(ix). Select the Keybtard laytgut as US.
(x). Select the urltpttio ftr the iiostallattio media aiod specify the http tr https IP address
aiod ltcattio.
Example :
http tr https:/S/S172.25.9.11/Srhel6
(xi). Theio iiostallattio tf RedHat Liiogux will be dtioe thrtguih HTTP.
9. What is PXE installation and what are it's requirements?
Aguttmatc Iiostallattio tf RHEL frtm the Netwtrk is called PXE iiostallattio. This is alst called
as guio-atteioded
iiostallattio. The meaios iotbtdy iioteracttio is reqguired iio the iiostallattio prtcess.
PXE staiods ftr Pre Execution. The PXE dtes iott reqguires a RHEL DVD tr aioy bttt.ist
imaie.
The requirements for PXE server :
(i). Statc ioetwtrk at ser er side.
(ii). DHCP ser er shtguld be ctiofigured tio the ser er.
(iii). FTP ser er shtguld be ctiofigured tio the ser er.
(i ). Ygum ser er shtguld be ctiofigured tio the ser er.
( ). TFTP ser er shtguld be ctiofigured tio the ser er.
( i). Create the kickstart iiostallattio fle.
* If all the abt e 5 ser ers are ctiofigured iio tioe ser er that ser er shtguld be called as PXE
ser er.
10. How to configure the PXE server and how to install RedHat from PXE server?
(a). Pgut the RHEL - 6 DVD iiott the DVD dri e aiod it tt Packaies directtry.
# cd /media/RHEL6/Packages
(b). Iiostall the sfpd packaie tt ctiofigure the FTP ser er.
# rpm -ivh vsfpd*
(c). Ctpy the eiotre RHEL - 6 DVD ctioteiots iiott the /S ar/Sfp/Spgub/Srhel6 directtry.
# cp -rvpf /media/RHEL6/*.* /var/fp/pub/rhel6
(d). Restart eioable the fp ser ice at ioext bttt add the ser ice tt IP tables aiod restart the
IP tables.
# service vsfpd restart
# chkconfig vsfpd on
# iptables -A INPUT -m state --state NEW -m tcp -p tcp --deport 21 -j ACCEPT
# iptables -A OUTPUT -m state --state NEW -m tcp -p tcp --deport 21 -j
ACCEPT
# iptables -A INPUT -m state --state NEW -m tcp -p tcp --deport 20 -j ACCEPT
# iptables -A OUTPUT -m state --state NEW -m tcp -p tcp --deport 20 -j
ACCEPT
# service iptables save
# service iptables restart
# chkconfig iptables on
(e). Ctiofigure the ioetwtrk as statc by # setup ctmmaiod aiod restart the ioetwtrk aiod
NetwtrkMBaioaier.
(f). Ctiofigure the ygum ser er.
# vim /etc/yum.repos.d/linux.repo
[liiogux]
ioame=Liiogux ygum ser er
basegurl=fp:/S/S172.25.9.11/Spgub/Srhel6 (Specify the FTP
ser er IP address).
ipicheck=0
eioabled=1 (sa e aiod
exit the fle).
# yum clean all
# yum repolist
(i). Ctiofigure the DHCP ser er.
# yum install dhcp* -y
# cp -rvpf /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
# vim /etc/dhcp/dhcpd.conf
Gt tt liioe iogumber 47 aiod edit the liioe as beltw.
(d). vxrecoverd :
(i). It passes the ltst data iiott ioew disk.
(ii). It alst iottfy tt the Admiioistrattrs gusiioi (by). xiottfyd deamtio.
(e). vxnotifyd :
(i). It iottfy tt the guser (Admiioistrattr). abtgut failed disks aiod afer rect ery alst it iottfy tt
the Admiioistrattr.
3. How to create the root mirror?
(i). riioi the disk frtm O/SS tt Veritas Vtlgume MBaioaier ctiotrtl gusiioi the Veritas Ad aioced
MBaioaiemeiot tttl # vxdiskadm ctmmaiod (It ii es (displays). tpttios ftr easy
admiioistrattio tf Veritas Vtlgume MBaioaier)..
(ii). Select 2iod tpttio ie. Eiocapsgulattio becaguse tt preser e the existioi data preseiot iio the
disk aiod rebttt the system tt efeect Eiocapsgulattio aiod mtdify the /etc/sysconfig
fle. While Eiocapsgulatioi it asks disk ioame aiod disk irtgup (rttt disk ioame aiod rtttdi)..
(iii). ackgup the / (rttt). /etc/sysconfig directtries.
(i ). Take aiotther disk aiod iioitalise it by # vxdisksetup -i <mirrored root disk name>
ctmmaiod.
( ). Add the abt e iioitalised disk tt the tlgume irtgup ie. rttdi by
# vxdg -g <rootdg> adddisk mirrordisk=<mirrored root disk name>
( i). xmirrtr - -i <rtttdi><triiiioal disk ioame><mirrtred rttt disk ioame> (disk le el
mirrtriioi).
( ii). Ftr iiodi idgual mirrtriioi # vxassist -g <rootdg> mirror <volume name> tr
# vxrootmirr -g <rootdg><volume name> ctmmaiod.
7. Which the main configuration file for VCS (Veritas Cluster) and where it is stored?
' main.cf ' is the maiio ctiofigurattio fle ftr VCS aiod it is ltcated iio
/etc/VRTSvcs/conf/config directtry.
8. What is the public region and private region?
wheio we briioi the disk frtm O/SS ctiotrtl tt Vtlgume MBaioaier ctiotrtl iio aioy ftrmat (either
CDS simple tr sliced). the disk is ltiically di ided iiott twt parts.
(a). Private region :
It ctiotaiios Veritas ctiofigurattio iioftrmattio like disk type aiod ioame disk irtgup ioame
irtgupid aiod ctiofidb. The defagult sise is 2048 K .
(b). Public region :
It ctiotaiios the actgual guser's data like applicattios databases aiod tthers.
9. There are five disks on VxVM (Veritas Volume Manager) and all are failed. What are the
steps you follow to get those disks into online?
(i). Check the list tf disks iio Vtlgume maioaier ctiotrtl by # vxdisk list ctmmaiod.
(ii). If the abt e disks are iott preseiot theio briioi them O/SS ctiotrtl tt VxVMB ctiotrtl by
# vxdisksetup -i <disk names> (if data is iott tio thtse disk). tr execgute
# vxdiskadm ctmmaiod aiod select 2iod tpttio ie. eiocapsgulattio methtd if the disks
ha iioi the data.
(iii). E eio thtguih If it is iott ptssible theio check the disks are a ailable at O/SS le el by # fdisk
-l ctmmaiod.
(a). If the disks are a ailable execgute the abt e ctmmaiod tioce aiaiio.
(b). If the disks are iott a ailable theio rectiioise them by scaioioiioi the hardware.
(i ). E eio thtguih if it is iott ptssible theio rebttt the system aiod ftlltw the steps (i). aiod (ii)..
10. What is the basic diference between private disk group and shared disk group?
Private disk group :
The disk irtgup is tioly isible ftr the htst tio which we ha e created it. If the htst is a part tf
the clguster the pri ate disk irtgup will iott be isible tt the tther clguster iotdes.
Shared disk group :
The disk irtgup is sharable aiod isible tt the tther clguster iotdes.
11. How will you create private disk group and shared disk group?
# vxdg init <disk group name><disk media name>=<O/S disk name> (tt create the
pri ate disk irtgup).
# vxdg -s init <disk group name><disk media name>=<O/S disk name>(tt create the shared
disk irtgup).
12. How will you add new disk to the existing disk group?
we caio dt this iio twt ways.
(i). Rguio # vxdiskadm ctmmaiod which will tpeio meiogu dri eio prtiram tt dt aritgus disk
tperattios. Select add disk tpttio aiod ii e disk irtgup ioame aiod disk ioame.
(ii). # vxdg -g <disk group name> adddisk <disk media name>=<O/S disk name>
Example: # xdi -i appsdi adddisk disk02=/Sde /Ssdb
13. How will you grow or shrink the volume/file system? What is the meaning of grow by, grow
to, shrink by and shrink to options?
(i). We caio irtw the tlgume/Sfle system by
# xassist -i appsdi irtwby tr irtwtt 100G apps tl (tr).
18. Define LLT and GAB. What are the commands to create them?
LLT :
(i). LLT meaios Ltw Lateiocy Traiosptrt prtttctl
(ii). It mtioittr the kerioel tt kerioel ctmmguioicattio.
(iii). It maiiotaiio aiod distribgute the ioetwtrk trafc withiio the clguster.
(i ). It guses heartbeat betweeio the iioterfaces.
GAB :
(i). GA meaios Gltbal Attmic rtadcastioi.
(ii). It maiiotaiio aiod distribgute the ctiofigurattio iioftrmattio tf the clguster.
(iii). It guses heartbeat betweeio the disks.
Commands :
# iabctiofi -a (tt check the statgus tf the GA ie. GA is
rguioioiioi tr iott).
If ptrt ' a ' is listeioiioi meaios GA is rguioioiioi ttherwise GA is iott rguioioiioi.
If ptrt ' b ' is listeioiioi meaios I/SO feiociioi is eioabled ttherwise I/SO feiociioi is
disabled.
If ptrt ' h ' is listeioiioi meaios had deamtio is wtrkiioi ttherwise had deamtio is
iott wtrkiioi.
# iabctiofi -c io 2 (tt start the GA iio 2 systems iio the clguster where
2 is seed iot.).
# iabctiofi -gu (tt sttp the GA ).
# cat /Setc/Siabtab (tt see the GA ctiofigurattio iioftrmattio aiod the it
ctiotaiios as ).
iabctiofi -c io x (where x is a iot. ie. 1 2 3 ....etc. ).
# lltctiofi -a (tt see the statgus tf the llt).
# lltctiofi -c (tt start the llt).
# lltctiofi -gu (tt sttp the llt).
# lltstat -io (tt see the trafc statgus betweeio the iioterfaces).
# llttab -a (tt see the clguster ID).
# haclgus -display (tt see all the iioftrmattio tio the clguster).
# cat /Setc/Sllttab (tt see the llt ctiofigurattio aiod the eiotries are as ).
Clguster ID htst ID iioterface MBAC address ...etc.
# cat /Setc/Sllthtsts (tt see the iot. tf iotdes preseiot iio the clguster).
19. How to check the status of the Veritas Cluster?
# hastatgus -sgummary
20. Which command is used to check the syntax of the main.cf?
# hacf - erify /Setc/SVRTS cs/Sctiof/Sctiofi
21. How will you check the status of the individual resources of Veritas Cluster (VCS)?
# hares -state <restgurce ioame>
22. What is the use of # hagrp command?
# hairp ctmmaiod is gused dtiioi admiioistrat e acttios tio ser ice irtgups like tio-liioe ser ice
irtgup tfe-liioe ser ice irtgup aiod switch ...etc.
23. How to switch over the service group?
# hairp -switch <System A><System >
24. How to online the service group in VCS?
# hairp -tioliioe <ser ice irtgup ioame> -sys <System A>
25. What are the steps to follow for switch over the application from System A to System B?
(i). First guiomtguiot the fle system tio System A.
(ii). Sttp the tlgume tio System A.
(iii).Deptrt the disk irtgup frtm System A.
(i ). Imptrt the disk irtgup tt aiotther System .
( ). Start the tlgume tio System .
( i). Fiioally mtguiot the fle system tio System .
26. How many types of clusters available?
(i). Hybrid Clguster.
(ii). Parallel Clguster.
(iii). Failt er Clguster.
27. What is meant by seeding?
Ntrmally we will defioe htw maioy iotdes tt start iio a clguster while btttioi tr explicitly by
execgutioi
# gabconfig -c n 2 ctmmaiod. Here 2 meaios 2 seeds tt start iio a clguster. This iot. is
called seediioi.
28. What is Split brain issue in VCS and how to resolve this?
A Split braiio issgue meaios mgultple systems guse the same exclgusi e restgurces aiod gusgually
resgultioi iio data ctrrgupttio.
Ntrmally VCS is ctiofigured with mgultple iotdes aiod are ctmmguioicates with each tther.
Wheio ptwer ltss tr system crashed the VCS assgumes the system has failed aiod tryiioi tt mt e
ser ice irtgup tt tther system tt maiiotaiio hiih a ailability. Htwe er ctmmguioicattio
(heartbeat). caio alst failed dgue tt ioetwtrk failgures.
If ioetwtrk trafc (ctioioecttio). betweeio aioy twt irtgups tf systems fail simgultaioetgusly a
ioetwtrk partttio tccgurs. Wheio this happeio systems tio btth sides tf the partttio caio restart
the applicattios frtm the tther side ie. resgultioi iio dguplicate ser ices. St the mtst seritgus
prtblem cagused by this aiod efeects the data tio shared disks.
This split braiio issgue iotrmally tccgurs iio VCS 3.5 tt VCS 4.0 ersitios. gut frtm VCS 5.0
tiowards the I/SO feiociioi (ioew featgure). is iiotrtdguced tt miioimise the split braiio issgue. If I/SO
feiociioi is eioabled iio a clguster theio we caio a tid the split braiio issgue.
29. What is Admin wait and Stale Admin wait?
ADMIN-WAIT :
If VCS is started tio system with a alid ctiofigurattio fle aiod tther systems are iio the ADMIN-
WAIT state The ioew system traiosittio tt the ADMIN-WAIT state (tr).
If VCS is started tio system with a stale ctiofigurattio fle aiod if tther systems are iio the
ADMIN-WAIT state the ioew system traiosittio tt the ADMIN-WAIT state.
STALE-ADMIN-WAIT :
The ctiofigurattio fles are iio read-tioly mtde. If aioy chaioies waiots tt make that fle as read-
write mtde. If aioy chaioies tccgurs iio ' main.cf ' fle iio clguster theio the chaioies are iio ' .stale '
hiddeio fle guioder ctiofigurattio directtry. While chaioies tccgurriioi if the system restarted tr
rebttted theio the clguster will start with ' .stale ' fle. St the VCS is started tio a system
with a stale ctiofigurattio fle the system statgus will be STALE- ADMIN-WAIT guiotl aiotther
system iio the clguster starts with a alid ctiofigurattio fle tr ttherwise execgute
# hasys -stale -force <system name> (tr). # hasys -force <system name> tt start
the system ftrcefgully with the ctrrect tr alid ctiofigurattio fle.
30. What is meant by resource and how many types?
Resource is a stfware tr hardware ctmptioeiot maioaied by the VCS.
MBtguiot ptiiots disk irtgups tlgumes IP addresses ....etc. are the Stfware ctmptioeiots.
Disks Iioterfaces (NIC cards). ....etc. are the Hardware ctmptioeiots.
There are twt types tf restgurces aiod they are
(i). Persisteiot Restgurces (we caio pgut them either tio-liioe tr tfe-liioe).
(ii). Ntio-Persisteiot Restgurces (we caio pgut tfe-liioe tioly).
If the restgurce is iio fagulted state theio clear the ser ice irtgup state. Restgurces cab be critcal
tr iotio-critcal. If the restgurce is critcal theio it aguttmatcally failt er if the restgurce is
failed. If the restgurce is Ntio-critcal theio it switch t er aiod we ha e tt maiogually switch t er the
restgurce irtgup tt aiotther a ailable system.
31. What are the dependencies between resources in a Cluster?
If tioe restgurce depeiods tio tther restgurce theio there is a depeiodeiocy betweeio thtse
restgurces.
Example : NIC (Netwtrk Iioterface Card). is hardware ctmptioeiot iotthiioi bgut hardware
restgurce. The IP address is a stfware ctmptioeiot iotthiioi bgut stfware restgurce aiod it
depeiods tio NIC card. The relattioship betweeio NIC aiod IP address is Parent - Child
relattioship. The restgurce which tioe is starts frst that tioe is called Parentresource aiod the
remaiioiioi depeiodeiocy restgurces are called Child resource.
32. What are the minimum requirements for or in VCS?
(i). MBiioimgum twt ideiotcal (same ctiofigurattio). systems.
(ii). Twt switches (Optcal Fibre Chaioioel)..
(iii). MBiioimgum three NIC cards. (Twt NICs ftr pri ate ioetwtrk aiod tioe NIC ftr pgublic
ioetwtrk)..
(i ). Oioe ctmmtio sttraie.
( ). Veritas Vtlgume MBaioaier with liceiose.
( i). Veritas Clguster with liceiose.
33. What are the Veritas Cluster deamons?
(i). had :
(a). It is the maiio deamtio iio Veritas Clguster ftr hiih a ailability.
(b). It mtioittrs the clguster ctiofigurattio aiod whtle clguster eio irtiomeiot.
(c). It iioteracts with all the aieiots aiod restgurces.
(ii). hashadow :
(a). It always mtioittr the had deamtio.
(b). It's maiio fguiocttioality is ltiiiioi abtgut the clguster.
35. What are the main configuration files in a Cluster?
* /Setc/SVRTS cs/Sctiof/Sctiofi/Smaiio.cf aiod
* /Setc/SVRTS cs/Sctiof/Sctiofi/Stypes.cf are the maiio ctiofigurattio fles iio Clguster.
36. What are the main log files in a Cluster?
(i). /S ar/SVRTS cs/Slti/SEioiiioe_A.lti (ltiiiioi abtgut wheio the clguster started wheio
failed wheio failt er
tccgurs wheio switcht er ftrcefgully ...etc. ).
(ii). /S ar/SVRTS cs/Slti/Shashadtw_A.lti (ltiiiioi abtgut the hashadtw deamtio).
(iii). /S ar/SVRTS cs/Slti/Saieiot_A.lti (ltiiiioi btgut aieiots).
37. What are the Cluster components?
(i). Clguster.
(ii). Ser ice irtgups.
(iii).Restgurces.
(i ). Aieiots.
( ). E eiots.
38. What is your role in the Cluster?
Ntrmally we will iet reqguests like
(i). Add a iotde.
(ii). Add a restgurce.
(iii). Add a ser ice irtgup.
(i ). Add a restgurce tt the existioi ser ice irtgup.
( ). Add mtguiot ptiiots.
Aiod stmetmes we iet stme trtgubleshtttioi issgues like
(i). had deamtio is iott rguioioiioi.
(ii). Split bariio issgue.
(iii).If the restgurces are fagulted theio restart the ser ice irtgups aiod mt iioi ser ice irtgups frtm
tioe iotde tt aiotther.
(i ). Clguster is iott rguioioiioi.
( ). Ctmmguioicattio failed betweeio twt iotdes.
( i). GA aiod LLT are iott rguioioiioi.
( ii). Restgurce iott started.
( iii). maiio.cf aiod types.cf fles ctrrgupted.
(ix). I/SO feiociioi (a ltckiioi mechaioism tt a tid the split braiio issgue). is iott eioabled (at disk
le el /S SAN le el)..
(a). If we waiot tt preser e the data theio briioi the disks tt VxVMB ctiotrtl gusiioi
eiocapsgulattio methtd by
# xdiskadm (here we iet the tpttios tt dt this aiod select 2iod tpttio ie.
Eiocapsgulattio).
(b). If we dtio't waiot tt preser e the data theio briioi the disks tt VxVMB ctiotrtl gusiioi
iioitalisattio methtd by # xdisksetgup -i <disk 1 ioame> (ftr example #
xdisksetgup -i /Sde /Ssda).
# xdisksetgup -i <disk 2 ioame> (ftr example # xdisksetgup -i
/Sde /Ssdb).
# xdisksetgup -i <disk 3 ioame> (ftr example # xdisksetgup -i
/Sde /Ssdc).
# xdisksetgup -i <disk 4 ioame> (ftr example # xdisksetgup -i
/Sde /Ssdd).
# xdisk list (tt see VxVMB ctiotrtlled disks).
(iii).Create a disk irtgup.
# xdi iioit <diskirtgup ioame> disk01=/Sde /Ssda (ftr example diskirtgup ioame as
appsdi).
(i ).Addiioi remaiioiioi three disks tt the abt e disk irtgup.
# xdi -i appsdi adddisk disk02=/Sde /Ssdb
# xdi -i appsdi adddisk disk02=/Sde /Ssdc
# xdi -i appsdi adddisk disk02=/Sde /Ssdd
# xdi list <diskirtgup ioame> (tt see all the disks beltiois tt that diskirtgup ftr
example appsdi).
( ). Create the Vtlgume (ftr the reqguested sise aiod reqguested laytgut)..
# xassist -i appsdi make < tlgume ioame><sise> (ftr example tlgume ioame
is apps tl aiod
sise iio T /SG ... etc).
( i). Create a fle system tio that tlgume.
# mkfs -F xfs /Sde /S x/Srdsk/Sappsdi/Sapps tl
( ii). Create the mtguiot ptiiot aiod prt ide the reqguested permissitios tt that mtguiot ptiiot.
# mkdir /Smiot/Sapps
( iii). Start the tlgume.
# x tl -i appsdi start apps tl
(ix).MBtguiot the fle system tio the abt e mtguiot ptiiot.
# mtguiot -F xfs -t <tpttios like rw re> /Sde /S x/Sdsk/Sappsdi/Sapps tl
(where rw meaios read-write aiod re meaios read-tioly).
(x). Pgut the eiotry iiott the "/Setc/Sfstab" fle ftr permaioeiot mtguiot.
* If the tlgume is created ftr clguster dtio't pgut the eiotry iio /Setc/Sfstab fle.
(xi). Aiod fioally seiod the mail tt clieiot tr reqguested perstio
43. What is the diference between Global Cluster and Local Cluster? Have you configured the
Global Cluster?
Local Cluster :
If all the iotdes iio a Clguster are placed iio a same ltcattio that Clguster is called Ltcal Clguster.
Global Cluster :
If all the iotdes iio a Clguster are placed iio difeereiot Getltiical ltcattios that Clguster is called
Gltbal Clguster. The maiio ad aiotaie tf iltbal clguster is hiih a ailability wheio Natgural Calamites
tr disasters tccgurs.
Thtse restgurces which we caioiott start tr sttp are called Persisteiot restgurces.
` Stme restgurces we caio start/Ssttp aiod stme tther restgurces we caioiott sttp tr start.
Example : We caioiott start tr sttp the NIC card.
(b). Non - Persistent Resource :
Thtse restgurces which we caio start/Ssttp are called Ntio - Persisteiot Restgurces.
(i ). Restgurces may be critcal tr iotio-critcal. We ioeed tt desiiio the restgurces as critcal tr
iotio-critcal. ie. the cgusttmer will iiosists which is critcal aiod which is iotio-critcal.
( ). If critcal restgurce is failed theio tioly the ser ice irtgup mt ed aguttmatcally frtm tioe
system tt aiotther system. ie. failt er ttherwise if iotio-critcal restgurce is failed
theio we ioeed tt the maiogual mt emeiot tf ser ice irtgup frtm tioe system tt aiotther
system. ie. switcht er.
46. What are the steps you follow to put the volume in a Cluster?
(i). First create the diskirtgup tlgume aiod create the fle system aiod mtguiot aiod guiomtguiot
beftre pgut the tlgume iio a clguster becaguse testioi tf that tlgume is wtrkiioi tr iott.
(ii). Create the ser ice irtgup aiod add the Attribgutes tt it.
# hairp -add <ser ice irtgup>
Example: # hairp -add appssi
Atributes :
# hairp -mtdify appssi system list={ sys A0 sys 0} (tt add sys A aiod sys attribgutes
tt ser ice irtgup).
# hairp -mtdify appssi aguttstart list={ sys A} (tt start the sys A attribgutes
aguttmatcally).
# hairp -mtdify appssi eioabled 1 tr 0 (1 meaios start aiod 0 meaios iott tt start
aguttmatcally).
(iii). Creatioi restgurces aiod addiioi them tt the ser ice irtgup aiod specify their attribgutes.
For file system :
(a). /Smiot/Sapps (the mtguiot ptiiot).
(b). /Sapps tl (the tlgume ioame).
(c). /Sappsdi (the disk irtgup).
# hares -add di-apps diskirtgup appssi (tt add the diskirtgup restgurce tt a
ser ice irtgup).
(where di-apps is restgurce ioame diskirtgup is a keywtrd aiod appssi is a ser ice
irtgup ioame).
# hares -mtdify di-apps diskirtgup appsdi (tt add the diskirtgup attribgute tt a
ser ice irtgup).
# hares -mtdify di-apps eioable 1 (tt eioable the restgurce).
# hares -add di- tlgume tlgume appssi (tt add the tlgume restgurce tt a
ser ice irtgup).
# hares -mtdify di- tlgume tlgume apps tl (tt add the tlgume attribgute tt a
ser ice irtgup).
# hares -mtdify di- tlgume diskirtgup appsdi (tt add the diskirtgup tt the
tlgume).
# hares -mtdify di- tlgume eioable 1 (tt eioable the tlgume restgurce).
# hares -mtdify di- tlgume critcal 1 (tt make the restgurce as critcal).
# hares -add di-miot mtguiot appssi (tt add the mtguiot ptiiot restgurce tt
a ser ice irtgup).
# hares -mtdify di-miot bltckde ice=/Sde /S x/Srdsk/Sappsdi/Sapps tl (tt add the bltck
de ice restgurce
tt a ser ice irtgup).
# hares -mtdify di-miot fstype= xfs (tt add the mtguiot ptiiot attribgutes tt
a ser ice irtgup).
# hares -mtdify di-miot mtguiot=/Smiot/Sapps (tt add the mtguiot ptiiot directtry
attribgute tt a
ser ice irtgup).
# hares -mtdify di-miot fscktpt=% y tr %io (tt add the fsck attribgute either yes
tr iot tt
ser ice irtgup).
(i ). Create liioks betweeio the abt e diskirtgup tlgume aiod mtguiot ptiiot restgurces.
# hares -liiok pareiot-res child-res
# hares -liiok di-appdi di- tlgume
# hares -liiok di- tlgume di-miot
47. What is meant by freezing and unfreezing a service group with persistent and evacuate
options?
Freezing :
If we waiot tt apply patches tt the system iio a clguster theio we ha e tt freese the ser ice irtgup
becaguse frst sttp the ser ice irtgup if it is critcal the ser ice irtgup will mt e aguttmatcally tt
aiotther system iio Clguster. St we dtio't waiot tt mt e the ser ice irtgup frtm tioe system tt
aiotther system we ha e tt freese the ser ice irtgup.
Unfreeze :
Afer ctmpletioi the task the ser ice irtgup shtguld be guiofreesed becaguse if the is crashed tr
dtwio aiod the restgurces are critcal theio the ser ice irtgup caioiott mt e frtm system 1 tt
system 2 dgue tt freesed the ser ice irtgup aiod resgults iio iott a ailable tf applicattio. If
guiofreesed the ser ice irtgup afer maiioteioaioce the ser ice irtgup caio mt e frtm system 1 tt
system 2. St if system 1 failed the system2 is a ailable aiod applicattio alst a ailable.
Persistent option :
If the ser ice irtgup is freesed with persisteiot tpttio theio we caio sttp tr dtwio tr restart
the system. St there is iot ltss tf data aiod afer restarted the system the ser ice irtgup is remaiios
iio freesed state tioly.
(i ). Iio this disk gutlisattio is mtre wheio ctmpared tt RAID-1 ie. 1/S3 rd tf disk space may be
wasted.
( ). This RAID-5 will be ctiofigured ftr critcal applicattios like aiokiioi Fiioaiocial SAX aiod
Iiosguraioce...etc. becaguse the data mgust be mtre secgured.
Creating a volume with layout :
# xassist -i <diskirtgup ioame> make < tlgume ioame><sise iio G /ST >
laytgut=<mirrtr/Sraid 5/Sraid 1>
Example : # xassist -i appsdi make apps tl 50G laytgut=raid 5 (the defagult is
RAID-5 iio VxVMB).
Logs :
* If the laytgut is mirrtr theio lti is DRL.
* If the laytgut is RAID-5 theio the lti is RAID-5 lti.
* The maiio pgurptse tf the lti is fast rect ery tperattio.
* We ha e tt specify whether the lti is reqguired tr iott iio all types tf laytguts except RAID-5
becaguse the ltiiiioi is defagult iio RAID-5.
* If we waiot tt ctiofigure RAID-5 withtgut ltiiiioi theio
# xassist -i <diskirtgup ioame> make < tlgume ioame> 50G iotlti laytgut=raid 5
* If the laytgut is tther thaio RAID-5 theio
# xassist -i <diskirtgup ioame> make < tlgume ioame> 50G lti laytgut=mirrtr
* If we waiot tt add the lti tt the existioi tlgume theio
# xassist -i <diskirtgup ioame> addlti ltitype=drl tr raid5
* If we waiot tt remt e the lti frtm the existioi tlgume theio
# xassist -i <diskirtgup ioame> rmlti < tlgume ioame>
49. What is read policy and how many types of read policies available?
Read ptlicy meaios htw the disk tr tlgume shtguld be read wheio accessiioi the data.
Types of read policies :
(i). Select
(ii). Prefer
(iii).Rtguiod Rtbiio
* y defagult the read ptlicy is Rtguiod Rtbiio.
# x tl -i <diskirtgup ioame> rdptl = < select/Sprefer/Srtguiodrtbiio < tlgume ioame>
50. What is your role in VxVM?
Ntrmally we iet reqguests frtm applicattio de eltpmeiot prtdgucttio aiod QA petple like
(i). Create a tlgume.
(ii). Iiocrease the tlgume.
(iii).Decrease the tlgume.
(i ). Prt ide Redguiodaiocy by implemeiotioi RAID-1 tr RAID-5.
( ). Prt ide the reqguired permissitios.
( i). Pgut the tlgume iio the Virtgual machiioe.
License :
(i). All the liceioses are sttred iio /etc/vx/licenses directtry aiod we caio take backgup tf this
directtry aiod resttre it back if we ioeed reiiostall the ser er.
(ii). Remt iioi VxVMB packaie will iott remt e the iiostalled liceiose.
(iii).Tt iiostall liceiose # vxlicinst ctmmaiod is gused.
(i ). Tt see the VxVMB liceiose iioftrmattio by # vxlicrep ctmmaiod.
( ). Tt remt e the VxVMB liceiose by # vxkeyless set NONE ctmmaiod.
( i).The liceiose packaies are iiostalled iio /opt/VRTSvlic/bin/vxlicrep directtry.
( ii). The liceiose keys are sttred iio /etc/vx/licenses/lic directtry.
( iii). We caio see the liceioses by execgutioi the beltw ctmmaiods
# cat /etc/vx/licenses/lic/key tr
# cat /opt/VRTSvlic/bin/vxlicrep | grep "License key"
(ix). Tt see the featgures tf liceiose key by # vxdctl license ctmmaiod.
Version :
(i). We are gusiioi VxVM6.2 ersitio.
(ii). tt kiotw the ersitio tf VxVMB by # rpm -qa VRTSvxvm ctmmaiod.
54. What are the available formats to take the control of disks from O/S to veritas in VxVM?
We caio take the ctiotrtl tf disks frtm O/SS tt eritas iio 3 ftrmats.
(i). CDS (Crtss plattrm Data Shariioi aiod the defagult ftrmat iio VxVMB)..
(ii). Sliced.
(iii). Simple.
(i). CDS :
(a). We caio share the data betweeio difeereiot Uioix fa tgurs.
(b). The pri ate aiod pgublic btth reiitios are a ailable iio 7th partttio.
(c). The eiotre space is iio 7th partttio.
(d). St there is a chaioce tt ltss the data becaguse if the disk is failed ie. partttio 7 is
ctrrgupted tr damaied theio the data may be ltst.
(e). This is the defagult iio eritas tlgume maioaier.
(ii). Sliced :
(a). It is always gused ftr rttt disk tioly.
(b). Iio this ftrmat we caioiott share the data betweeio difeereiot Uioix fa tgurs. Ntrmally sliced
is gused ftr rttt disk aiod cds is gused ftr data.
(c). Pri ate reiitio is a ailable at 4th partttio aiod pgublic reiitio is a ailable at 3rd partttio.
(d). St if pgublic reiitio is failed we caio rect er the data frtm pri ate reiitio ie. miioimisiioi
the data ltss.
(iii). Simple :
(a). This ftrmat is iott gusiioi widely iotw becaguse it is a ailable iio tld VxVMB 3.5
(b). Iio this pri ate aiod pgublic reiitios are a ailable at 3rd partttio.
Specifying the format while setup :
# xdisksetgup -i /Sde /Ssda (tt setgup the disk aiod this is defagult ftrmat ie.
CDS ftrmat).
# xdisksetgup -i /Sde /Ssdb ftrmat =<sliced /S simple> (tt specify sliced tr
simple ftrmat).
55. In how many ways can we manage VxVM?
(I). Ctmmaiod liioe tttl.
(ii). GUI ( ea tttl).
(iii). # xdiskadm ctmmaiod (it ii es the tpttios tt maioaie the disks).
30. RedHat Cluster
1. How can you define a cluster and what are its basic types?
A clguster is twt tr mtre ctmpguters (called iotdes tr members). that wtrk ttiether tt perftrm a
task. There are ftgur majtr types tf clgusters:
Sttraie
Hiih a ailability
Ltad balaiociioi
Hiih perftrmaioce
2. What is Storage Cluster?
Sttraie clgusters prt ide a ctiosisteiot fle system imaie acrtss ser ers iio a clguster alltwiioi
the ser ers tt simgultaioetgusly read aiod write tt a siioile shared fle system.
A sttraie clguster simplifes sttraie admiioistrattio by limitioi the iiostallattio aiod patchiioi tf
applicattios tt tioe fle system.
The Hiih A ailability Add-Oio prt ides sttraie clgusteriioi iio ctiojguiocttio with Red Hat GFS2
3. What is High Availability Cluster?
Hiih a ailability clgusters prt ide hiihly a ailable ser ices by elimiioatioi siioile ptiiots
tf failureaiod by failiioi t er ser ices frtm tioe clguster iotde tt aiotther iio case a iotde
bectmes iiotperat e.
Typically ser ices iio a hiih a ailability clguster read aiod write data ( ia read-write mtguioted
fle systems)..
A hiih a ailability clguster mgust maiiotaiio data iioteirity as tioe clguster iotde takes t er ctiotrtl
tf a ser ice frtm aiotther clguster iotde.
Ntde failgures iio a hiih a ailability clguster are iott isible frtm clieiots tgutside the clguster.
Hiih a ailability clgusters are stmetmes referred tt as failt er clgusters.
4. What is Load Balancing Cluster?
Ltad-balaiociioi clgusters dispatch ioetwtrk ser ice reqguests tt mgultple clguster iotdes tt
balaioce the reqguest ltad amtioi the clguster iotdes.
Ltad balaiociioi prt ides ctst-efeect e scalability becaguse ytgu caio match the iogumber tf
iotdes acctrdiioi tt ltad reqguiremeiots. If a iotde iio a ltad-balaiociioi clguster bectmes
iiotperat e the ltad-balaiociioi stfware detects the failgure aiod redirects reqguests tt tther
clguster iotdes.
Ntde failgures iio a ltad-balaiociioi clguster are iott isible frtm clieiots tgutside the clguster.
Ltad balaiociioi is a ailable with the Ltad alaiocer Add-Oio.
5. What is a High Performance Cluster?
Hiih-perftrmaioce clgusters guse clguster iotdes tt perftrm ctiocgurreiot calcgulattios.
A hiih-perftrmaioce clguster alltws applicattios tt wtrk iio parallel thereftre eiohaiociioi the
perftrmaioce tf the applicattios.
Hiih perftrmaioce clgusters are alst referred tt as ctmpgutattioal clgusters tr irid ctmpgutioi.
6. How many nodes are supported in Red hat 6 Cluster?
A clguster ctiofigured with qdiskd sgupptrts a maximgum tf 16 iotdes. The reastio ftr the limit is
becaguse tf scalability iiocreasiioi the iotde ctguiot iiocreases the amtguiot tf syiochrtiotgus I/SO
ctioteiottio tio the shared qgutrgum disk de ice.
7. What is the minimum size of the Quorum Disk?
The miioimgum sise tf the bltck de ice is 10 MBeiabytes.
8. What is the order in which you will start the Red Hat Cluster services?
In Red Hat 4 :
# ser ice ccsd start
# ser ice cmaio start
# ser ice feioced start
ser ice cl md start (If CLVMB has beeio gused tt create clgustered tlgumes).
system act ity tt fll aio 32MB jtgurioal aiod wheio the jtgurioal is fgull perftrmaioce sltws becaguse
GFS2 has tt wait ftr writes tt the sttraie.
14. What is a Quorum Disk?
Qgutrgum Disk is a disk-based qgutrgum daemtio qdiskd that prt ides sgupplemeiotal heguristcs
tt determiioe iotde ftioess.
With heguristcs ytgu caio determiioe facttrs that are imptrtaiot tt the tperattio tf the iotde iio
the e eiot tf a ioetwtrk partttio
Ftr a 3 iotde clguster a qgutrgum state is preseiot guiotl 2 tf the 3 iotdes are act e i.e. mtre thaio
half. gut what if dgue tt stme reastios the 2iod iotde alst sttps ctmmguioicatioi with the 3rd
iotde? Iio that case guioder a iotrmal architectgure the clguster wtguld disstl e aiod sttp wtrkiioi.
gut ftr missitio critcal eio irtiomeiots aiod sguch sceioarits we guse qgutrgum disk iio which aio addittioal
disk is ctiofigured which is mtguioted tio all the iotdes with qdiskd ser ice rguioioiioi aiod a tte
algue is assiiioed tt it.
St sgupptse iio abt e case I ha e assiiioed 1 tte tt qdisk st e eio afer 2 iotdes sttps
ctmmguioicatioi with 3rd iotde the clguster wtguld ha e 2 ttes (1 qdisk + 1 frtm 3rd iotde).
which is stll mtre thaio half tf tte ctguiot ftr a 3 iotde clguster. Ntw btth the iioact e iotdes wtguld
be feioced aiod ytgur 3rd iotde wtguld be stll gup aiod rguioioiioi beiioi a part tf the clguster.
15. What is rgmanager in Red Hat Cluster and its use?
This is a ser ice termed as Restgurce Grtgup MBaioaier
RGMBaioaier maioaies aiod prt ides failt er capabilites ftr ctllecttios tf clguster restgurces
called ser ices restgurce irtgups tr restgurce trees
it alltws admiioistrattrs tt defioe ctiofigure aiod mtioittr clguster ser ices. Iio the e eiot tf a
iotde failgure rimaioaier will reltcate the clgustered ser ice tt aiotther iotde with miioimal
ser ice disrgupttio.
16. What is luci and ricci in Red Hat Cluster?
luci is the ser er ctmptioeiot tf the Ctioia admiioistrattio gutlity
Ctioia is aio iioteirated set tf stfware ctmptioeiots that prt ides ceiotralised ctiofigurattio
aiod maioaiemeiot tf Red Hat clgusters aiod sttraie
lguci is a ser er that rguios tio tioe ctmpguter aiod ctmmguioicates with mgultple clgusters aiod
ctmpguters ia ricci
ricci is the clieiot ctmptioeiot tf the Ctioia admiioistrattio gutlity
ricci is aio aieiot that rguios tio each ctmpguter (either a clguster member tr a staiodaltioe
ctmpguter). maioaied by Ctioia
This ser ice ioeeds tt be rguioioiioi tio all the clieiot iotdes tf the clguster.
17. What is cman in Red Hat Cluster?
This is aio abbre iattio gused ftr Clguster MBaioaier.
CMBAN is a distribguted clguster maioaier aiod rguios iio each clguster iotde.
It is resptiosible ftr mtioittriioi heartbeat qgutrgum ttioi aiod ctmmguioicattio betweeio
clguster iotdes.
CMBAN keeps track tf clguster qgutrgum by mtioittriioi the ctguiot tf clguster iotdes.
18. What are the diferent port no. used in Red Hat Cluster?
IP Port no. Protocol Component
5404,5405 UDP ctrtsyioc/Scmaio
11111 TCP ricci
21064 TCP dlm (Distribguted Ltck MBaioaier).
16851 TCP MBtdclgustered
8084 TCP lguci
4196,4197 TCP rimaioaier
each tther the tioe that wiios is the tioe that caio stll piioi the gupstream rtguter.That is why
e eio wheio gusiioi te-breakers it is imptrtaiot tt eiosgure that feiociioi is ctiofigured ctrrectly.
CMBAN has iot iioterioal te-breakers ftr aritgus reastios. Htwe er te-breakers caio be
implemeioted gusiioi the API.
23. What is fencing in Red Hat Cluster?
Feiociioi is the disctioioecttio tf a iotde frtm the clguster's shared sttraie.
Feiociioi cguts tfe I/SO frtm shared sttraie thgus eiosguriioi data iioteirity.
The clguster iiofrastrguctgure perftrms feiociioi thrtguih the feioce daemtio fenced.
Wheio CMBAN determiioes that a iotde has failed it ctmmguioicates tt tther clguster-
iiofrastrguctgure ctmptioeiots that the iotde has failed.
fenced wheio iottfed tf the failgure feioces the failed iotde.
24. What are the various types of fencing supported by High Availability Add On?
Power fencing — A feiociioi methtd that guses a ptwer ctiotrtller tt ptwer tfe aio iiotperable
iotde.
storage fencing — A feiociioi methtd that disables the Fibre Chaioioel ptrt that ctioioects sttraie
tt aio iiotperable iotde.
Other fencing — Se eral tther feiociioi methtds that disable I/SO tr ptwer tf aio iiotperable
iotde iioclgudiioi I MB ladeceioters PAP DRAC/SMBC HP ILO IPMBI I MB RSA II aiod tthers.
25. What are the lock states in Red Hat Cluster?
A ltck state iiodicates the cgurreiot statgus tf a ltck reqguest. A ltck is always iio tioe tf three states:
Granted — The ltck reqguest sgucceeded aiod attaiioed the reqguested mtde.
Converting — A clieiot attempted tt chaioie the ltck mtde aiod the ioew mtde is iioctmpatble
with aio existioi ltck.
Blocked — The reqguest ftr a ioew ltck ctguld iott be iraioted becaguse ctiofictioi ltcks exist.
A ltck's state is determiioed by its reqguested mtde aiod the mtdes tf the tther ltcks tio the
same restgurce.
26. What is DLM lock model?
DLMB is a shtrt abbre iattio ftr Distribguted Ltck MBaioaier.
A ltck maioaier is a trafc ctp wht ctiotrtls access tt restgurces iio the clguster sguch as access
tt a GFS fle system.
GFS2 guses ltcks frtm the ltck maioaier tt syiochrtioise access tt fle system metadata (tio
shared sttraie).
CLVMB guses ltcks frtm the ltck maioaier tt syiochrtioise gupdates tt LVMB tlgumes aiod tlgume
irtgups (alst tio shared sttraie).
Iio addittio rimaioaier guses DLMB tt syiochrtioise ser ice states.
withtgut a ltck maioaier there wtguld be iot ctiotrtl t er access tt ytgur shared sttraie aiod
the iotdes iio the clguster wtguld ctrrgupt each tther's data.
ttp is tioe tf the tttl ftr mtioittriioi system gusaie aiod alst tt make aioy chaioie ftr imprt iioi
system perftrmaioce.
Introduction:
The ttp prtiram prt ides a dyioamic real-tme iew tf a rguioioiioi system. It caio display system
sgummary iioftrmattio as well as a list tf tasks cgurreiotly beiioi maioaied by the Liiogux kerioel. The
types tf system sgummary iioftrmattio shtwio aiod the types trder aiod sise tf iioftrmattio displayed
ftr tasks are all guser ctiofigurable aiod that ctiofigurattio caio be made persisteiot acrtss restarts.
1. Without any arguments :
# ttp
ttp - 17:51:07 gup 1 day 2:56 27 gusers ltad a eraie: 5.33 29.71 28.33
NOTE: Ytgu caio eioable tr disable the marked blgue liioe by pressiioi "l" tioce ttp is rguioioiioi.
top - 17:51:07 up 1 day, 2:56, 27 users, load average: 5.33, 29.71, 28.33
Tasks: 1470 tttal 1 rguioioiioi 1469 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.0%gus 0.1%sy 0.0%ioi 99.9%id 0.0%wa 0.0%hi 0.0%si 0.0%st
MBem: 264114424k tttal 253006956k gused 11107468k free 66964k bgufeers
Swap: 33554424k tttal 3260k gused 33551164k free 245826024k cached
Explanation: This liioe tells ytgu abtgut the guptme tf ytgur system altioi with ltad a eraie algue.
NOTE: Ytgu caio eioable/Sdisable the marked blgue liioe by pressiioi "t".
ttp - 17:51:07 gup 1 day 2:56 27 gusers ltad a eraie: 5.33 29.71 28.33
Tasks: 1470 total, 1 running, 1469 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.1%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
MBem: 264114424k tttal 253006956k gused 11107468k free 66964k bgufeers
Swap: 33554424k tttal 3260k gused 33551164k free 245826024k cached
Explanation: This liioe ii es gus a brief detail tf all the tasks rguioioiioi/Ssleepiioi/Ssttpped cgurreiotly
iio the system altioi with the CPU Usaie
Value Meaning
us guser cpgu tme (tr). % CPU tme speiot iio guser space
sy system cpgu tme (tr). % CPU tme speiot iio kerioel space
ni guser ioice cpgu tme (tr). % CPU tme speiot tio ltw pritrity prtcesses
id idle cpgu tme (tr). % CPU tme speiot idle
wa it wait cpgu tme (tr). % CPU tme speiot iio wait (tio disk).
hi hardware irq (tr). % CPU tme speiot ser iciioi/Shaiodliioi hardware iioterrgupts
si stfware irq (tr). % CPU tme speiot ser iciioi/Shaiodliioi stfware iioterrgupts
steal tme - - % CPU tme iio iio tlguiotary wait by irtgual cpgu while hyper istr is ser iciioi
st
aiotther prtcesstr (tr). % CPU tme sttleio frtm a irtgual machiioe
NOTE: Ytgu caio eioable/Sdisable the marked blgue liioe by pressiioi "m".
ttp - 17:51:07 gup 1 day 2:56 27 gusers ltad a eraie: 5.33 29.71 28.33
Tasks: 1470 tttal 1 rguioioiioi 1469 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.0%gus 0.1%sy 0.0%ioi 99.9%id 0.0%wa 0.0%hi 0.0%si 0.0%st
Mem: 264114424k total, 253006956k used, 11107468k free, 66964k bufers
Swap: 33554424k total, 3260k used, 33551164k free, 245826024k cached
Explanation: The ioext liioe shtws ytgur memtry(RAMB aiod swap). gusaie aiod capacity.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
13916 stmprd 18 0 903m 129m 9936 S 51.4 0.1 3:07.01 ja a
13921 stmprd 18 0 901m 128m 9936 S 49.8 0.0 3:02.92 ja a
13825 stmprd 18 0 951m 190m 9932 S 49.5 0.1 3:07.13 ja a
13856 stmprd 20 0 978m 197m 9936 S 49.2 0.1 3:05.89 ja a
13853 stmprd 18 0 921m 150m 9932 S 48.5 0.1 3:09.14 ja a
13875 stmprd 18 0 907m 132m 9940 S 48.5 0.1 3:09.49 ja a
13937 stmprd 25 0 926m 165m 9936 S 48.2 0.1 3:10.31 ja a
13919 stmprd 18 0 917m 153m 9936 S 47.5 0.1 3:05.92 ja a
13879 stmprd 25 0 921m 160m 9936 S 47.2 0.1 3:08.43 ja a
13908 stmprd 25 0 901m 131m 9932 S 47.2 0.1 3:12.23 ja a
13905 stmprd 25 0 907m 137m 9932 S 46.6 0.1 2:59.85 ja a
The lef secttios shtws ytgu the details tf the prtcess rguioioiioi altioi with the beltw details.
Fields/Column Description
PID Prtcess Id
USER The efeect e guser ioame tf the task's twioer
PR The pritrity tf the task
The ioice algue tf the task. A ioeiat e ioice algue meaios hiiher pritrity whereas a
NI ptsit e ioice algue meaios ltwer pritrity. Zert iio this feld simply meaios pritrity will
iott be adjgusted iio determiioiioi a task's dispatchability
The task's share tf the elapsed CPU tme siioce the last screeio gupdate expressed as a
%CPU
perceiotaie tf tttal CPU tme.
%MEM A task's cgurreiotly gused share tf a ailable physical memtry
TIME+ Tttal CPU tme the task has gused siioce it started
The statgus tf the task which caio be tioe tf:
'D' = guioiioterrguptble sleep
S
'R' = rguioioiioi
'S' = sleepiioi
Press "P" tr "shif+p" tioce ttp is rguioioiioi tt arraioie all the tasks with High to Low CPU
Usage as shtwio beltw.
ttp - 18:03:00 gup 1 day 3:08 27 gusers ltad a eraie: 12.54 32.34 32.75
Tasks: 1485 tttal 3 rguioioiioi 1482 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 41.2%gus 0.8%sy 0.0%ioi 56.6%id 1.4%wa 0.0%hi 0.0%si 0.0%st
MBem: 264114424k tttal 258863028k gused 5251396k free 76308k bgufeers
Swap: 33554424k tttal 3256k gused 33551168k free 250950544k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
9663 stmprd 22 0 902m 301m 9888 S 2578.3 0.1 2:27.04 ja a
32117 etlprd 18 -1 32416 5908 1716 R 6.2 0.0 0:04.84
cleaiogup_dirfle
10053 rttt 18 -1 27100 1936 1460 S 4.9 0.0 0:00.15 ps
5456 pmartprd 16 0 1182m 130m 8560 S 3.9 0.1 38:39.72
pmser er
17492 deepak 16 0 30592 3388 1544 R 3.6 0.0 0:17.11 ttp
2843 pmartprd 15 0 730m 48m 4052 S 3.3 0.0 4:40.33
pmser er
2457 rttt 11 -5 0 0 0 S 2.9 0.0 11:42.39
kacpid
3731 tdmsprd 15 0 370m 49m 32m S 2.3 0.0 0:00.64
pmdtm.trii
3. Arrange Tasks with High to Low Memory Usage.
Press "M" tr "shif+m"tioce ttp is rguioioiioi tt arraioie all the tasks with High to Low Memory
Usage as shtwio beltw.
ttp - 18:04:26 gup 1 day 3:09 27 gusers ltad a eraie: 37.12 34.56 33.44
Tasks: 1676 tttal 1 rguioioiioi 1675 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 2.3%gus 76.7%sy 0.0%ioi 19.7%id 1.3%wa 0.0%hi 0.0%si 0.0%st
MBem: 264114424k tttal 262605184k gused 1509240k free 77924k bgufeers
Swap: 33554424k tttal 3256k gused 33551168k free 252198368k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
ttp - 18:08:38 gup 115 days 8:44 4 gusers ltad a eraie: 0.03 0.03 0.00
Tasks: 325 tttal 2 rguioioiioi 323 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.1%gus 6.4%sy 0.0%ioi 93.3%id 0.3%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2063848k gused 47368880k free 310072k bgufeers
Swap: 2097144k tttal 0k gused 2097144k free 1297572k cached
PID to renice: 1308 [Hit Eioter]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
5359 rttt 39 19 0 0 0 R 100.1 0.0 94:31:35
kipmi0
1308 deepak 16 0 29492 2292 1512 S 0.7 0.0 0:00.33 ttp
6116 rttt 15 0 369m 30m 11m S 0.7 0.1 77:24.97 cimser er
Gi e the PID whtse ioice algue has tt be chaioied aiod hit "Eioter". Theio ii e the nice value ftr
the PID
ttp - 18:08:38 gup 115 days 8:44 4 gusers ltad a eraie: 0.03 0.03 0.00
Tasks: 325 tttal 2 rguioioiioi 323 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.1%gus 6.4%sy 0.0%ioi 93.3%id 0.3%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2063848k gused 47368880k free 310072k bgufeers
Swap: 2097144k tttal 0k gused 2097144k free 1297572k cached
Renice PID 1308 to value: -1 [Hit Eioter]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
Press "k" tio the termiioal wheio ttp is rguioioiioi. Ytgu shtguld iet a prtmpt as shtwio beltw
iio blgue ctltr
ttp - 18:09:31 gup 115 days 8:45 4 gusers ltad a eraie: 0.08 0.05 0.01
Tasks: 325 tttal 1 rguioioiioi 324 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.1%gus 0.1%sy 0.0%ioi 99.8%id 0.1%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2062036k gused 47370692k free 310072k bgufeers
Swap: 2097144k tttal 0k gused 2097144k free 1297596k cached
PID tt kill:1308
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
5359 rttt 34 19 0 0 0 S 1.3 0.0 9431:42
kipmi0
6460 rttt 24 0 179m 30m 3976 S 1.0 0.1 79:04.77
ja a
1308 deepak 15 -1 29492 2292 1512 S 0.7 0.0 0:00.49
ttp
1434 rttt 15 0 29492 2288 1516 R 0.7 0.0 0:00.13
ttp
ttp - 18:09:31 gup 115 days 8:45 4 gusers ltad a eraie: 0.08 0.05 0.01
Tasks: 325 tttal 1 rguioioiioi 324 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.1%gus 0.1%sy 0.0%ioi 99.8%id 0.1%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2062036k gused 47370692k free 310072k bgufeers
Swap: 2097144k tttal 0k gused 2097144k free 1297596k cached
Kill PID 1308 with siiioal [15]: [Hit Eioter ftr defagult]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
5359 rttt 34 19 0 0 0 S 1.3 0.0 9431:42
kipmi0
6460 rttt 24 0 179m 30m 3976 S 1.0 0.1 79:04.77
ja a
1308 deepak 15 -1 29492 2292 1512 S 0.7 0.0 0:00.49
ttp
6. View all the processes running by a user
Press "u" tio the termiioal wheio ttp is rguioioiioi. Ytgu shtguld iet a prtmpt as shtwio beltw
iio blgue ctltr
ttp - 18:12:24 gup 115 days 8:48 4 gusers ltad a eraie: 0.06 0.05 0.00
Tasks: 328 tttal 1 rguioioiioi 327 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.0%gus 0.4%sy 0.0%ioi 99.6%id 0.0%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2063268k gused 47369460k free 310072k bgufeers
Swap: 2097144k tttal 0k gused 2097144k free 1297660k cached
Which guser (blaiok ftr all).: deepak [Hit Eioter]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
1729 rttt 15 0 29488 2196 1432 R 2.0 0.0 0:00.01
ttp
1 rttt 15 0 10352 692 580 S 0.0 0.0 0:02.16
iioit
2 rttt RT -5 0 0 0 S 0.0 0.0 0:02.37
miirattio/S0
3 rttt 34 19 0 0 0 S 0.0 0.0 0:00.00
kstfirqd/S0
4 rttt RT -5 0 0 0 S 0.0 0.0 0:00.00
watchdti/S0
ttp - 18:12:41 gup 115 days 8:48 4 gusers ltad a eraie: 0.04 0.05 0.00
Tasks: 328 tttal 1 rguioioiioi 327 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.0%gus 0.1%sy 0.0%ioi 99.9%id 0.0%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2062356k gused 47370372k free 310072k bgufeers
y defagult the ttp termiioal is set ftr agutt refresh afer e ery 3 seconds bgut if ytgu waiot ytgu caio
chaioie it as per ytgur reqguiremeiot.
Press "d" wheio ttp is rguioioiioi. Ytgu shtguld iet a prtmpt as shtwio beltw iio blgue ctltr.
ttp - 18:14:55 gup 115 days 8:50 4 gusers ltad a eraie: 0.01 0.04 0.00
Tasks: 328 tttal 1 rguioioiioi 327 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.0%gus 0.1%sy 0.0%ioi 99.9%id 0.0%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2063828k gused 47368900k free 310072k bgufeers
Swap: 2097144k tttal 0k gused 2097144k free 1297728k cached
Chaioie delay frtm 3.0 tt: 2.0 [Hit Eioter]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
5359 rttt 34 19 0 0 0 S 0.7 0.0 9431:58
kipmi0
1795 rttt 15 0 29492 2300 1524 R 0.3 0.0 0:00.20
ttp
1 rttt 15 0 10352 692 580 S 0.0 0.0 0:02.16
iioit
Verify the chaioies. Ytgu mgust see the screeio bgufeer ietioi refresh mguch earlier tr jgust tt erify
ytgu caio prt ide a hiiher algue tf delay aiod tbser er the refresh rate tio the termiioal
y defagult this tpttio is set tt guiolimited that is the reastio ytgur termiioal is fgully ct ered with list
tf tasks wheio ytgu rguio the ttp ctmmaiod. Aioy htw ytgu caio list the iot tf tasks tt be isible tioce
ytgu rguio ttp ctmmaiod.
Press "n"wheio ttp is rguioioiioi. Ytgu shtguld iet a prtmpt as shtwio beltw iio blgue ctltr
ttp - 18:18:07 gup 115 days 8:54 4 gusers ltad a eraie: 0.01 0.03 0.00
Tasks: 328 tttal 1 rguioioiioi 327 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.0%gus 0.2%sy 0.0%ioi 99.7%id 0.1%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2063348k gused 47369380k free 310072k bgufeers
Swap: 2097144k tttal 0k gused 2097144k free 1297804k cached
MBaximgum tasks = 0 chaioie tt (0 is unlimited).: 2 [Hit Eioter]
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
5359 rttt 34 19 0 0 0 S 2.3 0.0 9432:08
kipmi0
1795 rttt 15 0 29492 2304 1528 R 0.7 0.0 0:00.65
ttp
1 rttt 15 0 10352 692 580 S 0.0 0.0 0:02.16
iioit
2 rttt RT -5 0 0 0 S 0.0 0.0 0:02.37
miirattio/S0
ttp - 14:48:40 gup 116 days 5:24 3 gusers ltad a eraie: 0.05 0.04 0.00
Tasks: 318 tttal 1 rguioioiioi 317 sleepiioi 0 sttpped 0 stmbie
Cpgu(s).: 0.0%gus 0.1%sy 0.0%ioi 99.9%id 0.0%wa 0.0%hi 0.0%si 0.0%st
MBem: 49432728k tttal 2051952k gused 47380776k free 310176k bgufeers
Swap: 2097144k tttal 0k gused 2097144k free 1293800k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
COMMAND
5359 rttt 34 19 0 0 0 S 1.0 0.0 9502:15
kipmi0
25009 prasadee 15 0 29492 2280 1516 R 0.3 0.0 0:01.88
ttp
y defagult ytgu see limited set tf tgutpgut wheio ytgu guse the ttp ctmmaiod. gut apart frtm thtse
there are a tther list tf feld which caio be added tt the ttp tgutpgut. Tt iew all the list f feld
which caio be added ftlltw the beltw steps.Rguio ttp ctmmaiod aiod theio
Press "f" which will take ytgu the list tf a ailable felds guioder ttp ctmmaiod.
All the feld iioitals stated iio LOCK letters are isible by defagult wheio ytgu issgue ttp
ctmmaiod. Tt add a ioew feld press the feld iioital as shtwio iio the frst ctlgumio.
* A: PID = Prtcess Id 0x00000001 PF_ALIGNWARN
* E: USER = User Name 0x00000002 PF_STARTING
* H: PR = Pritrity 0x00000004 PF_EXITING
* I: NI = Nice algue 0x00000040 PF_FORKNOEXEC
* O: VIRT = Virtgual Imaie (kb). 0x00000100 PF_SUPERPRIV
* Q: RES = Resideiot sise (kb). 0x00000200 PF_DUMBPCORE
* T: SHR = Shared MBem sise (kb). 0x00000400 PF_SIGNALED
* W: S = Prtcess Statgus 0x00000800 PF_MBEMBALLOC
* K: %CPU = CPU gusaie 0x00002000 PF_FREE_PAGES (2.5).
* N: %MBEMB = MBemtry gusaie (RES). 0x00008000 debgui fai (2.5).