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

[

Pickt e] [
hedat LINUXNOTESFORLEVEL2]

1. Managi
ngPar
ti
ti
onsandFi
l
eSy
stems 2-
8
2. Logi
cal
Vol
umeManagementandRAI
DLev
els 9-20
3. UserandGr
oupAdmi
nist
rat
ion,
SUDOandPer
missi
ons 21-35
4. Net
wor
kConf
igur
ati
onandTr
oubl
eshoot
ing 36-47
5. Managi
ngSELi
nux 48-49
6. Boot
ingPr
ocedur
eandKer
nel
par
amet
ers 50-55
7. JobAut
omat
ion 56-60
8. Admi
nist
rat
ingRemot
eSy
stems(
SSH) 61-
66
9. Memor
yManagement(
Swap) 67-69
10. Sof
twar
eManagement 70-75
11. BackupandRest
ore 76-80
12. Managi
ngI
nst
all
edSer
vices 81-83
13. Managi
ngPr
ocess 84–93
14. FTP(
Fil
eTr
ansf
erPr
otocol
)Ser
ver 94–97
15. NFS(Networ kFileSy st
em)Ser ver,AutofsandLDAP Cl
i
ent 98–109
110–
16. SambaSer ver 113
114–
17. NTP(Networ kTimePr otocol
)orChr ony 114
115–
18. DNS(Domai nNami ngSy stem) 124
125–
19. DHCP( Dynami cHostConf i
gurati
onProtocol
) 127
128–
20. WebSer ver(Apache) 141
142–
21. Mail
Ser v
er 145
146–
22. i
SCSI(Remot eSt orage) 148
149–
23. MySQLSer verandMar i
aDB 151
152–
24. LogServerandLogFi les 154
155–
25. Conf
iguri
ngI PtablesandFi r
ewall 159
26. Vi
rt
ual
i
zat
ion 160–

Rat
nakar
Page1
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

161
162–
27. Gener
alQuest
ions 174
175–
28. Ki
ckst
artI
nst
all
ati
onandPXE(
Net
wor
k)I
nst
all
ati
on 181
182–
29. Ver
it
asVol
umeManagerand Ver
it
asCl
ust
er 195
196–
30. RedHatCl
ust
er 201
31. Ex
ampl
esoftopcommand 202-209
1.Managi
ngPar
ti
ti
onsandFi
leSy
stems

1. Whati
spar
ti
ti
on?
Apar
ti
ti
oni
sacont
iguoussetofbl
ocksonadr
ivet
hatar
etr
eat
edasi
ndependentdi
sk.
2. Whati
spar
ti
ti
oni
ng?
Par
ti
ti
oni
ngmeanst
odi
vi
deasi
ngl
ehar
ddr
ivei
ntomanyl
ogi
cal
dri
ves.
3. Whywehav
emul
ti
plepar
ti
ti
ons?
 Encapsul
ateourdat
a.Si
ncef
il
esy
stem cor
rupt
ioni
sli
mit
edt
othatpar
ti
ti
ononl
y.So
wecansav
eourdat
afr
om acci
dent
s.
 Wecani
ncr
easet
hedi
skspaceef
fi
ciency
.Dependi
ngonourusagewecanf
ormat
t
hepar
ti
ti
onwi
thdi
ff
erentbl
ocksi
zes.Sowecanr
educet
hewast
ageoft
hedi
sk.
 Wecanl
i
mitt
hedat
agr
owt
hbyassi
gni
ngt
hedi
skquot
as.
4. Whati
sthest
ruct
ureoft
hedi
skpar
ti
ti
on?
 Thef
ir
stsect
oroft
heO/
Sdi
skcont
ainst
heMBR(
Mast
erBootRecor
d).TheMBRi
s
di
vi
dedi
nto3par
tsandi
t'
ssi
zei
s512by
tes.
 Thef
ir
stpar
tisI
PL(
Ini
ti
alPr
ogr
am Loader
)andi
tcont
ainst
heSecondar
yBoot
Loader
.So,
IPLi
sresponsi
blef
orboot
ingt
heO/
Sandi
t'
ssi
zei
s446by
tes.
 Thesecondpar
tisPTI(
Par
ti
ti
onTabl
eInf
ormat
ion)
.Itcont
ainst
henumberof
par
ti
ti
onsont
hedi
sk,
sizesoft
hepar
ti
ti
onsandt
ypeoft
hepar
ti
ti
ons.
5. Expl
aint
hedi
skpar
ti
ti
oncr
it
eri
a?
 Ev
erydi
skcanhav
emax.4par
ti
ti
ons.The4par
ti
ti
onsar
e3Pr
imar
ypar
ti
ti
onsand1
Ext
endedpar
ti
ti
on.
 TheMBRandO/
Swi
l
linst
all
inPr
imar
ypar
ti
ti
ononl
y.
 TheExt
endedpar
ti
ti
oni
saspeci
alpar
ti
ti
onandcanbef
urt
herdi
vi
dedi
ntomul
ti
ple
l
ogi
cal
par
ti
ti
ons.
6. Howt
oident
if
ythedi
sks?
I
nLi
nuxdi
ff
erentt
ypesofdi
skswi
l
lbei
dent
if
iedbydi
ff
erentnami
ngconv
ent
ions.
I
DE)dr
iveswi
l
lbeshownas/
dev
/hda,
/dev
/hdb,
/dev
/hdc,
..
.et
c.,andt
hepar
ti
ti
ons
ar
e/dev
/hda1,/
dev
/hda2,
/dev
/hda3,
..
.et
c.,

Rat
nakar
Page2
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

i
SCSI
/SCSIandSATAdr
iveswi
l
lbeshownas/
dev
/sda,
/dev
/sdb,
/dev
/sdc,
..
.et
c.,
andt
hepar
ti
ti
onsar
e/dev
/sda1,
/dev
/sda2,
/dev
/sda3,
..
.et
c.,
 Vi
rt
ual
dri
veswi
l
lbeshownas/
dev
/vda,
/dev
/vdb,
/dev
/vdc,
..
.et
c.,andt
hepar
ti
ti
ons
ar
e/dev
/vda1,
/dev
/vda2,
/dev
/vda3,
..
.et
c.,
I
DE-
--
--
>Int
egr
atedDr
iveEl
ect
roni
cs.
iSCSI-
--
--
>Int
ernetSmal
lScal
eSy
stem
I
nter
face.
SCSI-
--
--
>Smal
lScal
eSy
stem I
nter
face.
7. Whati
sfi
lesy
stem?
I
tisamet
hodofst
ori
ngt
hedat
ainanor
gani
zedf
ashi
onont
hedi
sk.Ev
erypar
ti
ti
onon
t
hedi
skexceptMBRand
Ext
endedpar
ti
ti
onshoul
dbeassi
gnedwi
thsomef
il
esy
stem i
nor
dert
omaket
hem t
o
st
oret
hedat
a.Fi
l
e sy
stem i
sappl
i
edont
hepar
ti
ti
onbyf
ormat
ti
ngi
twi
thapar
ti
cul
ar
t
ypeoff
il
esy
stem.
8. Whatar
ethedi
ff
erentt
ypesoff
il
esy
stemssuppor
tedi
nLi
nux?
TheLi
nuxsuppor
tedf
il
esy
stemsar
eex
t2,
ext
3,ext
4,xf
s,v
fat
,cdf
s,hdf
s,i
so9660.
..
etc.
,
Theext
2,ex
t3,
ext
4fi
l
esy
stemsar
ewi
del
yusedi
nRHEL-
6andxf
sfi
l
esy
stem i
s
i
ntr
oducedonRHEL-
7. Thev
fatf
il
esy
stem i
susedt
omai
ntai
nacommon
st
oragebet
weenLi
nuxandWi
ndowsO/
S.
Thecdf
sfi
l
esy
stem i
susedt
omountt
heCD-
ROMsandt
hehdf
sfi
l
esy
stem i
susedt
o
mountDVDs.
Thei
so9660f
il
esy
stem i
susedt
oreadCD/
DVD.
i
soi
magef
ormatf
il
esi
nLi
nuxO/
S.
9. Whati
smount
ingandi
nhowmanyt
ypescanwemountt
hepar
ti
ti
ons?
At
tachi
ngadi
rect
oryt
othef
il
esy
stem i
nor
dert
oaccesst
hepar
ti
ti
onandi
t'
sfi
l
e
sy
stem i
sknownasmount
ing.
I
ngener
alt
hesubdi
rect
ori
esunder/
mntdi
rect
oryar
ethemountpoi
ntst
omountt
he
f
il
esy
stems.
Ther
etwot
ypesofmount
ingsi
nLi
nux/
Uni
x.
 Tempor
aryMount
ing:
I
nat
empor
arymount
ingf
ir
stwecr
eat
eadi
rect
oryandmountt
hepar
ti
ti
onont
hat
di
rect
ory
.Butt
hist
ypemount
ingwi
l
llastonl
yti
l
lthesy
stem i
supandoncei
tis
r
eboot
edt
hemount
ingwi
l
lbel
ost
.
Exampl
e:#mount<opt
ions><dev
icename><di
rect
oryname(
mountpoi
nt)
>
 Per
manentMount
ing:
I
nthi
sal
sof
ir
stwecr
eat
ethedi
rect
oryandopent
he/
etc/
fst
abf
il
eandmakean
ent
ryasbel
ow,
<dev
icename><mountpoi
nt><f
il
esy
stem t
ype><mountopt
ions><t
akeabackupor
not
><f
sckv
alue>
Whenev
ert
hesy
stem r
eboot
smountt
hepar
ti
ti
onsaccor
dingt
oent
ri
esi
n
/
etc/
fst
abf
il
e.So,
theset
ypeofmount
ingsar
eper
manent
lyev
enaf
tert
hesy
stem
i
sreboot
ed.

Rat
nakar
Page3
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#mount-
a t
omountt
hepar
ti
ti
onswi
thoutr
eboot
)
10.Whatar
edi
ff
erencesbet
weent
heext
2,ext
3,ext
4andxf
sfi
lesy
stems?

S.
No
Ext
2 Ext
3 Ext
4 Xf
s
.
1. StandsforSecond StandsforThird StandsforFour th StandsforExtended
Extendedfil
esy stem. Extendedfil
esystem. Ex t
endedfil
esy stem. fi
lesystem.
2. Doesnothav i
ng SupportsJournali
ng SupportsJour nal
ing SupportsJournal
ing
Journali
ngf eat
ure. featur
e. featur
e. featur
e.
3. Max .fi
l
esiz ecanbe Max .fi
l
esizecanbe Max.f i
l
esiz ecanbe Max.f i
l
esizecanbe
fr
om 16GBt o2TB. from 16GBt o2TB. from 16GBt o16TB. from 16GBt o8EB.
4. Max .fi
l
esy stem size Max .fi
l
esy st
em size Max.f i
l
esy stem size Max.f i
l
esy st
em size
canbef rom 2TBt o canbef rom 2TBt o canbef rom 2TBt o1 canbef rom 2TBt o
32TB 32TB EB 16EB.

*1EB=1024Peta
bytes.
5. Cannotconv
ertext Wecandi rect
ly Wecanconvertal
lfi
le Unmountandmount
fi
l
esy st
em t
oex t
2. convertext
2t oext
3 systemstoext
4f i
le t hefi
lesyst
em i
s
fi
lesystem. system. requi
red.
11.Whi
chf
il
esar
erel
atedt
omount
ingi
nLi
nux?

/
etc/
mtab-
--
->i
saf
il
ewhi
chst
orest
hei
nfor
mat
ionofal
lthecur
rent
lymount
edf
il
e
sy
stemsandt
hisf
il
eis dy
nami
candkeeponchangi
ng.
/
etc/
fst
ab-
--
->i
skeepi
ngi
nfor
mat
ionaboutt
heper
manentmountpoi
nts.I
fwewantt
o
makeourmountpoi
nt per
manentt
henmakeanent
ryaboutt
he
mountpoi
nti
nthi
sfi
l
e.
/
etc/
fst
abent
ri
esar
e:
1 2 3 4 5
6
dev
icename mountpoint f
il
esystem t
ype mountopt
ionst
akeabackup
shouldrun
ornot f
sckornot
12.Howt ocreat
edif
ferentt
ypesofpart
it
ions?
#f
disk-
l
#f
disk/
dev
/sdc
Command(
mforhel
p):
n (
typenf
ornewpar
ti
ti
on)
(
p-pr
imar
y)ore-ext
ended):
p (
typepf
orpr
imar
ypar
ti
ti
onort
ypeef
or
ext
endedpar
ti
ti
on)
Fi
rstcy
li
nder:(
pressEnt
erf
ordef
aul
tfi
rstcy
li
nder
)
Lastcy
li
nder:+<si
zei
nKB/
MB/
GB/
TB>
Command(
mforhel
p):
t (
type tt
ochanget
hepar
ti
ti
oni
d)
(
forexampl
e: 8ef
orLi
nuxLVM,82f
orLi
nuxSwap and83f
orLi
nuxnor
mal
par
ti
ti
on)
Command(
mforhel
p):
w (
type w t
osav
ethechangesi
ntot
hedi
sk)

Rat
nakar
Page4
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#par
tpr
obe/
par
tx-
a/kpar
tx/
dev
/sdc1 (
toupdat
ethepar
ti
ti
oni
ngi
nfor
mat
ioni
n
par
ti
ti
ont
abl
e)
13.Howt
omakeaf
il
esy
stem i
nLi
nux?
#mkf
s.ext
2/ex
t3/
ext
4/xf
s/v
fat<dev
icename>(f
orex
ampl
e/dev
/sdc1)
14.Howt
omountt
hef
il
esy
stemst
empor
ari
l
yorper
manent
ly?
#mkdi
r/mnt
/or
acl
e
#mount/
dev
/sdc1/
mnt
/or
acl
e(t
empor
arymount
)
#v
im/
etc/
fst
ab
/
dev
/sdc1 /
mnt
/or
acl
e xf
s def
aul
ts 0 0
Esc+:
+wq!
#mount-
a(per
manentmount
)
15.Howt
odel
etet
hepar
ti
ti
on?
#f
disk/
dev
/sdc
Command(
mforhel
p):
d (
type d f
ordel
etet
hepar
ti
ti
on)
Par
ti
ti
onnumber:(
speci
fyt
hepar
ti
ti
onnumber
)
Command(
mforhel
p):
w (
type w t
owr
it
ethechangesi
ntodi
sk)
#par
tpr
obe/
par
tx-
a/kpar
tx/
dev
/sdc1(
toupdat
ethepar
ti
ti
ont
abl
ewi
thoutr
est
art
ing
t
hesy
stem)
16.Thepar
ti
ti
onsar
enotmount
ingev
ent
hought
her
ear
eent
ri
esi
n/et
c/f
stab.Howt
o
sol
vet
hispr
obl
em?
Fi
rstcheckanywr
ongent
ri
esar
ether
ein/
etc/
fst
abf
il
e.I
fal
lar
eokt
henunmountal
l
t
hepar
ti
ti
onsby
execut
ingt
hebel
owcommand,
#umount -
a
Thenmountagai
nmountal
lthepar
ti
ti
onsbyexecut
ingt
hebel
owcommand,
#mount-
a
17.Whent
ryi
ngt
ounmount
ingi
tisnotunmount
ing,
howt
otr
oubl
eshoott
hisone?
Somet
imesdi
rect
oryr
efl
ect
ser
rorwhi
l
eunmount
ingbecause,
(
i)y
ouar
eint
hesamedi
rect
oryandt
ryi
ngt
ounmounti
t,checkwi
th#pwdcommand.
(
ii
)someuser
sar
epr
esentoraccessi
ngt
hesamedi
rect
oryandusi
ngt
hecont
ent
sini
t,
checkt
hiswi
th
#f
user-
cu<dev
icename> (
tocheckt
heuser
swhoar
eaccessi
ngt
hatpar
ti
ti
on)
#l
sof<dev
icename> (
tocheckt
hef
il
eswhi
char
eopeni
nthatmountpoi
nt)
#f
user-
ck <openedf
il
enamewi
thpat
h> (
toki
l
lthatopenedf
il
es)
Nowwecanunmountt
hatpar
ti
ti
onusi
ng #umount <mountpoi
nt>
18.Howt
oseet
heusagei
nfor
mat
ionofmount
edpar
ti
ti
ons?
#df -
hT (
toseedev
icename,
fil
esy
stem t
ype,
size,
used,
avai
l
abl
esi
ze,
use%and
mountpoi
nt)
19.Howt
oseet
hesi
zeoft
hef
il
eordi
rect
ory
?
#du -
h <f
il
enameordi
rect
oryname> (
toseet
hesi
zeoft
hef
il
eoral
lthef
il
esi
zes

Rat
nakar
Page5
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

i
nthatdi
rect
ory
)
#du -
h (
toseeal
lthef
il
esi
zeswhi
char
elocat
edi
nthepr
esentwor
kingdi
rect
ory
)
#du.
|sor
t-nr|
head-
n10 (
toseet
hebi
ggestf
il
esf
rom cur
rentl
ocat
ion)
#du-
s*|
sor
t-nr|
head-
n10 (
toseet
hebi
ggestdi
rect
ori
esf
rom t
hatpar
ti
ti
on)
#ncdu (
tol
i
stbi
ggestf
il
esanddi
rect
ori
es, wehav
etoi
nst
all
thencdupackage
bef
oreexecut
ingt
his)
20.Howt
oassi
gnal
abel
tot
hepar
ti
ti
on?
#e2l
abel<dev
icenameorpar
ti
ti
onname><l
abel
name> (
toassi
gnt
hel
abel
tot
hat
par
ti
ti
on)
Exampl
e: #e2l
abel/
dev
/sdb1or
adi
sk (
toassi
gnor
adi
skl
abel
to/
dev
/sdb1
par
ti
ti
on)
#mount-
l (
tol
i
stal
lthemount
edpar
ti
ti
onsal
ongwi
tht
hei
rlabel
s)

21.Howt
omountapar
ti
ti
ont
empor
ari
lyorper
manent
lyusi
ngl
abel
?
#mountLABEL=<l
abel
name><mountpoi
nt>
Exampl
e:#mountLABEL=or
adi
sk /
mnt
/or
acl
e (
tomountt
heor
adi
skl
abel
on
/
mnt
/or
acl
edi
rect
ory
)
#v
im/
etc/
fst
ab
LABEL=or
adi
sk /
mnt
/or
acl
e ext
4 def
aul
ts 0 0
Esc+:
+wq! (
tosav
eandexi
tthef
il
e)
#mount -
a (
tomountt
hepar
ti
ti
ons)
#mount (
tov
eri
fywhet
heri
tismount
edornot
)
22.Howmountt
hepar
ti
ti
onper
manent
lyusi
ngbl
ocki
d(UUI
D)?
#bl
ki
d <par
ti
ti
onnameordi
skname> (
toseet
heUUI
Dorbl
ocki
doft
hatpar
ti
ti
on)
Exampl
e:#bl
ki
d/dev
/sdb2 (
toseet
heUUI
Dorbl
ocki
doft
he/
dev
/sdb2par
ti
ti
on)
Copyt
hatUUI
Dwi
thmouseandpast
eiti
n/et
c/f
stabf
il
eandmakeanent
ryaboutt
hat
.
Exampl
e:#v
im/
etc/
fst
ab
UUI
D="
{.
..
..
..
..
..
..
..
..
..
..
..
}"/
mnt
/or
acl
e ext
4 def
aul
ts 0 0
Esc+:
+wq! (
tosav
eandexi
t)
23.Whati
sthebasi
crul
eforswapsi
ze?
(
i)I
fthesi
zeoft
heRAM i
slesst
hanorequal
to2GB,
thent
hesi
zeoft
heswap=2X
RAM si
ze.
(
ii
)Ift
hesi
zeoft
heRAM i
smor
ethan2GB,
thent
hesi
zeoft
heswap=2GB+RAM si
ze.
24.Howt
ocr
eat
easwappar
ti
ti
onandmounti
tper
manent
ly?
#f
ree -
m (
toseet
hepr
esentswapsi
ze)
#swapon-
s (
toseet
heswapusage)
#f
disk <di
skname> (
tomakeapar
ti
ti
on)
Exampl
e:#f
disk /
dev
/sdb
Command(
mforhel
p):n (
tocr
eat
eanewpar
ti
ti
on)
Fi
rstcy
li
nder:(
pressEnt
ert
otakeasdef
aul
tval
ue)

Rat
nakar
Page6
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Lastcy
li
nder:+2048M (
tocr
eat
e2GBpar
ti
ti
on)
Command(
mforhel
p):t (
tochanget
hepar
ti
ti
oni
d)
Ent
ert
hepar
ti
ti
onNo.
:2 (
tochanget
he/
dev
/sdb2par
ti
ti
oni
d)
Ent
ert
hei
d:82 (
tochanget
hepar
ti
ti
oni
dLi
nuxt
oLi
nuxSwap)
Command(
mforhel
p):w (
tosav
ethechangesi
ntot
hedi
sk)
#par
tpr
obe/
dev
/sdb (
toupdat
ethepar
ti
ti
ont
abl
einf
ormat
ion)
#mkswap<dev
iceorpar
ti
ti
onname> (
tof
ormatt
hepar
ti
ti
onwi
thswapf
il
esy
stem)
Exampl
e:#mkswap /
dev
/sdb2 (
tof
ormatt
he/
dev
/sdb2par
ti
ti
onwi
thswapf
il
e
sy
stem)
#swapon <dev
iceorpar
ti
ti
onname> (
toact
ivat
etheswapspace)
Exampl
e:#swapon /
dev
/sdb2 (
toact
ivat
e/dev
/sdb2swapspace)
#f
ree -
m (
toseet
heswapsi
ze)
#v
im/
etc/
fst
ab (
tomakeanent
ryt
oper
manentmountt
heswappar
ti
ti
on)
/
dev
/sdb2 swap swap def
aul
ts 0 0
Esc+:
+wq! (
tosav
eandexi
t)
25.Whatar
etheat
tri
but
esoft
hef
il
esy
stem?
(
i)I
nodenumber
(
ii
)Fi
l
ename
(
ii
i) dat
abl
ock

26.Whati
sinodenumberandwhati
stheuseofi
t?
I
nodenumber
sar
etheobj
ect
stheLi
nuxO/
Susest
orecor
dthei
nfor
mat
ionaboutt
he
f
il
e.
Gener
all
yinodenumbercont
ainst
wopar
ts.
(
a)I
nodef
ir
stpar
tcont
ainsi
nfor
mat
ionaboutt
hef
il
e,owner
,it
ssi
zeandi
ts
per
missi
ons.
(
b)I
nodesecondpar
tcont
ainspoi
ntert
odat
abl
ocksassoci
atedwi
tht
hef
il
econt
ent
.
That
'swhyusi
ngt
hei
nodenumberwecangett
hef
il
einf
ormat
ionqui
ckl
y.
27.Howt
ocheckt
hei
ntegr
it
yofaf
il
esy
stem orconsi
stencyoft
hef
il
esy
stem?
Byr
unni
ngt
he#f
sck <dev
iceorpar
ti
ti
onname>commandwecancheckt
hei
ntegr
it
y
oft
hef
il
esy
stem.
Butbef
orer
unni
ngt
hef
sckcommandf
ir
stunmountt
hatpar
ti
ti
onandt
henr
unf
sck
command.
28.Whati
sfsckcheckorwhatar
ethephasesoft
hef
sck?
(
a)Fi
rsti
tchecksbl
ocksandsi
zesoft
hef
il
esy
stem
(
b)Secondi
tchecksf
il
esy
stem pat
hnames
(
c)Thi
rdi
tchecksf
il
esy
stem connect
ivi
ty
(
d)Four
thi
tchecksf
il
esy
stem r
efer
encecount
s(not
hingbuti
nodenumber
s)
(
e)Fi
nal
l
yitchecksf
il
esy
stem occupi
edcy
li
ndr
ical
groups
29.Whyt
hef
il
esy
stem shoul
dbeunmountbef
orer
unni
ngt
hef
sckcommand?

Rat
nakar
Page7
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

I
fwer
unf
sckonmount
edf
il
esy
stems,
itl
eav
est
hef
il
esy
stemsi
nunusabl
est
ateand
al
sodel
etest
hedat
a.
So,
bef
orer
unni
ngt
hef
sckcommandt
hef
il
esy
stem shoul
dbeunmount
ed.
30.Whi
cht
ypeoff
il
esy
stem pr
obl
emsy
ouf
ace?
(
i)Fi
l
esy
stem f
ull
(
ii
)Fi
l
esy
stem cor
rupt
ed
31.Howt
oext
endt
her
ootf
il
esy
stem whi
chi
snotonLVM?
Byusi
ng#gpar
ted commandwecanext
endt
her
ootpar
ti
ti
on,
other
wisewe
cannotext
endt
hef
il
esy
stems whi
chi
snotonLVM.
32.Howt
ounmountaf
il
esy
stem f
orcef
ull
y?
#umount -
f <mountpoi
nt>
#f
user -
ck <mountpoi
nt>
33.Howt
oknowt
hef
il
esy
stem t
ype?
#df -
hT (
commandgi
vest
hef
il
esy
stem t
ypei
nfor
mat
ion)
34.Howt
oknowwhi
chf
il
esy
stem occupymor
espaceandt
op10f
il
esy
stems?
#df -
h <dev
iceorpar
ti
ti
onname>|
sor
t-r|head -
10
35.Whati
sthecommandt
oknowt
hemount
edf
il
esy
stems?
#mount or#cat/
etc/
mtab
36.Howt
oknowwhet
hert
hef
il
esy
stem i
scor
rupt
edornot
?
Fi
rstunmountt
hef
il
esy
stemsandt
henr
unf
sckcommandont
hatf
il
esy
stem.
37.Howt
orecov
eri
faf
il
esy
stem i
scor
rupt
edorcr
ashed?
I
fthenor
mal
ornotr
elat
edt
oO/
Sfi
l
esy
stem i
scor
rupt
edf
ir
stunmountt
hatf
il
esy
stem
andr
unf
sckcommand ont
hatf
il
esy
stem andi
ftheO/
Srel
atedf
il
esy
stem i
s
cor
rupt
edt
henboott
hesy
stem wi
thCDROM i
nsi
ngl
e usermodeandr
unt
hef
sck
command.
I
fthenor
mal
ornotr
elat
edt
oO/
Sfi
l
esy
stem i
scr
ashedt
henr
est
orei
tfr
om t
her
ecent
backupandi
ftheO/
S r
elat
edf
il
esy
stem i
scr
ashedt
henboott
hesy
stem wi
th
CDROM i
nsi
ngl
eusermodeandr
est
orei
tfr
om t
her
ecentbackup.
38.Howt
ocr
eat
eaf
il
ewi
thpar
ti
cul
arsi
ze?
#ddi
f=/
dev
/zer
oof
=/or
afi
l
e bs=1MB count
=500(
tocr
eat
e500MBsi
ze/
oraf
il
ewi
th
4KBbl
ocksi
ze)
39.Howt
ofi
ndhowmanydi
skar
eat
tachedt
othesy
stem?
#f
disk -
l (
toseehowmanydi
skar
eat
tachedt
othesy
stem)
40.Whati
sjour
nal
ing?
I
tisadedi
cat
edar
eai
nthef
il
esy
stem wher
eal
lthechangesar
etr
ackedwhent
he
sy
stem cr
ashed.Sot
he possi
bil
i
tyoft
hef
il
esy
stem cor
rupt
ionorcr
ashesi
sless
becauseoft
hisj
our
nal
i
ngf
eat
ure.
41.Howt
orepai
rtheSuper
blockoft
hef
il
esy
stem?
Whenev
erwewantt
ost
oret
hedat
aint
othehar
ddi
sk,
ift
hei
nput
/out
puter
roroccur
s
t
hent
heSuper
blockof t
hef
il
esy
stem maybeer
asedorcor
rupt
ed.So,
wehav
eto

Rat
nakar
Page8
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
est
oreorr
epai
rthatSuper
block.
#umount <f
il
esy
stem mountpoi
nt> (
tounmountt
hef
il
esy
stem)
#dumpe2f
s </
dev
/vgname/
lvname>|
grepsuper
block (
tol
i
stt
hesuper
blocks
f
ir
stpr
imar
ysuper
blockand
t
hensecondar
ysuper
blockandsoon)
#e2f
sck -
b <copyandpast
ethesecondar
ysuperbl
ockf
rom t
heabov
e
l
i
st></
dev
/vgname/
lvname>
(
tor
est
oret
hedamaged
super
block)

#mount-
a (
tomountt
hef
il
esy
stem)
42.Howt
ocr
eat
ethef
il
esy
stemswi
tht
heuserspeci
fi
edsuper
blockr
eser
vespace?
#mkf
s.ext
4-m <no.
><par
ti
ti
onname>(
tof
ormatt
hepar
ti
ti
onwi
th<no.
>%ofr
eser
ve
spacet
osuper
block)
Whenev
erwef
ormatt
hef
il
esy
stem,bydefaulti
treser
vet
he5%par
ti
ti
onspacef
or
Super
block.

43.Howt
omodi
fyt
hesuper
blockr
eser
vespace?
#t
une2f
s-m <no.
><par
ti
ti
onname> (
tomodi
fyt
hesuper
blockr
eser
vespacet
o
<no.
>%)
I
mpor
tantCommands:
#f
sck <par
ti
ti
onname> (
tocheckt
heconsi
stencyoft
hef
il
esy
stem)
#e2f
sck<par
ti
ti
onname> (
tocheckt
heconsi
stencyoft
hef
il
esy
stem i
n
i
nter
act
ivemode)
#e2f
sck -
p <par
ti
ti
onname> (
tocheckt
heconsi
stencyoft
hef
il
esy
stem
wi
thouti
nter
act
ivemode)
#mke2f
s-n<par
ti
ti
onname> (
toseet
hesuper
blocki
nfor
mat
ion)
#mke2f
s-t<f
il
esy
stem t
ype><par
ti
ti
onname> (
tof
ormatt
hepar
ti
ti
oni
nthespeci
fi
ed
f
il
esy
stem t
ype)
#mke2f
s <par
ti
ti
onname> (
tof
ormatt
hepar
ti
ti
oni
ndef
aul
tex
t2f
il
esy
stem t
ype)
#bl
ockdev -
-get
bs /
dev
/sdb1 (
tocheckt
hebl
ocksi
zeoft
he/
dev
/sdb1f
il
e
sy
stem)
#f
sck<dev
iceorpar
ti
ti
onname> (
tocheckandr
epai
rthef
il
esy
stem)
Not
e:Bef
orer
unni
ngt
hiscommandf
ir
stunmountt
hatpar
ti
ti
on
t
henr
unf
sckcommand.

#umount-
a (
tounmountal
lthef
il
esy
stemsexcept(/)r
ootf
il
e
sy
stem)
#mount-
a (
tomountal
lthef
il
esy
stemswhi
char
ehav
ingent
ri
es
i
n/et
c/f
stabf
il
e)

Rat
nakar
Page9
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#f
sck -
A (
tor
unf
sckonal
lfi
l
esy
stems)
#f
sck -
AR -
y (
tor
unf
sckwi
thoutaski
nganyquest
ions)
#f
sck -
AR -
text
3-y (
tor
unf
sckonal
lext
3fi
l
esy
stems)
#f
sck -
AR -
tnoext
3-y (
tor
unf
sckonal
lfi
l
esy
stemsexceptext
3fi
l
esy
stems)
#f
sck -
n/dev
/sdb1 (
toseet
he/
dev
/sdb1f
il
esy
stem r
epor
twi
thout
r
unni
ngf
sck)
#t
une2f
s-l/
dev
/sdb1 (
tocheckwhet
hert
hej
our
nal
i
ngi
sther
eornot
)
#t
une2f
s-j/
dev
/sdb1 (
toconv
ertex
t2f
il
esy
stem t
oext
3fi
l
esy
stem)
#t
une2f
s-l/
dev
/sdb1 (
tocheckwhet
hert
hej
our
nal
i
ngi
saddedornot
)
#t
une2f
s-O^
has_
jour
nal/
dev
/sdb1 (
toconv
ertext
3fi
l
esy
stem t
oext
2fi
l
esy
stem)
#t
une2f
s-O di
r_i
ndex
,has_
jour
nal
,uni
t_bg /
dev
/sdb1 (
toconv
ertex
t2f
il
esy
stem t
o
ext
4fi
l
esy
stem)
#t
une2f
s-O ex
tent
s,di
r_i
ndex,
uni
t_bg /
dev
/sdb1 (
toconv
ertex
t3f
il
esy
stem t
o
ext
4fi
l
esy
stem)
#mount-
oremount
,rw /
dev
/sdb1 (
tomountt
hepar
ti
ti
onwi
thr
eadandwr
it
e
per
missi
ons)
#mount-
oremount
,ro /
dev
/sdb1 (
tomountt
hepar
ti
ti
onwi
thr
eadonl
y
per
missi
ons)
#mount<mountpoi
ntordi
rect
oryname> (
tocheckwhet
hert
hisdi
rect
oryi
smountpoi
nt
ornor
mal
dir
ect
ory
)
#dump2f
s <dev
iceorpar
ti
ti
onname> (
tocheckt
hemet
adat
aoft
hepar
ti
ti
onand
r
epai
rthemet
adat
a)
#f
disk -
l (
tol
i
stt
otal
har
ddi
sksat
tachedt
osy
stem andt
hei
r
par
ti
ti
ons)
#f
user-
cu <dev
iceorpar
ti
ti
onname>(
toseet
heuser
swhoar
eaccessi
ngt
hatf
il
e
sy
stem)
#f
user-
cK <dev
iceorpar
ti
ti
onname>(
toki
l
ltheuser
spr
ocesseswhoaccessi
ngt
hef
il
e
sy
stems)
Not
e:Ev
ent
houghweki
l
lthoseuser
spr
ocessessomet
imeswecannotunmount
t
hosepar
ti
ti
ons,
soi
fthi
s
si
tuat
ionar
isest
henf
ir
stseet
hepr
ocessi
d'
soft
heuseropenedf
il
esby#l
sof
<mountpoi
nt>and
ki
l
lthosepr
ocessesf
orcef
ull
yby #ki
ll-
9 <pr
ocessi
d>

#j
our
nal
ctl (
Itt
racksal
lthel
ogf
il
esbet
weent
wodi
ff
erentt
imi
ngsandbydef
aul
tsav
ed
i
n/r
un/
logl
ocat
ion)
*/
run/
log i
smount
edont
mpf
sfi
l
esy
stem.i
e.,
ifsy
stem i
sreboot
ed,
thewhol
e
i
nfor
mat
ioni
nthatl
ocat
ionwi
l
l
bedel
eted orer
ased.
*Wecanchanget
hel
ocat
ionoft
he /
run/
log t
oanot
herl
i
ke /
var
/log/
jour
nalby

Rat
nakar
Page10
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#mkdi
r-p /
var
/l
og/
jour
nal (
tomakeadi
rect
oryi
n/v
ar/
logl
ocat
ion)
#chown r
oot:
syst
emd-
jour
nal /
var
/l
og/
jour
nal (
tochanget
hegr
oupowner
shi
pof
/
var
/l
og/
jour
nal
)
#chmod g+s /
var
/l
og/
jour
nal (
tosett
hesgi
don /
var
/l
og/
jour
nal
)
#ki
l
lal
l-URS1 sy
stemd-
jour
nal
d (
Iti
snecessar
ytoki
l
lol
d/r
un/
log pr
ocess andt
he
l
ocat
ionofj
our
nal
messagesi
schangedt
o/v
ar/
log/
jour
nal
)
#j
our
nal
ctl-
n 5 (
todi
spl
ayl
astf
ivel
i
nesofal
lthel
ogf
il
es)
#j
our
nal
ctl-
p er
r (
todi
spl
ayal
ltheer
rormessages)
#j
our
nal
ctl-
f (
towat
chj
our
nal
ctl
messagescont
inuousl
y)
#j
our
nal
ctl -
-si
nce<t
oday
> or<y
est
erday
> (
toseeal
lthej
our
nal
ctl
messagessi
nce
t
oday ory
est
erday
)
#j
our
nal
ctl -
-si
nce "
dat
e" -
-unt
il"
dat
e"(
toseet
hej
our
nal
messagesbet
weent
he
speci
fi
edt
wodat
es)
#j
our
nal
ctl -
pid=1 (
toseet
hepi
d=1pr
ocessname)
#audi
tct
l (
toseet
heaudi
trepor
t)
#sar (
sarut
il
it
yist
owat
cht
hesy
stem act
ivi
tyr
epor
tli
ke
CPU,
memor
y,.
..
etc.
,
)
#smar
tct
l-H <har
ddi
skname> (
tocheckt
heheal
thoft
hespeci
fi
edhar
ddi
sk)
#smar
tct
l-i<har
ddi
skname> (
toseet
hei
nfor
mat
ionoft
hespeci
fi
edhar
ddi
sk)
#smar
tct
l-a <har
ddi
skname> (
itgi
vesmor
einf
ormat
ionoft
hespeci
fi
edhar
ddi
sk)
Not
e:I
ntheabov
ecommandr
esul
tsgot
oVal
ueandTr
eshf
iel
ds.I
fTr
eshi
smor
e
t
hant
heVal
uet
hen
i
mmedi
atel
yhar
ddi
skchangei
srequi
red.I
fTr
eshi
slowert
hant
heVal
uet
henhar
d
di
ski
sok.So, t
heTr
eshi
sal
way
slowert
hant
heVal
ue,
other
wisehar
d
di
skchangei
srequi
redi
mmedi
atel
yand
r
epor
tthi
smanager
.

2.Logi
cal
Vol
umeManagementandRAI
DLev
els

Rat
nakar
Page11
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

1. Whati
sLVM andwhywegof
orLVM?
Lv
m meansLogi
cal
Vol
umeManagement
.Thecombi
nat
ionof2ormor
ephy
sical
disk
i
nor
dert
omakeabi
g l
ogi
cal
diski
scal
l
edLogi
cal
Vol
ume.
I
fnor
mal
Linuxpar
ti
ti
oni
sful
landanappl
i
cat
ionr
equi
ressomemor
edi
skspace,
then
nor
mal
par
ti
ti
oncannot beext
endedf
ort
hatappl
i
cat
ionr
equi
rement
.Fort
hisf
ir
stwe
hav
etot
akeabackupoft
hatnor
mal
par
ti
ti
on, del
etet
hatpar
ti
ti
onandagai
ncr
eat
e
t
hatpar
ti
ti
onwi
thmor
edi
skspace,
for
matandmountt
hatpar
ti
ti
onand f
inal
l
yrest
oret
he
appl
i
cat
ionf
rom t
hebackup.Thi
spr
ocessr
equi
resdownt
ime.
So,
toov
ercomet
hispr
obl
em LVM concepti
scomi
ngi
ntot
hepi
ctur
e.Usi
ngt
hisLVM
wecanext
endorr
educe t
hef
il
esy
stemsasperr
equi
rementwi
thoutl
ossofanydat
a.
2. Whatar
ethecomponent
soft
heLVM?
 Phy
sical
Vol
ume(
PV)
 Phy
sical
Ext
ent(
PE)
 Vol
umeGr
oup(
VG)
 Logi
cal
Vol
ume(
LV)
 Logi
cal
Ext
ent(
LE)
Phy
sicalVol
ume(
PV):
I
tist
hest
andar
dpar
ti
ti
ont
hatweaddt
otheLVM.Nor
mal
l
yaphy
sical
vol
umei
sa
st
andar
dpr
imar
yorl
ogi
cal
par
ti
ti
onwi
tht
hepar
ti
ti
oncodeas8e.
Phy
sicalExt
ent(
PE):
I
tischunkofdi
skspace.Ev
eryphy
sical
vol
umei
sdi
vi
dedi
ntoanumberofequal
siz
ed
PEs.
Vol
umeGr
oup(
VG):
I
tiscomposedofagr
oupofphy
sical
vol
umesandl
ogi
cal
vol
umes.I
tist
he
or
gani
zat
ional
groupofLVM.
Logi
cal
Vol
ume(
LV):
I
tiscomposedofagr
oupofLEs.Wecanf
ormat(
makeaf
il
esy
stem)andmountany
f
il
esy
stem ont
hel
ogi
cal
vol
ume.Thesi
zeoft
hesel
ogi
cal
vol
umescaneasi
l
ybe
i
ncr
easedordecr
easedaspert
her
equi
rement
.
Logi
cal
Ext
ent(
LE):
I
tisal
soachunkofdi
skspace.Ev
eryl
ogi
cal
ext
enti
smappedt
oaspeci
fi
cphy
sical
ext
ent
.
3. Howt
ocr
eat
etheLVM,
makeaf
il
esy
stem andmountt
hatper
manent
ly?
(
i)Taket
wophy
sical
disksf
orexampl
e/dev
/sdb and /
dev
/sdc.i
fther
eisno
seconddi
skt
henmaket
he r
equi
redpar
ti
ti
onsusi
ng#f
diskcommandand
changet
hepar
ti
ti
oncodeas8e.
(
ii
)Conv
ertt
hePhy
sical
diski
ntophy
sical
vol
umesby
,
#pv
creat
e/dev
/sdb /
dev
/sdc
(
ii
i)Thencr
eat
ethev
olumegr
oupbycombi
ningphy
sical
vol
umesby
,
#v
gcr
eat
e<v
olumegr
oupname><phy
sicalv
olumenames> or

Rat
nakar
Page12
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#v
gcr
eat
e-s<PEsi
zei
nMBs><v
olumegr
oupname><phy
sicalv
olumenames>
(
iv)Thencr
eat
ethel
ogi
cal
vol
umeont
heabov
ecr
eat
edv
olumegr
oupby
,
#l
vcr
eat
e-L+<si
zei
nMBs> -
n<l
ogi
calv
olumename><Vol
umegr
oupname>or
#l
vcr
eat
e-l<no.ofPEs> -
n <l
ogi
calv
olumename><v
olumegr
oupname>
(
v)Makeaf
il
esy
stem ont
heabov
ecr
eat
edl
ogi
cal
vol
umeby
,
#mkf
s.ext
2/ext
3/ext
4/xf
s /
dev
/<v
olumegr
oupname>/
<logi
cal
vol
umename>

(
vi)Cr
eat
eamountpoi
ntt
omountt
heabov
ecr
eat
edLVM f
il
esy
stem by
,
#mkdi
r/mnt
/<di
rect
oryname>
(
vii
)Mountt
heLVM ont
heabov
ecr
eat
edmountpoi
ntt
empor
ari
l
yby
,
#mount/
dev
/<v
olumegr
oupname>/
<logi
calv
olumename><mountpoi
nt>or
Mountt
heLVM onmountpoi
ntper
manent
lyby
,
#v
im/
etc/
fst
ab
/
dev
/<VGname>/
<LVname>/
mnt
/<di
rect
ory
> <f
il
esy
stem t
ype> def
aul
ts
00
Esc+:
+wq!
#mount-
a
#df -
hT (
toseet
hemount
edpar
ti
ti
onswi
thf
il
esy
stem t
ypes)
4. Howt
oseet
hedet
ail
soft
hePhy
sicalVol
umes?
#pv
s (
displ
aysal
lphy
sical
vol
umeswi
thl
essdet
ail
s)
#pv
displ
ay (
displ
aysal
lphy
sical
vol
umeswi
thmor
edet
ail
s)
#pv
displ
ay <phy
sical
vol
umename> (
displ
ayst
hedet
ail
soft
hespeci
fi
edphy
sical
v
olume)
#pv
scan (
toscanal
lthephy
sical
vol
umes)
#pv
scan <PVname> (
toscant
hespeci
fi
edphy
sical
vol
ume)

5. Howt
oseet
hedet
ail
soft
heVol
umeGr
oups?
#v
gs (
displ
aysal
lvol
umegr
oupswi
thl
essdet
ail
s)
#v
gdi
spl
ay (
displ
aysal
lvol
umegr
oupswi
thmor
edet
ail
s)
#v
gdi
spl
ay <VGname>(
displ
ayst
hespeci
fi
edv
olumegr
oupwi
thmor
edet
ail
s)
#v
gscan (
toscanal
lthev
olumegr
oups)
#v
gscan <VGname> (
toscant
hespeci
fi
edv
olumegr
oup)
6. Howt
oseet
hedet
ail
soft
heLogi
calVol
umes?
#l
vs (
displ
aysal
ll
ogi
cal
vol
umeswi
thl
essdet
ail
s)
#l
vdi
spl
ay (
displ
aysal
ll
ogi
cal
vol
umeswi
thmor
edet
ail
s)
#l
vdi
spl
ay <LVname> (
displ
ayst
hespeci
fi
edl
ogi
cal
vol
umedet
ail
s)
#l
vscan (
toscanal
lthel
ogi
cal
vol
umes)
#l
vscan <LVname> (
toscant
hespeci
fi
edl
ogi
cal
vol
ume)
7. Howt
oext
endt
heVol
umeGr
oup?
 Ex
tendi
ngt
hev
olumegr
oupi
sact
ual
l
yaddi
nganewphy
sical
vol
umet
othe

Rat
nakar
Page13
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

v
olumegr
oup.
 Toex
tendt
hev
olumegr
oupweneedt
ocr
eat
eanewpar
ti
ti
onusi
ng#f
disk
commandandmakesur
ethati
t'
spar
ti
ti
oni
dshoul
dbe8e,
sav
ethechangesand
updat
ethepar
ti
ti
ont
abl
eby#par
tpr
obe
 Cr
eat
eaphy
sical
vol
umeont
henewl
ycr
eat
edpar
ti
ti
onusi
ng#pv
creat
e
command.
 Addt
hepar
ti
ti
ont
othev
olumegr
oupusi
ng#v
gext
endcommand
Exampl
e:#f
disk /
dev
/sdb
Command(
mforhel
p):
n
Fi
rstcy
li
nder:
pressEnt
erf
ordef
aul
tone
Lastcy
li
nder:
+500M (
creat
e500MBpar
ti
ti
on)
Command(
mforhel
p):
t (
tochanget
hepar
ti
ti
oni
d)
Sel
ectt
hepar
ti
ti
on:
typet
hepar
ti
ti
onnumber
Speci
fyt
heHex
acode:
8e
Command(
mforhel
p):
w (
tosav
ethechanges)
#par
tpr
obe /
dev
/sdb1
#pv
creat
e/dev
/sdb1
#v
gex
tend <VGname> /
dev
/sdb1
#v
gdi
spl
ay <VGname> (
tocheckt
hesi
zeoft
hev
olumegr
oup)
8. Howt
oext
endt
hel
ogi
calv
olumeandupdat
eit
'sf
il
esy
stem?
 Somet
imest
hef
il
esy
stem si
zemaybef
ull
,soweneedt
oincr
easet
hesi
zeoft
he
l
ogi
cal
vol
umet
ocont
inueaddi
ngt
hedat
aini
t.
 Thesi
zeoft
hel
ogi
cal
vol
umecanbei
ncr
easedonl
i
ne,
nodownt
imer
equi
red.
 Checkcur
rentsi
zeoft
hel
ogi
cal
vol
umeby#l
vdi
spl
ay<LVname>andt
hesi
zeof
t
hef
il
esy
stem by #df-
hT command.
 I
ncr
easet
hesi
zeoft
hel
ogi
cal
vol
umeby#l
vext
endor#l
vresi
zecommands.
 Thenf
inal
l
yupdat
ethef
il
esy
stem by#r
esi
ze2f
sor#xf
s_gr
owf
scommands.
Exampl
e:#df-
hT
#l
vext
end -
L +<si
zei
nMB></
dev
/vgname/
lvname> or
#l
vresi
ze-
L +<si
zei
nMB></
dev
/vgname/
lvname>
#r
esi
ze2f
s </
dev
/vgname/
lvname>
#l
vdi
spl
ay </
dev
/vgname/
lvname>(
tocheckt
hesi
zeoft
hel
ogi
cal
vol
ume)
#df -
hT (
tocheckt
hesi
zeoft
hef
il
e
sy
stem)
9. Howt
oreducet
hel
ogi
calv
olumeandupdat
ethef
il
esy
stem?
 Reduci
ngt
hesi
zeoft
hel
ogi
cal
vol
umei
sacompl
i
cat
edt
askandwehav
e
r
emembersomepoi
ntsbef
orer
educi
ngt
hel
ogi
cal
vol
ume,
other
wiset
hef
il
e
sy
stem maybedamaged.
 Logi
cal
vol
umesi
zecannotber
educedonl
i
neandi
trequi
resdownt
imebecause

Rat
nakar
Page14
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

wehav
etounmountt
hef
il
esy
stem by#umount<f
il
esy
stem mount
poi
nt>command.
 Checkt
heconsi
stencyoft
hef
il
esy
stem by#e2f
sck <dev
iceorpar
ti
ti
onname>
command.
 Reducet
hel
ogi
cal
vol
umeby#l
vreduce -
L -<Si
zeofi
n
MB></
dev
/vgname/
lvname>command.
 Thenupdat
ethef
il
esy
stem by#r
esi
ze2f
s </
dev
/vgname/
lvname>
 Fi
nal
l
ymountt
hef
il
esy
stem by#mount-
a
Exampl
e:#umount <f
il
esy
stem mountpoi
nt>
#e2f
sck <dev
iceorpar
ti
ti
onname>
#l
vreduce -
L-<si
zei
nMB></
dev
/vgname/
lvname>
#r
esi
ze2f
s </
dev
/vgname/
lvname>
#l
vdi
spl
ay </
dev
/vgname/
lvname>(
tocheckt
hesi
zeoft
hel
ogi
cal
vol
ume>
#mount-
a (
tomountt
hef
il
esy
stem)
#df -
hT (
tocheckt
hesi
zeoft
hef
il
esy
stem)
10.Howt
omov
eormi
grat
ethel
ogi
calv
olumedat
afr
om onephy
sicalv
olumet
oanot
her
phy
sicalv
olume?
 Ther
emi
ghtbeasi
tuat
ionwher
ethephy
sical
vol
umemi
ghtbef
ail
i
ngandi
tis
r
equi
redt
orepl
aced.I
nsuchcase,
weneedt
omi
grat
eormov
ethel
ogi
cal
vol
ume
dat
afr
om t
hef
ail
edphy
sical
vol
umenewphy
sical
vol
umeandi
sol
ate(
remov
e)
t
hef
ail
edphy
sical
vol
ume.
 Fi
rstaccesst
hemountpoi
ntoft
hef
ail
i
ngphy
sical
vol
umeandcheckt
hedat
aini
t.
 Ver
if
ythesi
zeoft
hephy
sical
vol
umeby#pv
s or#pv
displ
ay
</
dev
/vgname/
lvname>command.
 Unmountt
hef
il
esy
stem oft
hatphy
sical
vol
umeby#umount<f
il
esy
stem
mountpoi
nt>
 Addanewphy
sical
vol
umeandt
hesi
zeshoul
dbesamesi
zeorhi
ghert
hant
hat
f
ail
i
ngphy
sical
vol
ume.
 Mi
grat
ethephy
sical
vol
umecont
ent
stot
henewphy
sical
vol
umeusi
ng#
pv
mov
e<ol
dPV><newPV>
 Mountbackt
hel
ogi
cal
vol
ume,
accesst
hemountpoi
ntandv
eri
fyt
hedat
aini
t.
 Remov
ethef
ail
edt
hephy
sical
vol
umeby#v
greduce <v
gname><pv
name>
command.
Exampl
e:#cd <f
il
esy
stem mountpoi
nt>
#l
s
#pv
s <pv
name> or#pv
displ
ay <pv
name>
#umount<f
il
esy
stem mountpoi
nt>
#pv
creat
e <dev
iceorpar
ti
ti
onname>
#v
gext
end <v
gname><pv
name>

Rat
nakar
Page15
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#pv
mov
e <ol
dpv
name><newpv
name>
#mount-
a
#v
greduce <v
gname><f
ail
edpv
name>
#cd <f
il
esy
stem mountpoi
nt>
#l
s
11.Howt
odel
eteorr
emov
ethel
ogi
calv
olume?
 Todel
eteorr
emov
ethel
ogi
cal
vol
ume,
fir
stunmountt
hef
il
esy
stem by#umount
<mountpoi
nt>
 Remov
etheent
ryi
n/et
c/f
stabf
il
e.
 Remov
ethel
ogi
cal
vol
umeby#l
vremov
e </
dev
/vgname/
lvname>command.
 Ver
if
ywhet
hert
hel
ogi
cal
vol
umei
sremov
edornotby#l
vs or #l
vdi
spl
ay
command.
Exampl
e:#umount<f
il
esy
stem mountpoi
nt>
#v
im/
etc/
fst
ab (
del
etet
heent
ryoft
hel
ogi
cal
vol
ume)
Esc+:
+wq! (
sav
eandexi
tthef
il
e)
#l
vremov
e </
dev
/vgname/
lvname>
#l
vs or #l
vdi
spl
ay (
tov
eri
fywhet
herl
ogi
cal
vol
umei
s
r
emov
edornot
)
12.Howt
odel
eteorr
emov
ethev
olumegr
oup?
 Todel
eteorr
emov
ethev
olumegr
oup,
fir
stmakesur
ethatanyl
ogi
cal
vol
ume
shoul
dnotbemount
edbecausewhi
l
eremov
ingav
olumegr
oupi
twi
l
ldel
eteor
r
emov
ethel
ogi
cal
vol
umesi
nthatv
olumegr
oup.
 Thendel
eteorr
emov
ethev
olumegr
oupby#v
gremov
e <v
gname>command.
 Ver
if
ywhet
hert
hev
olumegr
oupi
sremov
eornotby#v
gs or #v
gdi
spl
ay
command.
Exampl
e:#umount <f
il
esy
stem mountpoi
nt> (
tounmountt
hef
il
e
sy
stem i
fther
eisanyLV)
#v
im /
etc/
fst
ab (
del
etet
heent
ryoft
hel
ogi
cal
v
olume)
Esc+:
+wq! (
sav
eandexi
tthef
il
e)
#v
gremov
e <v
gname>
#v
gs or #v
gdi
spl
ay (
tov
eri
fywhet
herv
olume
gr
oupi
sremov
edornot
)
13.Howt
odel
eteorr
emov
ethephy
sical
vol
ume?
 Del
eti
ngorr
emov
ingaphy
sical
vol
umei
sver
ysi
mpl
eandt
heonl
ythi
ngwe
shoul
dcheckt
hatt
hephy
sical
vol
umewear
egoi
ngt
odel
eteshoul
dnotbel
ongt
o
anyv
olumegr
oupi
e.,
wecanonl
ydel
eteorr
emov
ethephy
sical
vol
umewhi
chi
s
f
ree.
 Thendel
eteorr
emov
ethephy
sical
vol
umeby#pv
remov
e <pv
name>command.

Rat
nakar
Page16
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

 Ver
if
ywhet
hert
hephy
sical
vol
umei
sremov
edornotby#pv
s or #pv
displ
ay
command.
Exampl
e:#pv
remov
e <pv
name>
#pv
s or #pv
displ
ay (
tov
eri
fywhet
hert
hephy
sical
vol
umei
s
r
emov
edornot
)
14.Howt
orest
oret
hev
olumegr
oupwhi
chi
sremov
edmi
stakenl
y?
 Fi
rstunmountf
il
esy
stem by#umount<f
il
esy
stem mountpoi
nt>command.
 Checkt
hev
olumegr
oupbackupl
i
stby#v
gcf
grest
ore -
-l
ist<v
olumegr
oup
name>command.
 Thenr
emov
ethel
ogi
cal
vol
umeby#l
vremov
e </
dev
/vgname/
lvname>
command.
 Copyt
hebackupf
il
ewhi
chi
stakenbackupbef
orer
emov
edt
hev
olumegr
oup
f
rom t
heabov
ebackupl
i
standpast
eiti
nthi
scommand#v
gcf
grest
ore -
f
<past
etheabov
ecopi
edf
il
ename><v
gname>
 Thel
ogi
cal
vol
umei
scr
eat
edaut
omat
ical
l
yaf
terr
est
ori
ngt
hev
olumegr
oupbut
t
hev
olumegr
oupandl
ogi
cal
vol
umesbot
hwi
l
lbei
ninact
ivest
ate.So,
checkt
he
st
ateoft
hev
olumegr
oupby#v
gscanandt
hel
ogi
cal
vol
umest
ateby#l
vscan
commands.
 Thenact
ivat
ethatv
olumegr
oupby#v
gchange -
ay <v
olumegr
oup
name>commandandact
ivat
ethel
ogi
cal
vol
umeby#l
vchange -
ay <l
ogi
cal
v
olumename>command.
 Mountt
hel
ogi
cal
vol
umef
il
esy
stem by#mount-
acommand.
Exampl
e:#umount <f
il
esy
stem mountpoi
nt>
#v
gcf
grest
ore -
-l
ist<v
olumegr
oupname> (
copyt
hebackupf
il
e
f
rom t
hel
i
st)
#l
vremov
e </
dev
/vgname/
lvname>
#v
gcf
grest
ore -
f <past
etheabov
ecopi
edf
il
e><v
olumegr
oupname>
#v
gscan (
tocheckt
hest
atusoft
he
v
olumegr
oup)
#l
vscan (
tocheckt
hest
atusof
t
hel
ogi
cal
vol
ume)
#v
gchange -
ay <v
olumegr
oupname> (
act
ivat
ethev
olumegr
oupi
fiti
s
i
ninact
ivest
ate)
#l
vchange -
ay <l
ogi
cal
vol
umename> (
act
ivat
ethel
ogi
cal
vol
umei
fiti
s
i
ninact
ivest
ate)
Not
e:Theopt
ion a meansact
iveVGorLV andopt
ion y
meansyes.
#mount-
a
15.Howt
ochanget
hev
olumegr
oupnameandot
herpar
amet
ers?

Rat
nakar
Page17
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#v
grename <exi
sti
ngv
olumegr
oupname><newv
olumegr
oupname>(
tor
enamet
he
v
olumegr
oup)
Bydef
aul
t,unl
i
mit
edl
ogi
cal
vol
umescanbecr
eat
edperv
olumegr
oup.Butwecan
cont
rol
thi
sli
mitby
#v
gchange -
l<no.
><v
olumegr
oup> (
tol
i
mitmax.no.ofl
ogi
cal
vol
umest
othe
speci
fi
ednumber
)
Exampl
e:#v
gchange-
l2<v
gname> (
tol
i
mitmax.2l
ogi
cal
vol
umescabbecr
eat
ed
i
nthi
svol
umegr
oup)
#v
gchange -
p<no.
><v
olumegr
oup> (
tol
i
mitmax.no.ofphy
sical
vol
umest
othe
speci
fi
ednumber
)
Exampl
e:#v
gchange-
p2<v
gname>(
tol
i
mitmax.2phy
sical
vol
umescanbeadded
t
othi
svol
umegr
oup)
#v
gchange -
s<bl
ocksi
zei
nno.
><v
olumegr
oup> (
tochanget
hebl
ocksi
ze
oft
hev
olumegr
oup)
Exampl
e:#v
gchange -
s 4<v
gname> (
tochanget
hev
olumegr
oupbl
ocksi
ze
t
o4MB)
16.Howt
ochanget
hel
ogi
calv
olumenameandot
herpar
amet
ers?
#l
vrename <exi
sti
ngl
vname><newl
vname> (
tor
enamet
hel
ogi
cal
vol
ume)
#l
vchange -
pr<l
ogi
cal
vol
ume> (
toputt
hel
ogi
cal
vol
umei
ntor
eadonl
ymode)
#l
vs (
toseet
hel
ogi
cal
vol
umeper
missi
ons)
#l
vchange -
prw <l
ogi
cal
vol
ume> (
toputt
hel
ogi
cal
vol
umei
ntor
eadandwr
it
e
mode)
17.Howt
odi
sabl
ethev
olumegr
oupandl
ogi
calv
olume?
#v
gchange -
an <v
olumegr
oup> (
todi
sabl
ethev
olumegr
oup)
#l
vchange -
an <l
ogi
cal
vol
ume> (
todi
sabl
ethel
ogi
cal
vol
ume)
18.Howt
otakeabackupoft
hev
olumegr
oup?
#v
gcf
gbackup (
tot
akeabackupofal
lvol
umegr
oups)
#v
gcf
gbackup <v
olumegr
oup> (
tot
akeabackupoft
hespeci
fi
edv
olumegr
oup)
19.Whati
stheconf
igur
ati
onf
il
eoft
hel
ogi
cal
vol
ume?
#cat/
etc/
lvm/
lvm.
conf (
toseet
hecont
ent
soft
heLVM conf
igur
ati
onf
il
e)
20.Whatar
ethel
ocat
ionsoft
hel
ogi
cal
vol
umeandv
olumegr
oups?
#cd/
etc/
lvm/
backup (
thel
ogi
cal
vol
umesbackupl
ocat
ion)
#cd/
etc/
lvm/
archi
ve (
thev
olumegr
oupsbackupl
ocat
ion)
21.Howt
oknowt
hecur
rentv
ersi
onoft
heLVM package?
#r
pm -
qa l
vm* (
toknowt
hecur
rentv
ersi
onoft
heLVM package)
22.Whatar
etheat
tri
but
esoft
hev
olumegr
oup?
#v
gs (
toseet
heat
tri
but
esoft
hev
olumegr
oup)
[Theat
tri
but
esar
ew-
--
->wr
it
abl
e z-
--
->ex
tendabl
e n-
--
->nor
mal
]
#v
gs -
v (
tocheckt
heUUI
Doft
hev
olumegr
oup)
23.Howt
oext
endt
hel
ogi
calv
olumet
omax.di
skspaceandhal
foft
hedi
skspace?

Rat
nakar
Page18
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#l
vext
end -
l+100%FREE <l
ogi
cal
vol
ume> (
toext
endt
hel
ogi
cal
vol
umebyaddi
ng
t
hev
olumegr
oup'
s
t
otal
avai
l
abl
espace)
#l
vext
end -
l50% <v
gname><l
vname> (
toext
endt
hel
ogi
cal
vol
umeby
addi
ngt
he50%f
reespace
oft
hev
olumegr
oup)
24.Howt
ocheckonwhi
chphy
sicalv
olumet
hedat
aiswr
it
ingi
nthel
ogi
calv
olume?
#l
vdi
spl
ay -
m (
tocheckonwhi
chphy
sical
vol
umet
hedat
ais
cur
rent
lywr
it
ingf
rom al
l
l
ogi
cal
vol
umes)
#l
vdi
spl
ay -
m <l
vname> (
tocheckonwhi
chphy
sical
vol
umet
hedat
ais
wr
it
ingf
rom t
hespeci
fi
ed
l
ogi
cal
vol
ume)
25.Howmanyt
ypesoff
il
esy
stemsav
ail
abl
e?
ext
2--
--
>Secondext
endedf
il
esy
stem (
def
aul
tinRHEL-3&4)
ext
3--
--
>Thi
rdext
endedf
il
esy
stem (
def
aul
tinRHEL-5)
ext
4--
--
>Four
thext
endedf
il
esy
stem (
def
aul
tinRHEL-6)
xf
s--
--
>Ext
endedf
il
esy
stem (
def
aul
tinRHEL-7)
uf
s--
--
>Uni
xfi
l
esy
stem (
def
aul
tinSol
ari
s)
j
fs-
--
->Jour
nal
fil
esy
stem (
def
aul
tinI
BM-
AIX)
hf
s--
--
>Hi
ghper
for
mancef
il
esy
stem (
def
aul
tinHP-
UX)
v
xfs-
--
->Ver
it
asf
il
esy
stem
pr
ocf
s--
--
>Pr
ocessf
il
esy
stem (
tempor
ary
)
t
empf
s--
--
>Tempor
aryf
il
esy
stem (
tempor
ary
)
cdf
s--
--
>Compactdi
skf
il
esy
stem
hdf
s--
--
>DVDf
il
esy
stem
i
so9660-
--
->Tor
eadt
heCD/
DVD.
isoi
magef
ormatf
il
esi
nLi
nux
26.Howt
oscananddet
ectt
hel
unsov
ert
henet
wor
k?
#l
s/sy
s/cl
ass/
fc_
host (
tocheckt
heav
ail
abl
efi
bre
channel
s)
#echo"
--
-">/
sys/
class/
scsi
_host
/<l
unno.
>/scan (
toscananddet
ectt
he
l
unsov
ert
henet
wor
k)
27.Howt
omountapendr
ivei
nLi
nux?
#l
susb or #f
disk -
l (
toknowt
hependr
ivename)
#mkdi
r/mnt
/pendr
ive (
tocr
eat
eamountpoi
ntf
orpendr
ive)
#mount<pendr
ivename><mountpoi
nt> (t
omountt
hependr
iveont
heabov
e
cr
eat
edmountpoi
nt)
#cd /
mnt
/pendr
ive (
toaccesst
hependr
ive)
28.Howt
omountaCD/
DVDROM dr
ivesi
nLi
nux?
TheCD/
DVDROM dev
icenamei
nLi
nuxi
s/dev
/cdr
om

Rat
nakar
Page19
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#mkdi
r/mnt
/my
cdr
om (
tocr
eat
ethemountpoi
ntf
orCD/
DVD)
#mount/
dev
/cdr
om /
mnt
/my
cdr
om(
tomountt
heCD/
DVDont
heabov
ecr
eat
ed
mountpoi
nt)
#cd/
mnt
/my
cdr
om (
toaccesst
heCD/
DVDROM dr
ives)
29.Howt
omountt
he".
iso"i
magef
il
esi
nLi
nux?
#mount-
tiso9660 /
root
/rhel
6.i
so /
iso-
oro,
loop (
tomountt
he.
isoi
mage
f
il
es)
#cdr
ecor
d/r
oot
/Deskt
op/
rhel
6.i
so (
towr
it
etheCD/
DVDROM.Bef
oreexecut
ing
t
hiscommandputt
he
empt
yCD/
DVDi
ntoCD/
DVDdr
ive)
#ej
ect (
toej
ectt
heCD/
DVDdr
ivet
ray
)
#ej
ect-
t (
toi
nser
tandcl
oset
heCD/
DVDdr
ivet
ray
)
30.Whati
sRAI
D?Whati
stheuseoft
heRAI
Dandhowmanyt
ypesofRAI
Dsav
ail
abl
e?
RAI
Dst
andsf
orRedundantAr
rayofI
ndependentDi
sks.
I
tpr
ovi
desf
aul
ttol
erance,
loadbal
anci
ngusi
ngst
ri
ppi
ng,
mir
ror
ingandpar
it
yconcept
s.
Ther
ear
emai
nlyt
wot
ypesofRAI
Dsav
ail
abl
e.
(
i)Har
dwar
eRAI
D(Dependsonv
endor
sandal
somor
eexpensi
ve)
(
ii
)Sof
twar
eRAI
D(Doesnotdependsonv
endor
sandl
essexpensi
vewhencompar
ed
t
oHar
dwar
eRAI
Dand al
soi
tismai
ntai
nedbysy
stem admi
nist
rat
oronl
y.
31.Howmanyt
ypesofsof
twar
eRAI
Dsav
ail
abl
eandt
hei
rrequi
rement
s?
(
i) RAI
D-0 -
--
-St
ri
ppi
ng -
--
-Mi
nimum 2di
sksr
equi
red
(
ii
)RAI
D-1 -
--
-Mi
rr
ori
ng -
--
-Mi
nimum 2di
sksr
equi
red
(
ii
i)RAI
D-(
1+0)-
-- Mi
rr
ori
ng+St
ri
ppi
ng-
--
-Mi
nimum 4di
sksr
equi
red
(
iv)RAI
D-(
0+1)-
-- St
ri
ppi
ng+Mi
rr
ori
ng-
--
-Mi
nimum 4di
sksr
equi
red
(
v)RAI
D-5 -
--
-St
ri
ppi
ngwi
thpar
it
y--
-- Mi
nimum 3di
sksr
equi
red
32.Howt
oconf
igur
eRAI
D-0i
nLi
nux?
 Toconf
igur
eRAI
D-0,
mini
mum 2di
sksar
erequi
redandt
hepar
ti
ti
oni
dis"
fd"
.
 Readi
ngandwr
it
ingi
sver
yfast
.So,
itpr
oduceshi
ghper
for
mance.
 i
fonedi
ski
sfai
l
edwecannotr
ecov
ert
hedat
a.
 So,
ther
eisnor
edundancyandf
aul
ttol
erancei
nRAI
D-0.
Exampl
e:Forex
ampl
eift
hedat
ais1,
2,3,
4,5and6t
hen.
..
.

3 2

5 4

Di
sk-1 Di
sk-2

I
ftheDi
sk-1i
s/dev
/sdb andt
heDi
sk-2i
s/dev
/sdc t
hen,

Rat
nakar
Page20
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#mdadm -
Cv/
dev
/md0 -
n2 /
dev
/sdb /
dev
/sdc -
l0 (
tocr
eat
etheRAI
D-0
usi
ngdi
sk-1anddi
sk-2)
#cat/
proc/
mdst
at (
tocheckt
heRAI
D-0i
s
cr
eat
edornot
)
#mkf
s.ex
t4/
dev
/md0 (
tocr
eat
etheext
4fi
l
esy
stem on
t
heRAI
D-0)
#mkdi
r/mnt
/rai
d0 (
tocr
eat
etheRAI
D-0mount
poi
nt)
#mount/
dev
/md0 /
mnt
/rai
d0 (
tomountRAI
D-0ont
he
mountpoi
nt)
#mdadm -
D/dev
/md0 (
toseet
hedet
ail
soft
heRAI
D-0
par
ti
ti
on)
#mdadm /
dev
/md0 -
f/dev
/sdb (
tof
ail
edt
hedi
skmanual
l
y)
#mdadm /
dev
/md0 -
r/dev
/sdb (
tor
emov
etheabov
efai
l
eddi
sk)
#mdadm /
dev
/md0 -
a/dev
/sdd (
toaddt
henewdi
ski
npl
aceof
f
ail
eddi
sk)
#umount/
mnt
/rai
d0 (
tounmountt
her
aidf
il
esy
stem)
#mdadm -
-st
op /
dev
/md0 (
tost
opt
heRAI
D-0v
olume)
#mdadm /
dev
/md0 -
-add /
dev
/sde (
toaddt
hir
ddi
skt
otheRAI
D-0
v
olume)
#mdadm -
-gr
ow /
dev
/md0 -
-r
aid_
dev
ice=3 (
togr
owt
heRAI
D-0f
il
esy
stem)
33.Howt
oconf
igur
eRAI
D-1i
nLi
nux?
 Toconf
igur
eRAI
D-1,
mini
mum 2di
sksar
erequi
redandt
hepar
ti
ti
oni
dis"
fd"
.
 I
nthi
sthesamedat
awi
l
lbewr
it
tenon2di
sksi
e.,
exactcopyonbot
hthedi
sks.
 i
fonedi
ski
sfai
l
edwecanr
ecov
ert
hedat
afr
om anot
herdi
sk.
 So,
ther
eisahi
ghav
ail
abi
l
ity
,redundancyandf
aul
ttol
erancei
nRAI
D-1.
 I
nthi
swr
it
ingspeedi
ssl
owcompar
edt
oRAI
D-0.
Exampl
e:Forex
ampl
eift
hedat
ais1,
2,3,
4,5and6t
hen.
..
.
1
2 1
3 2
4 3
5 4
6 5
6

Di
sk-1 Di
sk-2

I
ftheDi
sk-1i
s/dev
/sdb andt
heDi
sk-2i
s/dev
/sdc t
hen,
#mdadm -
Cv/
dev
/md0 -
n2 /
dev
/sdb /
dev
/sdc -
l1 (
tocr
eat
etheRAI
D-1

Rat
nakar
Page21
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

usi
ngdi
sk-1anddi
sk-2)
#cat/
proc/
mdst
at (
tocheckt
heRAI
D-1i
s
cr
eat
edornot
)
#mkf
s.ex
t4/
dev
/md0 (
tocr
eat
etheext
4fi
l
esy
stem on
t
heRAI
D-1)
#mkdi
r/mnt
/rai
d1 (
tocr
eat
etheRAI
D-1mount
poi
nt)
#mount/
dev
/md0 /
mnt
/rai
d1 (
tomountRAI
D-1ont
he
mountpoi
nt)
#mdadm -
D/dev
/md0 (
toseet
hedet
ail
soft
heRAI
D-1
par
ti
ti
on)
#mdadm /
dev
/md0 -
f/dev
/sdb (
tof
ail
edt
hedi
skmanual
l
y)
#mdadm /
dev
/md0 -
r/dev
/sdb (
tor
emov
etheabov
efai
l
eddi
sk)
#mdadm /
dev
/md0 -
a/dev
/sdd (
toaddt
henewdi
ski
npl
aceof
f
ail
eddi
sk)
#umount/
mnt
/rai
d1 (
tounmountt
her
aidf
il
esy
stem)
#mdadm -
-st
op /
dev
/md0 (
tost
opt
heRAI
D-1v
olume)
#mdadm /
dev
/md0 -
-add /
dev
/sde (
toaddt
hir
ddi
skt
otheRAI
D-1
v
olume)
#mdadm -
-gr
ow /
dev
/md0 -
-r
aid_
dev
ice=3 (
togr
owt
heRAI
D-1f
il
esy
stem)
34.Howt
oconf
igur
eRAI
D-5i
nLi
nux?
 Toconf
igur
eRAI
D-5,
mini
mum 3di
sksar
erequi
redandt
hepar
ti
ti
oni
dis"
fd"
.
 I
nev
erydi
skappr
oxi
mat
ely25-30%ofspacei
sreser
vedf
orpar
it
y.
 Readi
ngandwr
it
ingi
sver
yfast
.So,
itpr
oduceshi
ghper
for
mance.
 Thi
sisusedSt
ri
ppi
ngwi
thpar
it
yconcept
.
 i
fonedi
ski
sfai
l
edwecanr
ecov
ert
hedat
ausi
ngr
emai
ningt
wodi
sksandpar
it
y.
 I
ftwodi
sksar
efai
l
ed,
thenwecannotr
ecov
ert
hedat
a.
 So,
ther
eisnor
edundancyandf
aul
ttol
erancei
nRAI
D-5.
Exampl
e:Forex
ampl
eift
hedat
ais1,
2,3,
4,5and6t
hen.
..
.

3+4 2

6 3 1+2
5+6 4

Di
sk-1 Di
sk-2 Di
sk-3

I
ftheDi
sk-1i
s/dev
/sdb,t
heDi
sk-2i
s/dev
/sdcandDi
sk-3i
s/dev
/sddt
hen,

Rat
nakar
Page22
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#mdadm -
Cv/
dev
/md0 -
n2 /
dev
/sdb /
dev
/sdc -
l5 (
tocr
eat
etheRAI
D-5
usi
ngdi
sks-1,
2and3)
#cat/
proc/
mdst
at (
tocheckt
heRAI
D-5i
s
cr
eat
edornot
)
#mkf
s.ex
t4/
dev
/md0 (
tocr
eat
etheext
4fi
l
esy
stem on
t
heRAI
D-5)
#mkdi
r/mnt
/rai
d5 (
tocr
eat
etheRAI
D-5mount
poi
nt)
#mount/
dev
/md0 /
mnt
/rai
d5 (
tomountRAI
D-5ont
he
mountpoi
nt)
#mdadm -
D/dev
/md0 (
toseet
hedet
ail
soft
heRAI
D-5
par
ti
ti
on)
#mdadm /
dev
/md0 -
f/dev
/sdb (
tof
ail
edt
hedi
skmanual
l
y)
#mdadm /
dev
/md0 -
r/dev
/sdb (
tor
emov
etheabov
efai
l
eddi
sk)
#mdadm /
dev
/md0 -
a/dev
/sde (
toaddt
henewdi
ski
npl
aceof
f
ail
eddi
sk)
#umount/
mnt
/rai
d5 (
tounmountt
her
aidf
il
esy
stem)
#mdadm -
-st
op /
dev
/md0 (
tost
opt
heRAI
D-5v
olume)
#mdadm /
dev
/md0 -
-add /
dev
/sdf (
toaddf
our
thdi
skt
otheRAI
D-5
v
olume)
#mdadm -
-gr
ow /
dev
/md0 -
-r
aid_
dev
ice=4 (
togr
owt
heRAI
D-5f
il
esy
stem)
35.Whatar
ethemai
nadv
ant
agesofRAI
D-5
RAI
D-5usesSt
ri
ppi
ngwi
thpar
it
yandr
equi
resonl
ythr
eedi
sks.BecauseofSt
ri
ppi
ng
t
hedat
areadi
ngand wr
it
ingwi
l
lbef
ast
.Andbyusi
ngpar
it
ywecanr
ecov
ert
hedat
aifone
oft
het
hreedi
sksf
ail
ed.So,
themai
n adv
ant
ageofRAI
D-5wecangetf
astwr
it
ing,
r
eadi
ngandal
sor
edundancyf
aul
ttol
erancewi
thl
essexpensi
ve.
36.Howwi
lly
out
roubl
eshooti
foneoft
heei
ghtdi
sksf
ail
edi
nLVM?
Fi
rstumountt
hef
il
esy
stem andaddt
henewdi
skwi
thsamesi
zeoft
hef
ail
eddi
skt
o
t
hev
olumegr
oup. Thenmov
ethedat
afr
om f
ail
edphy
sical
vol
umet
onewl
yadded
phy
sical
vol
umeandt
henr
emov
ethef
ail
edphy
sical
vol
umef
rom t
hev
olumegr
oup.And
f
inal
l
ymountt
hef
il
esy
stem.
37.Whati
spv
mov
eandwheni
tisusedi
nLVM?
Thepv
mov
ecommandi
susedt
omov
ethedat
afr
om f
ail
edphy
sical
vol
umet
onewl
y
addedphy
sical
vol
ume. Thi
scommandi
susedwhenoneoft
hephy
sical
vol
umei
s
f
ail
edi
ntheLVM.
38.Howt
oinf
ormt
hecl
ientandt
hent
roubl
eshooti
fthedi
ski
sful
l?
Fi
rstcheckwhi
chf
il
esar
eaccessi
ngmor
edi
skspaceby#du-
h|sor
t-rcommand.i
f
anyt
empor
aryandj
unk f
il
esar
epr
esentr
emov
ethem f
rom t
hedi
skt
omakear
oom
f
orneworupdat
eddat
a.Theni
nfor
mtheact
ual si
tuat
iont
othecl
i
ent
,taket
he
per
missi
onf
rom t
hecl
i
entt
ogett
hel
unf
rom st
orageandex
tendt
hef
il
esy
stem byaddi
ng

Rat
nakar
Page23
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
hatl
unt
otheLVM.
39.Di
dyouwor
konst
orage?
Act
ual
l
yIdi
dnotwor
konst
oragebutIknowt
hepr
ocedur
ehowt
oexpor
tthel
unf
rom
st
oraget
ocl
i
entusi
ng i
SCSIt
arget
.Thenscant
hatl
unatcl
eintsi
deandaddt
hel
un
t
otheLVM.Ial
soknowt
hest
oragehar
dwar
efr
om Emcsquar
e,Net
appandot
her
s.AndI
am dr
eami
ngt
owor
konst
orage,
cloudandv
irt
ual
i
zat
ion.
40.Ihav
efourdi
skseach1TBi
nRAI
D-(
1+0)
.So,
tot
alhowmuchdi
skspacecanIut
il
ize
i
nthatRAI
D-(
1+0)
? RAI
D-(
1+0)meansMi
rr
ori
ng+St
ri
ppi
ng.I
trequi
res4di
sks,
ie.
,2
di
sksf
ormi
rr
ori
ngandr
emai
ning2di
sksf
or st
ri
ppi
ng.And5-10%di
skspacei
sused
f
orsuper
blocki
nfor
mat
ion.So,
final
l
ywecanut
il
ize2TB-2TBX10% di
skspacei
nthat
RAI
D-(
1+0)
.
41.I
ftwodi
sksf
ail
edi
nRAI
D-(
1+0)
,canwer
ecov
ert
hedat
a?
TheRAI
D-(
1+0)r
equi
resmi
nimum 4di
sksandi
tusesMi
rr
ori
ng+St
ri
ppi
ng.I
fonedi
sk
i
sfai
l
edwecanr
ecov
er t
hedat
a,buti
ftwodi
sksar
efai
l
edwecannotr
ecov
ert
hedat
a.
42.Howmanyt
ypesofdi
skspacei
ssuescanwenor
mal
lyget
?
(
i) Di
ski
sful
l
.
(
ii
)Di
ski
sfai
l
ingorf
ail
ed.
(
ii
i)Fi
l
esy
stem cor
rupt
edorcr
ashed.
(
iv)O/
Sisnotr
ecogni
zi
ngt
her
emot
elunswhenscanni
ng,
..
.et
c.,
43.Whati
sal
inkf
il
eandhowmanyt
ypes?
Li
nkf
il
eisashor
tcutf
il
etot
heor
igi
nal
fil
e.Cr
eat
ingandr
emov
ing(
del
eti
ng)i
nks
bet
weent
wof
il
esi
sknown asmanagi
ngl
i
nks.Ther
ear
etwot
ypesofl
i
nksf
il
esav
ail
abl
e
i
nLi
nux.
(
i)Sof
tli
nk
(
ii
)Har
dli
nk
44.Whati
ssof
tli
nkandhowt
ocr
eat
eit
?
Sof
tli
nki
snot
hingbutashor
tcutf
il
e.I
for
igi
nal
fil
eisdel
eted,
nouseofshor
tcutf
il
e.
i
e.,
wecannotaccesst
heor
igi
nal
dat
a bysel
ect
ingt
hel
i
nkf
il
e.Sof
tli
nkcanbeappl
i
ed
onbot
hdi
rect
ori
esandf
il
es.Thesef
il
escanbest
oredi
nanyof t
hef
il
esy
stem.i
e.,
the
or
igi
nal
fil
emaybei
nonef
il
esy
stem andt
hel
i
nkf
il
emaybeonanot
herf
il
esy
stem.I
f we
edi
tanyf
il
e,t
hel
i
nkf
il
esar
eal
soupdat
edaut
omat
ical
l
y.Whenwecr
eat
easof
tli
nkf
il
e,t
he
per
missi
onsar
e f
ull
per
missi
ons.Thesof
tli
nkf
il
eandt
heor
igi
nal
fil
einodeno'
sar
e
di
ff
erent
.Thesi
zeoft
hesof
tli
nkf
il
eissame ast
hel
engt
hoft
heor
igi
nal
fil
ename.
Thesof
tli
nkcanbecr
eat
edby
#l
n -
s <or
igi
nal
fil
eordi
rect
ory
><l
i
nkf
il
eordi
rect
ory
wit
hpat
h> (
to
cr
eat
easof
tli
nk)
#l
n-s/
root
/scr
ipt /
root
/Deskt
op/
scr
ipt (
tocr
eat
eal
i
nkf
il
efort
hescr
iptand
st
oredonr
ootDeskt
op)
45.Whati
shar
dli
nkandhowt
ocr
eat
eit
?
Har
dli
nki
nnot
hingbutabackupf
il
e.I
ftheor
igi
nal
fil
eisdel
eted,
ther
eisnoef
fecton

Rat
nakar
Page24
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

har
dli
nkf
il
e.i
e.,
wecan accesst
heor
igi
nal
fil
edat
aev
ent
hought
hel
i
nkf
il
eisdel
eted.
Har
dli
nkscanbeappl
i
edonf
il
esonl
ynoton di
rect
ori
es.Har
dli
nkf
il
escanbest
ored
i
nthesamef
il
esy
stem.i
e.,
ori
ginal
andhar
dli
nkf
il
esbot
hshoul
dbei
n t
hesamef
il
e
sy
stem notondi
ff
erentf
il
esy
stems.Thei
nodeno'
sar
esamef
oror
igi
nal
andhar
dli
nkf
il
es.
I
fthe or
igi
nal
isedi
ted,
theupdat
ionsar
eappl
i
edonbot
hor
igi
nal
andhar
dli
nkf
il
es.The
si
zeoft
hehar
dli
nkf
il
eis sameast
hesi
zeoft
heor
igi
nal
fil
e.
46.Whatar
ethecommandst
osear
chf
il
esanddi
rect
ori
es?
Tosear
chf
il
esanddi
rect
ori
est
her
ear
etwocommands.
(
i)#l
ocat
e
(
ii
)#f
ind
47.Expl
aint
hel
ocat
ecommandandhowt
ousei
t?
l
ocat
eal
way
slookst
hel
ocat
edat
abaseandnoti
naspeci
fi
clocat
ion.Thedat
aoft
he
l
ocat
eisst
oredi
n /
var
/li
b/ml
ocat
e/ml
ocat
e.db f
il
e.I
fthedat
aisnotupdat
edi
nlocat
e
dat
abaseort
hel
ocat
edat
abasei
s av
ail
abl
eorl
ocat
edat
abasei
sdel
eted,
wecannot
l
ocat
ethef
il
esanddi
rect
ori
es.#updat
edbi
sthecommand t
oupdat
ethel
ocat
e
dat
abase.l
ocat
edat
abasecannotbef
indt
henewl
ycr
eat
edf
il
esanddi
rect
ori
es.I
tisnot
r
ecommendedt
ouseonpr
oduct
ionser
ver
sbecausei
timpact
sonper
for
manceoft
he
ser
ver
s.So,
toov
ercome t
hispr
obl
em wenor
mal
l
yuse #f
ind commandon
pr
oduct
ionser
ver
s.
#updat
edb (
toupdat
ethel
ocat
e
dat
abase)
#l
ocat
e <f
il
ename/
dir
ect
oryname> (
tosear
cht
hespeci
fi
ed
f
il
eordi
rect
ory
)
48.Expl
aint
hef
indcommandandhowt
ousei
t?
f
indcommandr
equi
redt
hespeci
fi
clocat
ion.Wi
thoutspeci
fi
clocat
ionwecannotf
ind
t
hef
il
esordi
rect
ori
es.
#f
ind <l
ocat
ion><opt
ions><f
il
eordi
rect
ory
> (
tof
indt
hespeci
fi
cfi
l
eor
di
rect
ory
)
Theopt
ionsar
e, -
name -
--
--
> sear
chf
il
esanddi
rect
ori
es
-
prem -
--
--
> sear
chf
orper
missi
ons
-
size -
--
--
> sear
chf
orsi
zes
-
user -
--
--
> sear
chf
ort
heowner
-
uid -
--
--
> sear
chf
orf
il
es/
dir
ect
ori
esofui
d)
-
gid -
--
--
> sear
chf
orf
il
es/
dir
ect
ori
esofgi
d)
-
group -
--
--
> sear
chf
orgr
oupowner
-
empt
y--
--
-> sear
chf
orempt
yfi
l
es
-
ami
n -
--
--
> sear
chf
oraccesst
ime
-
mmi
n--
--
-> " "
-
cmi
n -
--
--
> " "
-
ati
me -
--
--
> sear
chf
oraccessday(
accessday
,mi
nut
es,
hrs,
..
.et
c)

Rat
nakar
Page25
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

-
mti
me-
--
--
> sear
chf
ormodi
fyday(
changet
hecont
ent
)
-
cti
me -
--
--
> sear
chf
orchangeday(
per
missi
ons,
..
..
.et
c)
Exampl
es:
#f
ind / -
name <f
il
ename> (
tosear
chf
orf
il
enames
i
n/ di
rect
ory
)
#f
ind / -
name <f
il
ename> -
type f (
tof
indf
il
enames
onl
y)
#f
ind / -
name <di
rect
oryname> -
type d (
tof
inddi
rect
ori
eswi
th
smal
ll
ett
ersonl
y)
#f
ind / -
iname <f
il
e/di
rect
oryname> -
td (
tosear
chf
orsmal
lorcapi
tal
l
ett
erf
il
es/
dir
ect
ori
es)
#f
ind / -
empt
y (
tosear
chempt
yfi
l
es or
di
rect
ori
es)
#f
ind / -
empt
y -
type f (
tosear
chf
orempt
y
f
il
esonl
y)
#f
ind / -
empt
y -
type d (
tosear
chf
orempt
y
di
rect
ori
esonl
y)
#f
ind / -
name "*
.mp3" (
tosear
chf
or.
mp3f
il
es
onl
y)
#f
ind / -
siz
e 10M (
tosear
chf
orex
act10M
si
zef
il
e/di
rect
ori
es)
#f
ind / -
siz
e-10M (
tosear
chf
orl
esst
han10M
si
zef
il
es/
dir
ect
ori
es)
#f
ind / -
siz
e +10M (
tosear
chf
orgr
eat
ert
han10M
si
zef
il
es/
dir
ect
ori
es)
#f
ind / -
user st
udent (
tosear
chf
or
st
udentuserf
il
es/
dir
ect
ori
es)
#f
ind / -
group st
udent (
tosear
chf
or
st
udentgr
oupf
il
es/
dir
ect
ori
es)
#f
ind / -
userst
udent -
not-
group st
udent (
tosear
chf
orst
udentuserf
il
es
andnotst
udentgr
oupf
il
es)
#f
ind / -
userst
udent -
o-gr
oup st
udent(
tosear
chf
orst
udentuserandst
udent
gr
oupf
il
es/
dir
ect
ori
es)
#f
ind / -
uid <ui
dno.
> (
tosear
chf
orf
il
es/
dir
ect
ori
es
whi
chbel
ongst
otheuser
hav
ingt
hespeci
fi
eduseri
d)
#f
ind / -
gid <gi
dno.
> (
tosear
chf
orf
il
es/
dir
ect
ori
eswhi
ch
bel
ongst
othegr
oup
hav
ingt
hespeci
fi
edgr
oupi
d)
#f
ind /-
prem 755 (
tosear
chf
il
e/di
rect
ori
eswhi
char
ehav
ing

Rat
nakar
Page26
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
heper
missi
ons755)
#f
ind /-
prem -
755 (
tosear
chf
il
e/di
rect
ori
eswhi
char
ehav
ing
t
heper
missi
ons
bel
ow 755andal
soatl
eastonemat
chal
so)
#f
ind / -
mmi
n 20 (
tosear
chf
orf
il
es/
dir
ect
ori
eswhi
char
emodi
fi
edwi
thi
n20
mi
nut
es, +20-
--
-> abov
e20mi
nut
es
and -
20-
--
--
> bel
ow20mi
nut
es)
#f
ind / -
mti
me 2 (
tosear
chf
il
es/
dir
ect
ori
eswhi
char
e
modi
fi
edwi
thi
n2day
s)
#f
ind / -
name "
*.mp3" -
exec r
m -
rf{}\
; (
tosear
ch
al
l.mp3f
il
esanddel
etet
hem)
#f
ind/-
name "
*.mp3"-
exec cp -
a{}/
ram \
;(
tosear
chal
lmp3f
il
esandcopy
t
hem i
nto/
ram di
rect
ory
)
#f
ind / -
userst
udent-
exec cp-
a {}/
ram \
;(t
osear
chst
udentuser
'sf
il
es
anddi
rect
ori
esand
copyt
hem i
nto/
ram di
rect
ory
)
#f
ind / -
nouser -
exec mv -
a {}/
home/
ram \
; (
tosear
ch
f
il
es/
dir
ect
ori
eswhi
char
enotbel
ongst
o
anyuserandmov
ethem i
nto/
home/
ram di
rect
ory
)
#du -
h /|
sor
t-r|
head -
n 10 (
tosear
ch10bi
gsi
zef
il
esi
n
r
ever
seor
der
)

Rat
nakar
Page27
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

3.UserandGr
oupAdmi
nist
rat
ion

1. Whati
sauser
?
I
nLi
nuxuseri
sonewhousest
hesy
stem.Ther
ecanbeatl
eastoneormor
ethanone
useri
nLi
nuxatat
ime.
2. Howmanyt
ypesofuser
sav
ail
abl
einLi
nux?
Ther
ear
e5t
ypesofuser
sav
ail
abl
einLi
nux.
(
i) Sy
stem user(
Admi
nuserwhocont
rol
thewhol
esy
stem not
hingbutr
ootuser
).
(
ii
)Nor
mal
user(
Creat
edbyt
heSuperuser
.InRHEL-7t
heuseri
d'
sfr
om 1000-
60000)
.
(
ii
i)Sy
stem user(
Creat
edwhenappl
i
cat
ionorsof
twar
einst
all
edandar
emai
ntai
ned
sy
stem deamons)
.
(
InRHEL-7t
heSy
stem user
sar
e(i
)St
ati
csy
stem useri
d'
sfr
om 1-200and(
ii
)Dy
nami
c
sy
stem user useri
d'
sfr
om 201-999)
.

Rat
nakar
Page28
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
iv)Net
wor
kuser(
Not
hingbutr
emot
euser
,ie.
,whoar
elogi
ntot
hesy
stem t
rough
net
wor
kcr
eat
edi
n Wi
ndowsAct
iveDi
rect
oryori
nLi
nuxLDAPorNI
S).
(
v)Sudouser(
Thenor
mal
user
swhoar
ehav
ingadmi
norSuperuserpr
ivi
l
eges)
Thet
ypesofuser
sinLi
nuxandt
hei
rat
tri
but
es:

Typeof Defaul
t
Exampl
e UserI
D Gr
oupI
D HomeDi
rect
ory
User Shell

SuperUser Root 0 0 /
root /
bin/
bash

ram,raju,
Nor
mal
User 500-60000 500-60000 /
home/
<username> /
bin/
bash
gopal
,.
..etc.
,
ft
p,ssh,
Sy
stem User apache, 1-499 1-499 /
vat
/ft
p,.
..
etc /
sbi
n/nol
gin
nobody,..
.et
c.,
Sameas Sameas
Remoteuser /
home/
guest
s/l
dapus
Net
wor
kUser normal normal /
bin/
bash
l
i
keLDAPuser er
user
s user
s
Nor
mal users Sameas Sameas
SudoUser wi
thadmi n normal normal /
home/
<username> /
bin/
bash
pr
ivi
leges user
s user
s

3. Whati
susermanagement
?
Usermanagementmeansmanagi
nguser
.ie.
,Cr
eat
ingt
heuser
s,del
eti
ngt
heuser
sand
modi
fyi
ngt
heuser
s.
4. Whatar
ethei
mpor
tantpoi
ntsr
elat
edt
ouser
s?
 User
sandgr
oupsar
eusedt
ocont
rol
accesst
ofi
l
esandr
esour
ces.
 User
scanl
ogi
ntot
hesy
stem bysuppl
yi
nguser
nameandpasswor
dst
othesy
stem.
 Ev
eryf
il
eont
hesy
stem i
sownedbyauserandassoci
atedwi
thagr
oup.
 Ev
erypr
ocesshasanownerandgr
oupaf
fi
li
ati
on.
 Ev
eryuseri
nthesy
stem i
sassi
gnedauni
queuseri
d(ui
d)andgr
oupi
d(gi
d).
 Usernamesanduseri
dar
est
oredi
n/et
c/passwd f
il
e.
 User
'spasswor
dsar
est
oredi
n/et
c/shadow f
il
einanencr
ypt
edf
orm.
 User
sar
eassi
gnedahomedi
rect
oryandashel
ltowor
kwi
tht
heO/
S.
 User
scannotr
ead,
wri
teandexecut
eeachot
her
'sf
il
eswi
thoutper
missi
on.
 Whenev
erauseri
scr
eat
edamai
lboxi
scr
eat
edaut
omat
ical
l
yin/
var
/spool
/mai
l
l
ocat
ion.
 Andsomeuserenv
ironment
alf
il
esl
i
ke.
bash_
logout
,.bash_
prof
il
e,.
bashr
c,.
..
etc.
,
ar
eal
socopi
edf
rom /
etc/
skel
ltohi
s/herhomedi
rect
ory(
/home/
<user
name>)
.
5. Whatar
efi
eldsav
ail
abl
ein/
etc/
passwdf
il
e?
<username> :x :<ui
d> :<gi
d> :<comment
> :<user
'shomedi
rect
ory
>:
<l
ogi
nshel
l
>
(
wher
e'x'meansl
i
nkt
opasswor
dfi
l
eie.
,/et
c/shadow f
il
e)

Rat
nakar
Page29
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

6. Whatar
efi
eldsav
ail
abl
ein/
etc/
shadow f
il
e?
username:password:l
astchanged:min.day
s:max.day
s:war
nday
s:i
nact
iveday
s:
expi
rydays:r
eser
ved
forf
utur
e
7. Whatarethefi
lest
hatarerel
atedtousermanagement
?
 /
etc/
passwd-
--
--
>St
oresuser
'si
nfor
mat
ionl
i
keusername,
uid,
homedi
rect
oryand
shel
l.
..
etc.
,
 /
etc/
shadow -
--
->St
oresuser
'spasswor
dinencr
ypt
edf
orm andot
heri
nfor
mat
ion.
 /
etc/
group-
--
--
->St
oresgr
oup'
sinf
ormat
ionl
i
kegr
oupname,
gidandot
her
i
nfor
mat
ion.
 /
etc/
gshadow-
--
>St
oresgr
oup'
spasswor
dinencr
ypt
edf
orm.
 /
etc/
passwd--
--
>St
orest
he/
etc/
passwd f
il
ebackupcopy
.
 /
etc/
shadow--
--
>St
orest
he/
etc/
shadow f
il
ebackupcopy
.
 /
etc/
def
aul
t/user
add-
--
->Whenev
ert
heusercr
eat
eduser
'sdef
aul
tset
ti
ngst
aken
f
rom t
hisf
il
e.
 /
etc/
logi
n.def
s--
--
>user
'sl
ogi
ndef
aul
tsset
ti
ngsi
nfor
mat
iont
akenf
rom t
hisf
il
e.
 /
etc/
skel
l--
--
--
>St
oresuser
'sal
lenv
ironment
alv
ari
abl
esf
il
esandt
hesear
ecopi
ed
f
rom t
hisdi
rect
oryt
o
user
'shomedi
rect
ory
.
8. I
nhowmanyway
scanwecr
eat
etheuser
s?
(
i) #user
add -<opt
ions><username>
(
ii
)#adduser -<opt
ions><username>
(
ii
i)#newuser
s <f
il
ename> (
Int
hisf
il
ewehav
etoent
ert
heuserdet
ail
ssameas
/
etc/
passwd f
il
e)
9. Whati
sthesy
ntaxof
user
addcommandwi
thf
ullopt
ions?
#user
add-
u<ui
d>-
g<gi
d>-
G<secondar
ygr
oup>-
c<comment
>-d<homedi
rect
ory
>
-
s<shel
l
><username>
Exampl
e:#user
add-
u600-
g600-
Gjav
a-c"
oracl
euser
"-d/
home/
raj
u-s
/
bin/
bash r
aju
10.Whati
sthesy
ntaxofaddusercommandwi
thf
ull
opt
ions?
#adduser-
u<ui
d>-
g<gi
d>-
G<secondar
ygr
oup>-
c<comment
>-d<homedi
rect
ory
>
-
s<shel
l
><username>
Exampl
e:#adduser-
u700-
g700-
Gli
nux -
c"or
acl
euser
"-d/
home/
ram -
s
/
bin/
bash r
am
11.Whati
sthesy
ntaxofnewusercommand?
#newuser
s <f
il
ename>(
Thi
scommandwi
l
lcr
eat
emul
ti
pleuser
satat
ime)
*Fi
rstweshoul
daf
il
eandent
eruser
'sdat
aasf
iel
dssameast
hef
iel
dsof/
etc/
passwd
f
il
eforhowmanyuser
s doy
ouwantt
ocr
eat
eandment
iont
hatf
il
easanar
gumentf
or
newuser
scommand.
* Whenweex
ecut
ethi
scommandnewuser
swi
l
lbecr
eat
edbutt
hei
renv
ironment
al

Rat
nakar
Page30
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

f
il
esl
i
ke .
bash_
logout
, .
bash_
prof
il
e,.
bashr
c and.
bash_
hist
oryf
il
eswi
l
lnotbe
copi
edf
rom /
etc/
skel
ldi
rect
ory
.So,
wehav
eto copi
edmanual
l
yfr
om /
etc/
skel
l
di
rect
ory
.
12.Whati
sthesy
ntaxofuser
delcommandwi
thf
ullopt
ions?
#user
del <opt
ions><username>
*Theopt
ionsar
e,-
f--
--
->f
orcef
ull
ydel
etet
heuserev
ent
hrought
heuseri
slogi
n.
Theuser
'shome di
rect
ory
,mai
landmessage
di
rect
ori
esar
eal
sodel
eted.
-
r--
--
->r
ecur
siv
elymeansf
il
esi
ntheuser
'shomedi
rect
orywi
l
l
bedel
etedandhi
s homedi
rect
oryal
sodel
etedbutt
he
ot
herf
il
esbel
ongst
othatusershoul
dbe del
eted
manual
l
y.

13.Howt
ocheckwhet
heri
sal
readycr
eat
edornot
?
Wecanchecki
ndi
ff
erentway
s.
(
i) #i
d <username> (
Itshowst
heuseri
dgr
oupi
dandusernamei
fthati
sal
ready
cr
eat
ed)
(
ii
)#cat/
etc/
passwd|
grep <username> (
Itshowst
heuser
'sdet
ail
sift
hatuseri
s
al
readycr
eat
ed)
14.Howt
over
if
yorcheckt
hei
ntegr
it
yoft
hepasswor
dfi
le?
#pwck <opt
ions> /
etc/
passwd or
#pwck <opt
ions> /
etc/
shadow
* Theopt
ionsar
e,-
q--
--
--
> qui
et
-
r--
--
--
>readonl
y
-
s--
--
--
> sor
tthecont
ent
sbyui
din/
etc/
passwdand
/
etc/
shadow f
il
es.
15.Howt
over
if
yorcheckt
hei
ntegr
it
yoft
hegr
oupf
il
e?
#gr
pck <opt
ions> /
etc/
group or
#gr
pck <opt
ions> /
etc/
gshadow
* Theopt
ionsar
e, -
r--
--
->r
eadonl
y
-
s--
--
-> sor
tthecont
ent
sbygi
din/
etc/
group and
/
etc/
gshadowf
il
es.
16.Whati
ssy
ntaxoft
heuser
modcommandwi
thf
ull
opt
ions?
#user
mod <opt
ions><username>
* Theopt
ionsar
e,-
L--
--
->l
ockt
hepasswor
d
-
U--
--
-> unl
ockt
hepasswor
d
-
o--
--
->cr
eat
esdupl
i
cat
euser(
modi
fyt
heuser
'si
dassameas
ot
heruser
'si
d)
-
u--
--
->modi
fyuseri
d
-
g--
--
->modi
fygr
oupi
d

Rat
nakar
Page31
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

-
G--
--
->modi
fy oraddt
hesecondar
ygr
oup
-
c--
--
->modi
fycomment
-
d--
--
-> modi
fyhomedi
rect
ory
-
s--
--
-> modi
fyuser
'sl
ogi
nshel
l
-
l--
--
-> modi
fyuser
'sl
ogi
nname
-
md-
--
-> modi
fyt
heuser
shomedi
rect
oryandt
heol
dhome
di
rect
oryal
sor
ename
17.Howt
ocr
eat
ethedupl
icat
erootuser
?
#user
add -
o-u0-
groot <username>
18.Howt
orecov
eri
ftheuserdel
etedbymi
stake?
#pwunconv (
Itcr
eat
est
heuser
saccor
ding/
etc/
passwd f
il
eanddel
etest
he
/
etc/
shadow f
il
e)
19.Whatar
etheusesof.
bash_
logout
,.bash_
prof
il
e and.
bashr
cfi
les?
.
bash_
logout:Thi
sisauser
'sl
ogoutendi
ngpr
ogr
am f
il
e.I
twi
l
lexecut
efi
rstwhenev
er
t
heuseri
slogout
.
.
bash_
prof
il
e:Thi
sisuser
'sl
ogi
nst
art
uppr
ogr
am f
il
e.I
twi
l
lexecut
efi
rstwhenev
ert
he
useri
slogi
n.I
tconsi
sts t
heuser
'senv
ironment
alv
ari
abl
es.
.
bashr
c:Thi
sfi
l
eisusedt
ocr
eat
etheuser
'scust
om commandsandt
ospeci
fyt
he
umaskv
aluesf
ort
hatuser
's onl
y.
20.Whati
sagr
oup?
Thecol
l
ect
ionofuser
siscal
l
edagr
oup.Ther
ear
etwot
ypesofgr
oups.
Pr
imar
ygr
oup:
Itwi
l
lbecr
eat
edaut
omat
ical
l
ywhenev
ert
heuseri
scr
eat
ed.User
bel
ongst
oongr
oupi
scal
l
ed pr
imar
ygr
oup.
Secondar
ygr
oup:I
twi
l
lnotcr
eat
eaut
omat
ical
l
y.Theadmi
nusershoul
dbecr
eat
ed
manual
l
yanduser
s bel
ongst
omor
ethanonegr
oupi
scal
l
ed
secondar
ygr
oup.Ausercanbeassi
gnedt
omax
.16 gr
oups.i
e.,
1pr
imar
ygr
oupand15secondar
ygr
oups.
21.Whati
sthecommandt
ocheckt
heuserbel
ongst
ohowmanygr
oups?
#gr
oups <username>
22.Whati
sthesy
ntaxt
ocr
eat
ethegr
oup?
#gr
oupadd <opt
ions><gr
oupname>
Theopt
ionsar
e,-
f--
--
->addt
hegr
oupf
orcef
ull
y
-
g -
--
--
>gr
oupi
dno.
-
o--
--
->non-
uni
que(
dupl
i
cat
egr
oupi
d)
-
p -
--
--
>gr
ouppasswor
d
-
r--
--
->sy
stem gr
oup
-
R--
--
->r
ootgr
oup
23.Whati
sthesy
ntaxt
omodi
fyt
hegr
oup?
#gr
oupmod <opt
ions><gr
oupname>
Theopt
ionsar
e, -
g--
--
--
>gr
oupi
d

Rat
nakar
Page32
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

-
n--
--
--
>newnamef
orexi
sti
ngone,
ie.
,renamet
hegr
oup
-
o--
--
--
>non-
uni
que(
dupl
i
cat
egr
oupi
d)
-
p--
--
--
>gr
ouppasswd
-
R--
--
--
>rootgr
oup
24.Whati
ssy
ntaxt
odel
etet
hegr
oup?
#gr
oupdel <gr
oupname> (
todel
etet
hegr
oupwi
thoutopt
ions)
#gr
oupdel -
R <gr
oupname>(
todel
etet
hegr
oupandappl
ychangest
other
oot
di
rect
ory
)
25.Howt
oassi
gnt
hepasswor
dtot
hegr
oup?
#gpasswd <gr
oupname> (
toassi
gnapasswor
dtot
hegr
oupwi
thoutanyopt
ions)
#gpasswd <opt
ions><gr
oupname>
Theopt
ionsar
e, -
a--
--
--
>adduser
stot
hegr
oup
-
d--
--
--
> del
etet
heuserf
rom t
hegr
oup
-
r--
--
--
>remov
ethegr
ouppasswor
d
-
R--
--
--
>rest
ri
ctt
oaccesst
hatgr
oup
-
A--
--
--
> sett
hel
i
stofAdmi
nist
rat
iveuser
s
-
M--
--
--
> sett
hel
i
stofgr
oupmember
s
26.Howt
ocheckt
hei
ntegr
it
yorconsi
stencyoft
hegr
oup?
#gr
pck (
itwi
l
lcheckt
hei
ntegr
it
yorconsi
stencyi
n/et
c/gpasswd and
/
etc/
gshadow f
il
es)
27.Howt
orest
ore/
etc/
gshadowf
il
eifdel
etedbymi
stake?
#gr
pconv(
itcr
eat
est
he/
etc/
gshadow f
il
efr
om /
etc/
group f
il
e)
28.Howt
ochanget
hepasswor
dagi
ngpol
ici
es?
wecanchanget
hepasswor
dpol
i
ciesi
n2way
s.
(
i)Fi
rstopent
he/
etc/
logi
n.def
sfi
l
eandmodi
fyt
hecur
rentv
alues.
Exampl
e:#v
im/
etc/
logi
n.def
s
mi
n-0-
--
--
> meanst
heusercanchanget
hepasswor
dtoanyno.oft
imes.
mi
n-2-
--
--
> meanst
heusercanchanget
hepasswor
dwi
thi
n2day
s.i
e.,
he
canchanget
he passwor
daf
ter2day
s.
max-5-
--
--
> meanst
heusershoul
dchanget
hepasswor
dbef
oreoraf
ter5
day
s.Ot
her
wiset
he passwor
dwi
l
lbeex
pir
edaf
ter5day
s.
i
nact
ive-2-
--
--
>meansaf
terpasswor
dexpi
rydat
ethegr
aceper
iodanot
her
2day
swi
l
lbegi
vent
o changet
hepasswor
d.
war
ning-7-
--
--
>meansawar
ningwi
l
lbegi
vent
otheuseraboutt
he
passwor
dexpi
ry7day
sbef
ore ex
pir
ydat
e.
(
ii
)secondbyexecut
ingt
he #chagecommand.
Exampl
e:#chage <opt
ions><username>
Theopt
ionsar
e,-
d--
--
->l
astday
-
E--
--
-> expi
rydat
e
-
I--
--
->i
nact
iveday
s

Rat
nakar
Page33
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

-
l--
--
->l
i
stal
lthepol
i
cies
-
m -
--
--
> mi
n.day
s
-
M -
--
--
> max.day
s
-
w -
--
--
> war
ningday
s
Not
e:Whenev
erwechanget
hepasswor
dagi
ngpol
i
cyusi
ng #chage command,
the
i
nfor
mat
ioni
swi
l
lbe modi
fi
edi
n/et
c/shadow f
il
e.
29.Howadd45day
stot
hecur
rentsy
stem dat
e?
#dat
e-d "
+45day
s"
30.Expl
aint
hesudouser
?
 Sudoer
s(not
hingbutsudouser
s)al
l
owspar
ti
cul
aruser
stor
unv
ari
ousr
ootuser
commandswi
thoutneedi
ngar
ootpasswor
d.
 /
etc/
sudoer
sist
heconf
igur
ati
onf
il
eforsudoer
stoconf
igur
ethenor
mal
useras
pr
ivi
l
egeduser
.
 I
tisnotr
ecommendedt
oopent
hisf
il
eusi
ng #v
im edi
torbecauset
hisedi
tor
cannotcheckt
hesy
ntaxbydef
aul
tandwhat
everwet
ypedi
nthatf
il
ethatwi
l
l
bl
i
ndl
ysav
eint
hisf
il
e.
 So,
oneedi
tori
sspeci
all
yav
ail
abl
eforopeni
ngt
hisf
il
e,i
e.,#v
isudo andal
l
nor
mal
user
scannotexecut
ethi
scommand.Onl
yrootusercanr
unt
hiscommand.
 Oncet
hisf
il
eisopenednobodycanopent
hisf
il
eagai
nonanot
hert
ermi
nal
because"
Thef
il
eisbusy
"messagei
sdi
spl
ayedont
het
ermi
nal
forsecur
it
yreasons.
31.Howt
ogi
vedi
ff
erentsudoper
missi
onst
onor
maluser
s?
Opent
he /
etc/
sudoer
s f
il
ebyex
ecut
ing #v
isudo commandandgot
oli
neno.98
andt
ypeas
<Username> <Machi
ne>= <Command>
r
oot ALL=(
ALL) ALL
r
aju Al
l= ALL
-
--
-Sav
eandexi
tthi
sfi
l
e.
Not
e:Whenwet
ryi
ngt
osav
ethi
sfi
l
eifanysy
ntaxer
ror
sint
hisf
il
e,t
hoseer
ror
sar
e
di
spl
ayedwi
thl
i
neno'
s andWhaty
oudo?(
wil
lbedi
spl
ayed,
her
epr
ess'
e't
oedi
t
t
hisf
il
eandmodi
fyt
hoseer
ror
sormi
stakesand sav
ethi
sfi
l
e.
#su -r
aju (
toswi
tcht
oraj
uuser
)
#sudo user
add <user
add> (
Thenor
mal
userr
ajucanal
soaddt
heuser
stot
he
sy
stem)
*Wecanassi
gnsudoper
missi
onst
o'n'no.ofuser
sbyspeci
fyi
ngnamessepar
ated
bycommas(,
)orl
i
neby l
i
ne.
*I
nst
eadofgi
vi
ngal
lper
missi
onst
onor
mal
userwecangi
veonl
ysomecommands.
Exampl
e: st
udent ALL=/
usr
/sbi
n/user
add,
/usr
/sbi
n/user
mod
r
aju ALL=NOPASSWD:
/usr
/sbi
n/user
add,
/usr
/sbi
n/user
mod
* Wecanal
soappl
ytoonegr
ouporgr
oupsasf
oll
ows.
* Fi
rstcr
eat
etheuser
s,assi
gnonegr
oupt
othoseuser
sandal
soassi
gnt
he

Rat
nakar
Page34
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

passwor
dsf
ort
hatuser
s.Open /
etc/
sudoer
s f
il
ebyexecut
ingt
hecommand
#v
isudo andt
ypeasf
oll
ows.
%<gr
oupname> ALL=ALL
%or
acl
e ALL=ALL ori
ndi
vi
dual
commandssepar
ated
bycommas,
* Wecanal
socr
eat
eonecommandal
i
asandaddsomecommandst
othatal
i
asand
ment
iont
hatal
i
ast
ouser
s asf
oll
ows.
Cmnd_
Ali
as NETWORKI
NG=/
usr
/sbi
n/r
out
e, /
usr
/sbi
n/i
fconf
ig
<username> <machi
nes>=<commandal
i
asname>
r
aju ALL=NETWORKI
NG
* Wecanal
socr
eat
eoneuseral
i
asandaddt
heuser
stot
hatal
i
asandassi
gnsome
commandst
othatal
i
asas f
oll
ows.
User
_Al
i
as <useral
i
asname>=<user
1>,
<user
2>,
<user
3>,
..
..
.
Exampl
e: User
_Al
i
as OURTEAM=r
aju,
shy
am,
ram,
gopal
OURTEAM ALL=ALL (
togi
veal
lper
missi
onsofsudo)
Def
aul
tst
imest
amp_
timeout
=0 (
whenev
ert
hesudouserexecut
esany
commandt
heni
twi
l
laskpasswor
d
f
orev
erycommand)
*Theabov
ewi
l
lappl
ytoal
luser
sincl
udi
ngr
ootal
so.I
fwewantt
omakei
tasonl
yfor
nor
mal
user
s,t
hen
Def
aul
ts:<user
1>,
<user
2>,
<user
3>t
imest
amp_
timeout
=0 (
thesy
stem wi
l
l
askpasswor
dsf
oruser
1,
user
2,user
3toex
ecut
esudocommands)
32.I
nwhi
chl
ocat
iont
hesudousercommandshi
stor
yisl
ogged?
Al
lthesudouser
scommandshi
stor
yisl
oggedi
n/v
ar/
log/
secur
efi
l
etomakea
r
ecor
dofsudouser commands.
#cat/
var
/l
og/
secur
e (
toseet
hecont
ent
soft
hisf
il
e)
#t
ail
f/v
ar/
log/
secur
e (
toseet
heupdat
esoft
hisf
il
econt
inuousl
yandpr
essct
rl+c
t
oqui
tthet
ail
f)
33.Howt
oassi
gnt
hepasswor
dtonor
mal
userbyhi
m whenev
erf
ir
stl
ogi
ntot
hesy
stem?
Whenev
ert
heuseri
scr
eat
edandt
hatuseri
str
yingt
ologi
ntot
hesy
stem,
itwi
l
laskt
he
passwor
d.I
fther
ootuseri
snotassi
gnt
hepasswor
dtot
hatuser
,thent
hatnor
mal
user
canassi
gnt
hepasswor
dbyhi
sownusi
ngt
he f
oll
owi
ngcommands.
#user
add <username> (
tocr
eat
etheuser
)
#passwd-
S <username> (
toseet
hest
atusoft
hepasswor
doft
hatuser
.ifr
oot
useri
snotassi
gned t
he
passwor
dthent
hepasswor
dst
atusi
slocked)
#passwd-
d <username> (
thendel
etet
hepasswor
dfort
hatuser
)
#chage -
d 0 <username> (
itwi
l
lchanget
hepasswor
dagepol
i
cy)
#su -<username> (
Tryt
oswi
tcht
othatusert
heni
twi
l
ldi
spl
ayt
he

Rat
nakar
Page35
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

f
oll
owi
ngmessage)
Newpasswor
d: (
typenewpasswor
dfort
hatuser
)
Ret
ypepasswor
d: (
ret
ypet
hepasswor
dagai
n)
Theot
herusef
ulcommands:
#w (
thi
scommandgi
vest
hel
ogi
nuseri
nfor
mat
ionl
i
kehowmanyuser
scur
rent
ly
l
ogi
nandt
hei
r
pr
ocesses)
#who (
toseeuser
swhoar
ecur
rent
lyl
ogi
nandonwhi
cht
ermi
nal
theyl
ogi
n)
#l
ast (
seet
hel
i
stofuser
swhoar
elogi
nandl
ogoutsi
ncet
he /
var
/log/
wtmp f
il
e
wascr
eat
ed)
#l
ast
b (
toseet
hel
i
stoft
heuser
swhot
ri
edasbadl
ogi
ns)
#l
ast
reboot (
toseeal
lreboot
ssi
ncet
hel
ogf
il
ewascr
eat
ed)
#upt
ime (
toseet
hei
nfor
mat
ionf
rom howl
ongt
hesy
stem i
srunni
ng,
how
manyuser
slogi
nandl
oad
av
erage)
*Thel
oadav
eragei
sfr
om 1sec :5secs :15secs
#df (
toseet
hemount
edpar
ti
ti
ons,
thei
rmountpoi
ntsandamountofdi
sk
space)
#du (
toseet
hedi
skusageoft
heeachf
il
einby
tes)
#uname -
r (
giv
est
hecur
rentker
nel
ver
sion)
#l
ast -
x (
Itshowsl
astshut
downdat
eandt
ime)
#l
ast -
xgr
epshut
down (
onl
yshut
downt
imeshowsi
e.,
grepwi
l
lfi
l
tert
he'
l
ast
-
x'command)
*gr
ep:I
tisusedt
osear
chawor
dorsent
encei
nfi
l
e(i
e.,
insi
det
hef
il
e)
*f
ind: I
tisusedt
osear
chacommandorf
il
einsi
det
hesy
stem)
#cat/
etc/
shel
l
s or#chsh -
l (
toseehowmanyshel
l
sthatar
esuppor
tedby
Li
nux)
/
bin/
sh -
--
--
> def
aul
tshel
lforUni
x
/
bin/
bash -
--
--
> def
aul
tshel
lforLi
nux
/
sbi
n/nol
ogi
n--
--
-> user
scannotl
ogi
nshel
l
/
bin/
tcsh -
--
--
> cshel
ltowr
it
e'C++'l
anguagepr
ogr
ams
/
bin/
csh -
--
--
> cshel
ltowr
it
e'C'l
anguagepr
ogr
ams
#echo $SHELL (
toseet
hecur
rentshel
l
)
#chsh <username> (
tochanget
heuser
'sshel
l
)
Changi
ngshel
lfor<username>:
Newshel
l:<t
ypenewshel
lforex
ampl
e/bi
n/sh t
ochanget
hecur
rentshel
l
>
Newshel
lchanged (
Buti
twi
l
lef
fectbyr
est
art
ingt
heser
ver
)
#dat
e+%R (
todi
spl
ayt
het
imeonl
y)
#dat
e+%x (
todi
spl
ayt
hedat
eonl
y)
#hi
stor
y (
toseet
hehi
stor
yoft
hecommands)

Rat
nakar
Page36
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#hi
stor
y -
c (
tocl
eart
hehi
stor
y)
#hi
stor
y -
r (
tor
ecov
ert
hehi
stor
y)
*.
bash_
hist
oryi
sthehi
ddenf
il
etost
oret
hehi
stor
yoft
heusercommands.Bydef
aul
t
hi
stor
ysi
zei
s1000.
#echo $HI
STSI
ZE (
tocheckt
hecur
renthi
stor
ysi
ze)
#expor
tHI
STSI
ZE=500(
tochanget
hecur
renthi
stor
ysi
zet
o500t
empor
ari
l
y)
#expor
t HI
STTI
MEFORMAT=""
%D""
%T""(
todi
spl
ayt
hedat
eandt
imeofeach
commandt
empor
ari
l
y)
#v
im/
etc/
bashr
c (
opent
hisf
il
egot
olastl
i
neandt
ypeasf
oll
owst
o
makehi
stor
ysi
zedat
e&t
ime
f
ormat
sper
manent
ly)
HI
STSI
ZE=1000
HI
STTI
MEFORMAT=' %D %T '
(
sav
eandexi
tthef
il
eandt
oupdat
etheef
fect
sby #sour
ce /
etc/
bashr
c command)
# ~<username> (
togot
ouser
shomedi
rect
ory
)
#what
is <command> (
toseet
heshor
tdescr
ipt
ionoft
hatcommand)
#wher
eis<command> (
toseet
hel
ocat
ionoft
hatcommandandl
ocat
ionoft
he
documentoft
hat
command)
#r
eset (
tor
efr
esht
het
ermi
nal
)
#whoami (
toseet
hecur
rentusername)
#whoami (
toseet
hecur
rentuserwi
thf
ull
det
ail
sli
kel
ogi
nti
meand
ot
her
s)
#passwd <username> (
tochanget
hepasswor
doft
heuser
)
#i
d (
toseet
hecur
rentusername,
useri
d,gr
oupnameandgr
oup
i
d,.
..
.et
c.,
)
#i
d <username> (
toseet
hespeci
fi
edusername,
useri
d,gr
oupname
andgr
oupi
d)
#su (
toswi
tcht
orootuserwi
thoutr
ootuserhomedi
rect
ory
)
#su - (
toswi
tcht
orootuserwi
thr
ootuserhomedi
rect
ory
)
#su <username) (
toswi
tcht
othespeci
fi
eduserwi
thouthi
shome
di
rect
ory
)
#su - <username> (
toswi
tcht
othespeci
fi
eduserwi
thhi
shomedi
rect
ory
)
#l
spci (
tol
i
stal
lthePCIsl
otspr
esenti
nthesy
stem)
#du -
sh /
etc/ (
toseet
hesi
zeoft
he /
etc ont
hedi
ski
nKBsorMBs)
#l
s -
l (
toseet
hel
ongl
i
sti
ngoft
hef
il
esanddi
rect
ori
es)
dr
wxr
wxr
wx .2 r
oot r
oot 6 Dec17 18:
00 Fi
l
ename
d -
--
--
>ty
peoff
il
e
r
wx -
--
--
> ownerper
missi
ons
r
wx -
--
--
> gr
oupper
missi
ons

Rat
nakar
Page37
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
wx -
--
--
> ot
her
sper
missi
ons
. -
--
--
> NoACLper
missi
onsappl
i
ed
r
oot-
--
-> owneroft
hef
il
e
r
oot-
--
->gr
oupowner
shi
p
6 -
--
--
> si
zeoft
hef
il
e
Dec718:
00-
--
--
> Dat
eandTi
meoft
hecr
eat
edormodi
fi
ed
Fi
l
ename -
--
--
> Fi
l
enameoft
hatf
il
e

#l
s -
ld <di
rect
oryname> (
toseet
hel
ongl
i
sti
ngoft
hedi
rect
ori
es)
#st
at <f
il
ename/
dir
ect
oryname> (
toseet
hest
ati
sti
csoft
hef
il
eordi
rect
ory
)
34.Howmanyt
ypesoft
hef
il
esar
ether
e?
Ther
ear
e7t
ypesoff
il
es.
1. - -
--
--
>regul
arf
il
e
2. d -
--
--
> di
rect
ory
3. c -
--
--
> char
act
erdev
icef
il
e(Ex.consol
efi
l
e,openandcl
oset
ermi
nal
s,.
..
etc.
,
)
4. b -
--
--
> bl
ockdev
icef
il
e(Ex.dev
icebl
ocksl
i
kehar
ddi
sks,
CD/
DVDdi
sks)
5. s -
--
--
> socketf
il
e(pr
ogr
ammer
swi
l
ldeal
thi
sfi
l
e)
6. p -
--
--
> pi
pef
il
e (
progr
ammer
swi
l
ldeal
thi
sfi
l
e)
7.l -
--
--
> l
i
nkedf
il
e(not
hingbutshor
tcutf
il
e)
35.Whatar
eper
missi
ont
ypesav
ail
abl
einLi
nuxandt
hei
rnumer
icr
epr
esent
ati
ons?
Ther
ear
emai
nlyt
hreet
ypesofper
missi
onsav
ail
abl
einLi
nuxandt
hosear
e,
r
ead -
--
-- r -
--
-- 4 nul
lper
missi
on -
--
--
-0
wr
it
e -
--
-- r -
--
-- 4
execut
e--
--
- r -
--
-- 4
Per
missi
on
Fi
l
e Di
rect
ory
s
r Readaf
il
eEx
.#cat<f
il
ename> Readadi
rect
orycont
ent
sEx.l
s/di
r
Cr
eat
e,del
eteormodi
fyt
hef
il
e Cr
eat
e,del
eteormodi
fyt
hef
il
esi
na
w
cont
ent
s di
rect
ory

x Notr
equi
redforf
ile.I
tisrequi
redonl
y Got
oinsi
det
hedi
rect
ory Ex.#cd/
dir
forscr
ipti
ngfil
es

36.Whati
ssy
ntaxofchmodcommandwi
thf
ullopt
ions?
#chmod <opt
ions><f
il
enameordi
rect
oryname> (
tochanget
heowneror
per
missi
onsoft
hef
il
eor
di
rect
ory
)
Theopt
ionsar
e,-
c--
--
-> changes
-
f--
--
-> si
l
ent(
for
cef
ull
y)
-
v--
--
-> v
erbose
-
R--
--
-> r
ecur
siv
e(i
ncl
udi
ngsubdi
rect
ori
esandf
il
es)

Rat
nakar
Page38
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Tochanget
heper
missi
onst
hesy
ntaxi
s,
#chmod <who> <what
> <whi
ch> <f
il
enameor
di
rect
ory
>
user(
u) add(
+) r
ead(
4)or(
r) "
"
gr
oup(
g) r
emov
e(-
) wr
it
e(2)or(
w) " "
ot
her(
o) equal
(=) execut
e(1)or(
x) " "
37.Whati
sthesy
ntaxofchowncommandwi
thf
ullopt
ions?
#chown <opt
ions><f
il
enameordi
rect
ory
>(t
ochanget
heowner
shi
poft
hef
il
eor
di
rect
ory
)
Theopt
ionsar
e, -
c -
--
--
> changes
-
f--
--
-> si
l
ent(
for
cef
ull
y)
-
v--
--
-> v
erbose
-
h--
--
-> nodi
ff
erence
-
R--
--
-> r
ecur
siv
e(i
ncl
udi
ngsubdi
rect
ori
esandf
il
es)
-
H--
--
-> sy
mbol
i
cli
nkt
oadi
rect
ory(
commandl
i
near
gument
)
-
L--
--
-> sy
mbol
i
cli
nkt
oadi
rect
ory(
all
)
-
p--
--
-> donott
rav
erse
#chown <user
name>:<gr
oupname> <f
il
ename ordi
rect
oryname> (
to
changeownerandgr
oup
owner
shi
poft
hef
il
eordi
rect
ory
)
38.Whati
ssy
ntaxofchgr
pcommandwi
thf
ullopt
ions?
#chgr
p <opt
ions><f
il
ename ordi
rect
ory
>(t
ochangegr
oupowner
shi
poft
hef
il
e
di
rect
ory
)
Theopt
ionsar
e, -
c -
--
--
> changes
-
f--
--
-> si
l
ent(
for
cef
ull
y)
-
v--
--
-> v
erbose
-
h--
--
-> nodi
ff
erence
-
R--
--
-> r
ecur
siv
e(i
ncl
udi
ngsubdi
rect
ori
esandf
il
es)
-
H--
--
-> sy
mbol
i
cli
nkt
oadi
rect
ory
-
L--
--
-> donott
rav
erse-
p--
--
-> donott
rav
erse
39.Whatar
ethedef
aul
tper
missi
onsofaf
il
eanddi
rect
ory
?
Thedef
aul
tper
missi
onsofaf
il
e=666
Thedef
aul
tper
missi
onsofadi
rect
ory=777
40.Whati
sumaski
nli
nux?
Theuserf
il
e-cr
eat
ionmodemask(
umask)i
susedt
odet
ermi
net
hef
il
eper
missi
onsf
or
newl
ycr
eat
edf
il
esordi
rect
ori
es.I
tcanbeusedt
ocont
rol
thedef
aul
tfi
l
eordi
rect
ory
per
missi
onsf
ornewf
il
es.I
tisaf
our
-di
gitoct
al number
.Theumaskv
aluef
ornor
mal
useri
s0002andt
heumaskv
aluef
orr
ootuseri
s0022.
So,
theef
fect
edf
il
eper
missi
onsf
ornor
mal
user
s=666 -002= 664.

Rat
nakar
Page39
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Theef
fect
eddi
rect
oryper
missi
onsf
ornor
mal
user
s=777-002=775.
Theef
fect
edf
il
eper
missi
onsf
orr
ootuser=666 -022 = 644
Theef
fect
eddi
rect
oryper
missi
onsf
orr
ootuser=777-022 = 755
#umask <v
alue> (
tochanget
heumaskv
aluet
empor
ari
l
y)
#v
im /
etc/
bashr
c (
opent
hisf
il
eandchanget
heumaskv
aluet
oef
fectt
he
whol
esy
stem)
#sour
ce /
etc/
bashr
c (
toupdat
edt
hesour
cef
il
e)
#v
im.
bashr
c (
opent
hisf
il
einuser
'shomedi
rect
oryandatl
astt
ypeas
f
oll
ows)
umask<v
alue> (
sav
eandexi
tthef
il
e)
#sour
ce .
bashr
c orl
ogoutandl
ogi
nagai
n (
tot
hesy
stem t
oef
fectt
hatumask
v
alue)
*I
fthe/
etc/
logi
n.def
s f
il
eiscor
rupt
edt
hennewuser
swi
l
lbeaddedandcanbe
assi
gnedt
hepasswor
dsbut user
scannotl
ogi
n.
*I
fthe /
etc/
logi
n.def
sfi
l
eisdel
etedt
hennewuser
scannotbeadded.
41.Howchanget
heper
missi
onsusi
ngnumer
icr
epr
esent
ati
on?
Thev
aluesf
orr
ead=4,wr
it
e=2,ex
ecut
e=1andnul
l=0.Thet
otal
val
ue=4+2+1
=7
#chmod <no.
><no.
><no.
><f
il
enameordi
rect
oryname>
Exampl
e:#chmod 774 f
il
e1 (
togi
ver
ead,
wri
teandex
ecut
etoownerand
r
ead,
wri
teandexecut
eto
gr
oupandr
eadper
missi
ont
oot
her
s)
#chmod 660 f
il
e2 (
togi
ver
eadandwr
it
etoownerandr
eadand
wr
it
etogr
oupandnul
l(0)
per
missi
ont
oot
her
s)
42.Expl
ainaboutsetui
d(sui
d)?
I
fwepl
ant
oal
l
owal
ltheuser
stoexecut
ether
ootuser
scommandt
henwegof
orset
ui
d(sui
d).
I
tcanbeappl
i
edf
oruserl
evel
andi
sappl
i
cabl
eforf
il
esonl
y.
#chmod u+s <f
il
ename> (
tosett
hesui
dont
hatf
il
e)
#chmod u-
s <f
il
ename> (
tor
emov
ethesui
dfr
om t
hatf
il
e)
#l
s-l (
if'
x'i
srepl
acedwi
th'
s'i
nowner
'sl
evel
per
missi
onst
hatmeanssui
dis
appl
i
edont
hatf
il
e)
-rwsrwxrwx <f
il
ename> (
her
e's'i
scal
l
edsetui
dorsui
d)
Exampl
e:#chmod u+s /
usr
/sbi
n/i
nit6 (
thenanyusercanr
est
artt
he
sy
stem usi
ngt
hiscommand
#i
nit6)
#chmod u+s /
sbi
n/f
disk (
thenanyusercanr
unt
hef
diskcommand)
#st
ri
ngs <commandname> (
tor
eadt
hebi
nar
ylanguageoft
hecommandi
e.,
the
st
ri
ngcommand conv
ert
s

Rat
nakar
Page40
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
hebi
nar
ylanguagei
ntohumanr
eadabl
elanguage)
#st
ri
ngs mkf
s(t
oreadt
hemkf
scommand'
sbi
nar
ylanguagei
ntohumanr
eadabl
e
l
anguage)
* Nor
mal
l
ysetui
d(sui
d)per
missi
onwi
l
lbegi
venonscr
ipt
ingf
il
esonl
y.
43.Expl
ainaboutsetgi
d(sgi
d)?
I
fwepl
ant
oal
l
owal
ltheuser
sofonegr
oupt
ogett
hegr
oupowner
shi
pper
missi
ons
t
henwegof
orsetgi
d
(
sgi
d).
I
tcanbeappl
i
edf
orgr
oupl
evel
andi
sappl
i
cabl
eondi
rect
ori
esonl
y.
Exampl
e: #chmod g+s <di
rect
oryname>(
tosett
hesgi
dont
hatdi
rect
ory
)
#chmod g-
s <di
rect
oryname> (
tor
emov
ethesgi
dfr
om t
hatdi
rect
ory
)
44.Expl
ainaboutst
ickybi
t?
I
tpr
otect
sthedat
afr
om ot
heruser
swhenal
ltheuser
shav
ingf
ull
per
missi
onsonone
di
rect
ory
.
I
tcanbeappl
i
edonot
her
slev
elandappl
i
cabl
efordi
rect
ori
esonl
y.
Exampl
e:#chmod o+t <di
rect
oryname> (
tosett
hest
ickybi
tper
missi
onont
hat
di
rect
ory
)
#l
s-l
d <di
rect
oryname>
rwxrwxrwt <di
rect
oryname> (
wher
e't
'iscal
l
edt
hest
ickybi
t)
45.Whatar
etheusesofpasswdandshadowf
il
es?
Passwdf
il
e:(
i) Whenwecr
eat
etheuseroneent
ryi
supdat
edi
npasswor
dand
shadowf
il
es.
(
ii
)Itr
epr
esent
sandt
ell
aboutt
hatuserl
ogi
nname,
uid,
gid,
def
aul
thomedi
rect
oryof
t
heuseanddef
aul
t shel
l
.
(
ii
i)So,
usi
ngt
hisf
il
ewecaneasi
l
ygetuser
sinf
ormat
ion.
Shadowf
il
e:(
i)Thi
sfi
l
etel
l
saboutt
hel
ogi
nid,
user
'sencr
ypt
edpasswor
d,
passwor
dwhenl
astchanged, mi
n.day
sthepasswor
dval
i
d,
max.day
sval
i
d,war
ningday
s,i
nact
iveday
sandexpi
ryday
s.
(
ii
)Ifshadowf
il
eismi
ssedordel
etedwecanr
ecov
ert
hoseent
ri
esofshadowf
il
eusi
ng
passwor
dfi
l
e.
(
ii
i)Wecanchanget
heuser
sencr
ypt
edpasswor
dswi
tht
heper
missi
onsoft
hehi
gher
aut
hor
it
iesi
ncaseof emer
gency
.
46.Whati
stheuseofgr
oup?
(
i)I
nanor
gani
zat
iont
hewhol
ewor
kisdi
vi
dedi
ntodepar
tment
sforeasymai
ntenance
andeasy admi
nist
rat
ion.
(
ii
)Foreachdepar
tmenti
sal
sor
epr
esent
edasgr
oupandt
hatgr
ouphav
ingsomany
user
stododi
ff
erent wor
ks.
(
ii
i)So,
ifwecr
eat
eonegr
oupandassi
gnt
hatgr
oupt
oal
ltheuser
sint
hatdepar
tment
,
t
henwecaneasi
l
y i
dent
if
ywhi
chuserbel
ongst
owhi
chgr
oup.
(
iv)Wecanshar
efi
l
es,
dir
ect
ori
esandexecut
esomepr
ogr
amst
othatgr
oupandal
so

Rat
nakar
Page41
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

gi
veper
missi
onst
othat gr
oup.So,
eachuseroft
hatgr
oupcaneasi
l
yshar
e
t
hosedi
rect
ori
esandal
socaneasi
l
yaccess,
execut
eor ev
enwr
it
eint
hose
shar
edf
il
esanddi
rect
ori
es.
47.Canwel
ogi
ntot
heuserwi
thoutpasswor
d?
Yes,
wecanl
ogi
n.
48.Howt
orecov
ert
her
ootpasswor
difmi
ssedordel
eted?
RHEL-6:
(
i) Rest
artt
hesy
stem.
(
ii
)Sel
ect1stopt
ionandpr
ess'
e'
.
(
ii
i)Sel
ect2ndopt
ionandpr
ess'
e'
.
(
iv)Att
heendgi
veonebl
ankspaceandt
ype1andpr
essEnt
erkey
.
(
v)Thenpr
ess'
b't
oboott
hesy
stem i
nsi
ngl
eusermode.
(
vi)Thenpr
omptappear
sandt
ype #passwdr
oot command.
Newpasswor
d:XXXXXX
Ret
ypepasswor
d:XXXXXX
(
vii
)Exi
t
(
vii
i
)Thensy
stem st
art
sasusual
.
RHEL-7:
(
i) Rest
artt
hesy
stem.
(
ii
)Usi
ngar
rowkey
ssel
ect1stl
i
neandpr
ess'
e't
oedi
t.
(
ii
i)Got
oLi
nux16l
i
nepr
essEndkeyorCt
rl+et
ogot
otheendoft
hel
i
neandgi
ve
onespace.
(
iv)Thent
ypeas r
d.br
eak consol
e=t
ty1 sel
inux=0
(
v)Thenpr
ess Ct
rl+x t
ost
artt
hecomput
eri
nsi
ngl
eusermode.
(
vi)Af
terst
art
ingwegetswi
th_
root:
/# pr
omptappear
sandt
hent
ypeasf
oll
ows.
(
vii
)#mount-
oremount
,rw /
sysr
ootandpr
essEnt
erandt
hent
ypeasf
oll
ows.
(
vii
i
)#chr
oot/
sysr
oot pr
essEnt
er.
(
ix)Then sh-4.
2# pr
omptappear
sandt
ypeas
(
x)sh-4.
2#passwdr
oot
Newpasswor
d:XXXXXX
Ret
ypepasswor
d:XXXXXX
(
xi)sh-4.
2#exi
t
(
xii
)swi
tch-
root:
/#exi
t
(
xii
i
)Thent
hesy
stem st
art
sandt
hedeskt
opappear
s.
49.Howt
orest
ri
ctt
heuser
sfr
om l
ogi
n?
(
i) Byr
emov
ing(
del
eti
ng)t
heuserwecanr
est
ri
ctt
heuserf
rom l
ogi
n.
(
ii
)Putt
heuser
'shost
namesasent
ri
esi
n/et
c/host
s.deny f
il
e(appl
yi
ngTCP
wr
apper
s).
(
ii
i)#passwd -
l <username> (
byl
ocki
nghi
spasswor
dwecanr
est
ri
ctt
heuser
s).
50.Howt
oputnev
erexpi
ryt
oauser
?

Rat
nakar
Page42
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#passwd -
x -
1 <userl
ogi
nname>
51.Whi
chonei
sthedef
aul
tst
ickybi
tdi
rect
ory
?
/
tmp i
sthedef
aul
tst
ickybi
tdi
rect
ory
.
52.Whati
sthepur
poseoft
hepr
ofi
les?
(
i) Pr
ofi
l
eisaf
il
etoent
ersomeset
ti
ngsaboutuser
swor
kingenv
ironment
.ie.
,wecan
setuserhomedi
rect
ory
, l
ogi
nshel
l
,pat
h,.
..
etc.
,
Pr
ofi
l
esar
etwot
ypes.
(
a)Gl
obal
prof
il
e
(
b)Local
prof
il
e
Gl
obalpr
ofi
le:
(
1)Onl
yrootusercansetandappl
i
cabl
etoal
ltheuser
s.
(
2)Onl
ygl
obal
par
amet
erscanent
eredi
nthi
spr
ofi
l
e.
(
3)Thel
ocat
ionoft
hegl
obal
prof
il
eis/
etc/
bashr
c
Localpr
ofi
le:
(
1)Ev
eryuserhashi
s/herownpr
ofi
l
e.
(
2)Theset
ti
ngsent
eredi
nthi
spr
ofi
l
ear
eonl
yfort
hatuser
.
(
3)Thel
ocat
ionoft
hepr
ofi
l
eis.
bash_
prof
il
e (
hiddenf
il
e)i
nthatpar
ti
cul
aruser
's
homedi
rect
ory
.
53.Canwemount
/unmountt
heO/
Sfi
lesy
stem?
No,
wecannotmountorunmountt
he O/
Sfi
l
esy
stem.
54.Howt
ofi
ndt
heuser
swhoar
elogi
nandhowt
oki
llt
hem?
#f
user -
cu (
toseewhoar
elogi
n)
#f
user -
ck <userl
ogi
nname>(
toki
l
lthespeci
fi
eduser
)
55.whati
sAccessCont
rolLi
st(
ACL)
?
Def
inemor
eaccessr
ight
snot
hingbutper
missi
onst
ofi
l
esanddi
rect
ori
es.Usi
ng
AccessCont
rol
li
stweassi
gn t
heper
missi
onst
osomepar
ti
cul
aruser
stoaccesst
he
f
il
esanddi
rect
ori
es.
ACLcancabbeappl
i
edonACLenabl
edpar
ti
ti
ont
hatmeansy
ouneedt
oenabl
eACL
whi
l
emount
ingt
he par
ti
ti
on.
56.Howt
oimpl
ementACLs?
 Cr
eat
eapar
ti
ti
onandf
ormati
twi
thext
4fi
l
esy
stem.
 Mountt
hef
il
esy
stem wi
thACL.
 Appl
yACLoni
t.
Cr
eat
eapar
ti
ti
onusi
ng #f
disk command.
For
matt
heabov
epar
ti
ti
onwi
thext
4fi
l
esy
stem usi
ng #mkf
s.ext
4 <par
ti
ti
onname>
command.
Cr
eat
ethemountpoi
ntusi
ng #mkdi
r/<mountpoi
nt> command.
Mountt
hatf
il
esy
stem ont
hemountpoi
ntusi
ng#mount-
o acl <par
ti
ti
on
name><mountpoi
nt>command.
Mountt
hepar
ti
ti
onper
manent
lyusi
ng #v
im /
etc/
fst
ab (
opent
hisf
il
eandmakean

Rat
nakar
Page43
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

ent
ryasbel
ow)
<par
ti
ti
onname><mountpoi
nt><f
il
esy
stem t
ype> def
aul
ts,
acl 0 0
Sav
eandex
itt
hisf
il
e.
I
fthepar
ti
ti
oni
sal
readymount
edt
henj
ustadd aclaf
terdef
aul
tsi
n/et
c/f
stab f
il
e
andexecut
ethebel
ow command #mount -
o r
emount <par
ti
ti
onname>
57.Howt
ocheckt
heACLper
missi
ons?
#get
facl <opt
ions><f
il
eordi
rect
oryname>
Theopt
ionsar
e,-
d--
--
-> Di
spl
ayt
hedef
aul
tACLs.
-
R--
--
-> Recur
sesi
ntosubdi
rect
ori
es.
58.Howt
oassi
gnACLper
missi
ons?
#set
facl <opt
ions><ar
gument
>:<user
name>:
<per
missi
ons><f
il
eordi
rect
oryname>
Theopt
ionsar
e, -
m -
--
--
> Modi
fi
esanACL.
-
x -
--
--
> Remov
esanACL.
-
b -
--
--
> Remov
eal
ltheACLper
missi
onsont
hatdi
rect
ory
.
-
R -
--
--
>Recur
sesi
ntosubdi
rect
ori
es.
Thear
gument
sar
e,u-
--
--
>user
g-
--
--
>gr
oup
o-
--
--
>ot
her
59.Whati
sthesy
ntaxt
oassi
gnr
eadandwr
it
eper
missi
onst
opar
ti
cul
aruser
,gr
oupand
ot
her
?
#set
facl -
m u:
<username>:
<per
missi
ons><f
il
eordi
rect
ory
>
#set
facl -
m g:
<username>:
<per
missi
ons><f
il
eordi
rect
ory
>
#set
facl -
m o:
<username>:
<per
missi
ons><f
il
eordi
rect
ory
>
60.Whati
sthesy
ntaxt
oassi
gnr
eadandwr
it
eper
missi
onst
opar
ti
cul
aruser
,gr
oupand
ot
heratat
ime?
#set
facl -
m u:
<username>:
<per
missi
ons>,g:
<username>:
<per
missi
ons>,o:
<username>: <per
missi
ons><f
il
eordi
rect
ory
>
Usef
ulcommands:
#set
facl -
x u:
<username><f
il
eordi
rect
oryname> (
tor
emov
etheACL
per
missi
onsf
rom t
heuser
)
#set
facl -
x g:
<username><f
il
eordi
rect
oryname> (
tor
emov
etheACL
per
missi
onsf
rom t
hegr
oup)
#set
facl -
x o:
<username><f
il
eordi
rect
oryname> (
tor
emov
etheACL
per
missi
onsf
rom t
heot
her
)
#set
facl -
b <f
il
eordi
rect
ory
> (
tor
emov
eal
ltheACL
per
missi
onsont
hatf
il
e
di
rect
ory
)
61.Howwi
lly
oul
ockauser
,ifheent
erswr
ongpasswor
d3t
imes?
pam_
tal
l
y.somodul
emai
ntai
nsacountofat
tempt
edaccesses,
canr
esetcounton
success,
candenyaccessi
ftoomanyat
tempt
sfai
l
.Edi
t/et
c/pam.
d/sy
stem-
aut
hfi
l
e,ent
er:

Rat
nakar
Page44
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)#v
i/et
c/pam.
d/sy
stem-
aut
h
Modi
fyasf
oll
ows:
aut
hrequi
redpam_
tal
ly
.sono_
magi
c_r
oot
accountr
equi
redpam_
tal
ly
.sodeny
=3no_
magi
c_r
ootl
ock_
time=180
Wher
e,
 deny
=3 
:Denyaccessi
ftal
l
yfort
hisuserexceeds3t
imes.
 l
ock_
time=180 
:Al
way
sdenyf
or180secondsaf
terf
ail
edat
tempt
.Ther
eis
al
sounl
ock_
time=n 
opt
ion.I
tal
l
owaccessaf
ternsecondsaf
terf
ail
edat
tempt
.If
t
hisopt
ioni
susedt
heuserwi
l
lbel
ockedoutf
ort
hespeci
fi
edamountoft
imeaf
ter
heex
ceededhi
smaxi
mum al
l
owedat
tempt
s.Ot
her
wiset
heaccounti
slockedunt
il
t
hel
ocki
sremov
edbyamanual
int
erv
ent
ionoft
hesy
stem admi
nist
rat
or.
 magi
c_r
oot
 :I
fthemodul
eisi
nvokedbyauserwi
thui
d=0t
hecount
eri
snot
i
ncr
ement
ed.Thesy
s-admi
nshoul
duset
hisf
oruserl
aunchedser
vices,
li
kesu,
ot
her
wiset
hisar
gumentshoul
dbeomi
tt
ed.
 no_
magi
c_r
oot
 :Av
oidr
ootaccountl
ocki
ng,
ift
hemodul
eisi
nvokedbyauserwi
th
ui
d=0
Sav
eandcl
oset
hef
il
e.
62.Howt
oseet
heno.off
ail
edl
ogi
nsoft
heuser
s?
#f
ail
l
og -
u <username> (
toseet
hespeci
fi
ed
user
sfai
l
edl
ogi
nat
tempt
s)
#f
ail
l
og -
a (
toseef
ail
edl
ogi
nat
tempt
sof
al
luser
s)
#f
ail
l
og -
M <Max.no> -
u <username> (
tosetMax.l
ogi
nfai
l
edat
tempt
s
t
othatuser
)
#f
ail
l
og -
M5 -
u r
aju (
tosetMax.l
ogi
nfai
l
ed
at
tempt
sto5f
oruserr
aju)
63.Whati
sdi
skquot
asandhowt
oenabl
ethem?
Byconf
igur
ingt
hedi
skquot
aswecanr
est
ri
ctt
heusert
ouseunl
i
mit
edspaceont
hef
il
e
sy
stem andal
sot
o r
est
ri
ctt
heunl
i
mit
edf
il
esi
nthef
il
esy
stem.Wecanconf
igur
ethedi
sk
quot
asi
nway
s.Theyar
e,
(
i)userquot
as
(
ii
)gr
oupquot
as
St
epst
oenabl
e:
Fi
rstcheckwhet
hert
hequot
apackagei
sinst
all
edornotby #r
pm -
qa|
grep quot
a
command.I
fquot
a packagei
snotI
nst
all
edt
heni
nst
all
thequot
apackageby #y
um
i
nst
allquot
a* -
y command.
#quot
aon (
toenabl
ethequot
a)
#quot
aof
f (
todi
sabl
ethequot
a)
#edquot
a (
toedi
tormodi
fyt
hequot
a)
#r
epquot
a (
todi
spl
ayorr
epor
tthepr
esentquot
a)

Rat
nakar
Page45
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#quot
acheck (
tocr
eat
eaquot
adat
abase)
* quot
ascabbeappl
i
edonf
il
esy
stemsonl
y.
64.Howt
oenabl
etheuserquot
aonaf
il
esy
stem?
(
i)Opent
he/
etc/
fst
ab f
il
eby#v
im/
etc/
fst
abcommandandgot
othemountpoi
nt
ent
ryl
i
neandt
ypeas,
/
dev
/sdb1 /
mnt
/pr
od ext
4 def
aul
ts,usr
quot
a 0 0 (
sav
eand
exi
tthi
sfi
l
e)
(
ii
)Updat
ethequot
aonmountpoi
ntby#mount-
oremount
,usr
quot
a <mount
poi
nt> command.
(
ii
i)Cr
eat
etheuserquot
adat
abaseby#quot
acheck -
cu <mountpoi
nt>
command(
wher
e-c means
cr
eat
edt
hequot
adat
abase and -
u meansuserquot
a).
(
iv)Checkwhet
hert
hequot
aisappl
i
edornotby #mount command.
(
v)Enabl
ethequot
aby #quot
aon <mountpoi
nt> command.
(
vi) Appl
ytheuserquot
aforauserby #edquot
a -
u <username><mount
poi
nt> command.
Fi
l
esy
stem bl
ocks sof
t har
d i
nodes sof
t
har
d
/
dev
/sdb1 0 0 0 0 0
0
bl
ocks -
--
--
> No.ofbl
ocksused(
alr
eady
)
sof
t -
--
--
> War
ningl
i
mit
har
d -
--
--
> Maxi
mum l
i
mit
0 -
--
--
> Unl
i
mit
edusage
i
nodes-
--
--
> No.off
il
escr
eat
ed(
alr
eady
)
*I
fsof
t=10 and har
d=15meansaf
tercr
ossi
ngt
hesof
tli
mitawar
ningmessage
wi
l
lbedi
spl
ayedandi
f har
dli
miti
sal
socr
ossest
heni
twon'
tal
l
owt
o
cr
eat
ethef
il
esf
ort
hatuser
.
(
sav
eandex
itt
heabov
equot
aedi
tor
)
65.Howt
oenabl
ethequot
aonbl
ockl
evel
?
(
i)Appl
ytheuserquot
aforauserby#edquot
a-eu <username><mountpoi
nt>
command.
Fi
l
esy
stem bl
ocks sof
t har
d i
nodes sof
t
har
d gr
aceper
iod
/
dev
/sdb1 0 5000 10000 0 0 0
6day
s
(
sav
eandex
itt
hequot
aedi
tor
)
sof
t=5000 -
--
--
> meansi
fitr
eachesupt
o5MB,
ther
eisnowar
nings.I
fitexceeds
i
e.,
from 5MB -10MB t
her
ewi
l
lbewar
ningsmessages
di
spl
ayed,
butt
hef
il
eswi
l
lbecr
eat
ed.

Rat
nakar
Page46
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

har
d=10000-
--
> I
fitr
eachedt
o10MB,
theni
twi
l
lnotal
l
owt
ocr
eat
ethef
il
es.The
gr
aceper
iodbydef
aul
t i
s7day
s.So,
wecanchanget
hegr
ace
per
iodby #edquot
a -
t command,her
ewecan changet
he
def
aul
t7day
sgr
aceper
iodt
oourr
equi
redday
sofgr
aceper
iod.
gr
aceper
iodmeans,
ift
heusernotcr
eat
edanyf
il
eswi
thi
nthegr
aceper
iodday
sthe
sof
tli
mitbecomesas har
dli
mit
.ie.
,sof
tandhar
dli
mit
sar
eequal
.
#edquot
a -
p <username1><username2> (
toappl
yusername1quot
ast
o
username2,
ie.
,no need
t
oedi
tthequot
aedi
torf
orusername2)
66.Howt
oenabl
ethegr
oupquot
a?
(
i)Opent
he/
etc/
fst
ab f
il
eby#v
im/
etc/
fst
ab commandandgot
othemount
poi
ntent
ryl
i
neandt
ypeas,
/
dev
/sdb1 /
mnt
/pr
od ext
4 def
aul
ts,gr
pquot
a 0 0 (
sav
eand
exi
tthi
sfi
l
e)
(
ii
)Updat
ethequot
aonmountpoi
ntby#mount-
oremount
,usr
quot
a,gr
pquot
a
<mountpoi
nt>command.
(
ii
i)Cr
eat
etheuserquot
adat
abaseby#quot
acheck -
cug <mountpoi
nt>
command(
wher
e-c means cr
eat
edt
hequot
a
dat
abase,-
u meansuserquot
aand-
gmeansgr
oupquot
a).
(
iv)Checkwhet
hert
hequot
aisappl
i
edornotby #mount command.
(
v)Enabl
ethequot
aby #quot
aon <mountpoi
nt> command.
(
vi) Appl
ytheuserquot
aforauserby #edquot
a -
g <gr
oup
name><mountpoi
nt> command.
Fi
l
esy
stem bl
ocks sof
t har
d i
nodes sof
t
har
d
/
dev
/sdb1 0 0 0 0 0
0
bl
ocks -
--
--
> No.ofbl
ocksused(
alr
eady
)
sof
t -
--
--
> War
ningl
i
mit
har
d -
--
--
> Maxi
mum l
i
mit
0 -
--
--
> Unl
i
mit
edusage
i
nodes-
--
--
> No.off
il
escr
eat
ed(
alr
eady
)
* Her
ewecanspeci
fyt
hebl
ockl
evel
quot
aorf
il
elev
elquot
as.
* gr
oupquot
acanbeappl
i
cabl
etoal
ltheuser
soft
hatspeci
fi
edgr
oup.
(
sav
eandex
itt
heabov
equot
aedi
tor
)
67.Howt
ochanget
hepasswor
dformul
ti
pleuser
satat
ime?
#chpasswd (
tochangemul
ti
pleuser
's
passwor
ds)
<username1>:
<passwor
d>
<username2>:
<passwor
d>

Rat
nakar
Page47
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

<username3>:
<passwor
d>
<username4>:
<passwor
d>
<username5>:
<passwor
d> (
Ctr
l+d -
--
--
>tosav
eandexi
t)
* Thent
heabov
e5user
'spasswor
dswi
l
lbechangedatat
ime.Buther
ethe
passwor
dswi
l
lnotbeencr
ypt
ed whi
l
ety
pingpasswor
ds.So,
any
bodycansee
t
hepasswor
ds.i
e.,
ther
eisnosecur
it
y.

4.Net
wor
kConf
igur
ati
onandTr
oubl
eshoot
ing

1. Whati
sNet
wor
k?
Combi
nat
ionoft
womor
ecomput
ersconnect
edt
oget
hert
oshar
ethei
rresour
ceseach
ot
herbymeansof communi
cat
ionl
i
kecabl
eiscal
l
edNet
wor
k.
2. Whati
sNet
wor
king?
I
tisaconnect
ionbet
weent
woormor
ecomput
erst
ocommuni
cat
ewi
theachot
her
.
3. whatar
ethebasi
crequi
rement
sfornet
wor
king?
(
a)NI
C(Net
wor
kInt
erf
aceCar
dorcont
rol
l
er)
(
b)Medi
a(not
hingbutcabl
es)
(
c)Topol
ogy
(
d)Pr
otocol
(
e)I
PAddr
esses
4. Expl
ainaboutNI
Ccar
d?
ANet
wor
kInt
erf
aceCar
dorcont
rol
l
eri
shar
dwar
ecomponentt
hatconnect
sa
comput
ert
oacomput
er net
wor
k.EachNI
Ccar
dwi
l
lbehav
ingMAC (
Medi
aAccess
Cont
rol
l
er)addr
esst
oav
oidconf
li
ctsbet
weensame NI
Cadapt
ers.I
nLi
nuxt
heseNI
C
adapt
eri
srepr
esent
edbyt
hewor
d"et
h".Forex
ampl
eift
woNI
Ccar
dsar
e t
her
eina
sy
stem t
heni
twi
l
lbedenot
edas "
eho"
,"
eth1"
,..
..
.et
c.,
5. Whati
smedi
a?
Medi
aisnot
hingbutcabl
etoconnectt
woorsy
stems.Ex
ampl
e:RJ45,
CAT5andCAT
6,
..
..
etc.
,
6. Whati
stopol
ogy
?
Topol
ogyi
sadesi
gni
nwhi
cht
hecomput
ersi
nnet
wor
kwi
l
lbeconnect
edt
oeachot
her
.
Exampl
efort
opol
ogi
es ar
eBus,
Ring,
Star
,Mesh,
Treet
opol
ogi
es.
7. Whati
spr
otocol
?
A Net
wor
kPr
otocoldef
inesr
ulesandconv
ent
ionsf
orcommuni
cat
ionbet
weent
he
net
wor
kdev
ices.Pr
otocol
s ar
egener
all
yusepacketswi
tchi
ngt
echni
quest
osendand
r
ecei
vemessagesi
nthef
orm ofpacket
s.
Exampl
eforpr
otocol
sar
e TCP/
IP(
Transmi
ssi
onCont
rol
Prot
ocol
andI
nter
net
Pr
otocol
),UPD (
User Dat
agr
am Pr
otocol
)and HTTP (
HyperTextTr
ansf
er
Pr
otocol
),.
..
.et
c.,

Rat
nakar
Page48
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

8. Whatar
ethedi
ff
erencesbet
weenTCP/
IP andUDP pr
otocol
s?
TCP/
IP UDP
Tr
ansmi
ssi
onCont
rol
Prot
ocol UserDat
agr
am Pr
otocol
I
tisconnect
ionor
ient
ed I
tisconnect
ionl
ess
Rel
i
abl
e Non-
Rel
i
abl
e
TCPAcknowl
edgementwi
l
lbesent/r
ecei
ved NoAcknowl
edgement
Sl
owcommuni
cat
ion Fastcommuni
cat
ion
Pr
otocol
No.f
orTCPi
s6 Pr
otocol
No.f
orUDPi
s17
HTTP,
FTP,
SMTP,
..
..
etc.
,usesTCP DNS,
DHCP,
..
..
etc.
,usesUDP

9. Whati
sanI
Paddr
ess?
Ev
eryComput
erwi
l
lbeassi
gnedanI
Paddr
esst
oident
if
yeachonet
ocommuni
cat
ein
t
henet
wor
k.TheI
P addr
esssubcomponent
sar
eCl
assesofanI
Paddr
ess,
Subnetmasks
andGat
eway
.
Cl
assesofI
Paddr
ess:
TheI
Paddr
essesar
efur
therdi
vi
dedi
ntocl
asses.Thecl
assesar
eA,B,
C,D,
Eandt
he
r
angesar
egi
venbel
ow.
Cl
assl
essI
nterDomai
n
St
art End Def
aul
tSubnetmask
Cl
ass Rout
ing
127.
255.
255.
25
Cl
assA 0.
0.0.
0 255.
0.0.
0 /
8
5
191.
255.
255.
25
Cl
assB 128.
0.0.
0 255.
255.
0.0 /
16
5
223.
255.
255.
25
Cl
assC 192.
0.0.
0 255.
255.
255.
0 /
24
5
239.
255.
255.
25
Cl
assD 224.
0.0.
0
5
255.
255.
255.
25
Cl
assE 240.
0.0.
0
5

10.Whati
sloopbackaddr
ess?
Aspeci
alI
Pnumber(
127.
0.0.
1)i
sdesi
gnat
edf
ort
hesof
twar
eloopbacki
nter
faceofa
machi
ne.127.
0.0.
0and 127.
255.
255.
255i
sal
sor
eser
vedf
orl
oopbackandi
susedf
or
i
nter
nal
test
ingonl
ocal
machi
nes.
11.Whati
smul
ti
cast
ing?
Mul
ti
cast
ingal
l
owsasi
ngl
emessaget
obesentt
oagr
oupofr
eci
pient
s.Emai
l
ingand
Tel
econf
erenci
ngar
eexampl
esofmul
ti
cast
ing.I
tusest
henet
wor
kinf
rast
ruct
ureand
st
andar
dst
osendmessages.
12.Whati
ssubnetmask?
Asubnetmaskal
l
owst
heuser
stoi
dent
if
ywhi
chpar
tofanI
Paddr
essi
sreser
vedf
or

Rat
nakar
Page49
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
henet
wor
kandwhi
ch par
tisav
ail
abl
eforhostuse.
13.Whati
sGat
eway
?
AGat
ewayi
sthenet
wor
kpoi
ntt
hatpr
ovi
desent
rancei
ntoanot
hernet
wor
k.Ont
he
i
nter
netanodeor st
oppi
ngpoi
ntcanbeei
thergat
ewaynodeorahost(
endpoi
nt)node.
Bot
hthecomput
ersofi
nter
netuser
sand t
hecomput
ert
hatser
vet
hepagest
ouser
sar
e
hostnodes.Thecomput
ert
hatcont
rol
traf
fi
cwi
thi
nyour company
'snet
wor
koratour
l
ocal
int
ernetser
vicepr
ovi
der(
ISP)ar
ethegat
ewaynodes.
14.Whatar
eimpor
tantconf
igur
ati
onf
il
esi
nnet
wor
kconf
igur
ati
on?
#cat/
etc/
sysconf
ig/
net
wor
k (
Thi
sfi
l
ekeepst
hei
nfor
mat
ionaboutt
hehost
name
assi
gnedt
othesy
stem andi
fwewantt
ochanget
hehost
name
per
manent
ly,
weneedt
ochanget
hehost
namei
nthi
sfi
l
e)
#cat/
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/ (
Thi
sdi
rect
orykeepst
heconf
igur
ati
onof
net
wor
kdev
icesconnect
ed t
othesy
stem.
Exampl
esar
eif
cfg-
eht
0,i
fcf
g-et
h1,
ifcf
g-et
h2,
..
..
.et
c.,
)
#cat/
etc/
host
s(Thi
sfi
l
eisr
esponsi
blef
orr
esol
vi
nghost
namei
ntoI
Paddr
essl
ocal
l
y.
i
e.,
local
DNSi
fDNS
ser
veri
snotav
ail
abl
e)
#cat/
etc/
resol
ve.
conf(
Thi
sfi
l
ekeepst
headdr
essoft
heDNSser
vert
owhi
cht
he
cl
i
ent
swi
l
lbeaccessi
ngt
o r
esol
veI
P
addr
esst
ohost
nameandhost
namet
oIPaddr
ess)
15.Whatar
ethedi
ff
erencesbet
weenMAC andI
Paddr
esses?
MAC Addr
ess I
P Addr
ess
I
tisaper
manentaddr
ess.Sowecannotchange I
tisat
empor
aryaddr
ess.So,
wecanchange
t
hisaddr
ess. t
hisaddr
essanyno.oft
imes.
I
tst
andsf
orMedi
aAccessCont
rol
Addr
ess. I
nter
netPr
otocol
addr
ess.
I
tisaphy
sical
addr
ess. I
tisal
ogi
cal
addr
ess.
I
tist
wot
ypes.
I
PV4:
(I
tisdi
vi
dedi
nto4par
ts)
I
tisdi
vi
dedi
nto6par
ts.
-
--.-
--.-
--.-
--(
each8bi
ts.So,
8X4=32bi
ts
-
--:
---:
---:
---:
---:
---(
each8bi
ts.So,
8X6=48
I
PV6:(I
tisdi
vi
dedi
nto16par
ts)
bi
ts
-
--.-
--.-
--.-
--.-
--.-
--.-
--.-
--.-
--.-
--.-
--.-
--.-
--
.-
--.-
--.-
--(
each8bi
ts.So,
8X16=128bi
ts.
i
fconf
ig (
toseet
heMACaddr
ess) #i
fconf
ig (
toseet
heI
Paddr
ess)
16.Howmanyt
ypesofNI
Ccar
dsav
ail
abl
e?
(
a)et
h0 (
1stNI
C car
d)
(
b)et
h1 (
2ndNI
C car
d)
(
c)br
0 (
Bri
dge-
--
--
>usedf
orcommuni
cat
ionf
rom phy
sical
tov
irt
ual
)
(
d)l
o (
loopbackdev
icenameandI
Paddr
essi
s127.
0.0.
1)
#i
fconf
ig (
toseeal
ltheNI
Cdev
icesconnect
edt
othesy
stem)

Rat
nakar
Page50
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

17.Howmanyt
ypesofcabl
econnect
ionsav
ail
abl
e?
(
i)Cr
osscabl
e (
toconnectt
wosy
stemsdi
rect
ly)
(
ii
)St
rai
ghtcabl
e(t
oconnectmor
esy
stemswi
tht
hehel
pofswi
tch)
#et
htool <dev
icename> (
tocheckt
henet
wor
kcabl
eisconnect
edornot
)
#mi
i
tool<dev
icename> (
Iti
sal
sousedt
ocheckt
henet
wor
kcabl
ebuti
t
wi
l
lnotsuppor
tsRHEL-7 andonl
ysuppor
tsRHEL-6andi
tal
so
wor
ksonphy
sical
syst
em onl
ynotonv
irt
ual
syst
em)
18.I
nhowmanyway
swecanconf
igur
ethenet
wor
k?
Ther
ear
etwoway
stoconf
igur
ethenet
wor
k.
(
a)St
ati
cNet
wor
k.
(
b)Dy
nami
cNet
wor
k.
St
ati
cNet
wor
k:
I
nthi
swayweassi
gnt
heI
Paddr
essandhost
namemanual
l
y.Onceweconf
igur
etheI
P
addr
ess,
itwi
l
lnot change.
Dy
nami
cNet
wor
k:
I
nthi
swayweassi
gnt
heI
Paddr
essandhost
namedy
nami
cal
l
y.Thi
smeanst
heI
P
addr
esswi
l
lchangeatev
eryboot
.
19.Howt
oassi
gnt
hest
ati
cIPaddr
esst
otheNI
Ccar
d?
I
nRHEL-6:
#set
up
(
Mov
ethecur
sort
oNet
wor
kconf
igur
ati
onandpr
essEnt
erkey
)
(
Mov
ethecur
sort
oDev
iceconf
igur
ati
onandpr
essEnt
erkey
)
(
Sel
ectt
heNI
Cadapt
eri
e.,
eth0andpr
essEnt
erkey
)
(
Assi
gnt
heabov
eIPaddr
essandot
herdet
ail
sasperourr
equi
rement
sandmov
ethe
cur
sort
o"OK"andpr
ess
Ent
erkey
)
(
Mov
ethecur
sort
o"Sav
e"t
osav
ethechangesi
ndev
iceconf
igur
ati
onandpr
essEnt
er
key
)
(
Onceagai
nmov
ethecur
sort
o"Sav
e&Qui
t"but
tonandpr
essEnt
erkey
)
(
Final
l
ymov
ethecur
sort
o"Qui
t"but
tonandpr
essEnt
erkeyt
oqui
ttheut
il
it
y)
(
Thenr
est
artt
henet
wor
kser
viceandcheckf
ort
heI
Paddr
essby #ser
vicenet
wor
k
r
est
artcommand)
(
Ift
hechangei
snotr
efl
ect
edwi
tht
heabov
eser
vice,
thenr
est
artt
henet
wor
kmanager
by
#ser
viceNet
wor
kManager
r
est
artcommand)
#i
fconf
ig (
toseet
heI
Paddr
essoft
heNI
Ccar
d)
#pi
ng <I
Paddr
ess> (
tocheckwhet
hert
heI
Pispi
ngi
ngornot
)
I
nRHEL-7:
#nmcl
iconnect
ion show (
toseeal
lthenet
wor
kconnect
ions)

Rat
nakar
Page51
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#nmcl
idev
ice show (
toseet
henet
wor
kdet
ail
sifal
readyconf
igur
ed
manual
l
yordy
nami
cal
l
y)
#nmcl
iconnect
ionaddcon-
name "
Syst
em et
h0"i
fnameet
h0t
ypeet
her
net(
toadd
t
henet
wor
kconnect
ion)
#nmcl
iconnect
ionmodi
fy"
Syst
em et
h0"i
pv4.
addr
esses'
<IPaddr
ess>/
<net
mask
><gat
eway>' i
pv4.
dns<dnsser
verI
Paddr
ess> i
pv4.
dns-
sear
ch <
domai
nname> i
pv4.
met
hod <st
ati
cormanual
l
y> (
toassi
gnI
Paddr
ess,
gat
eway
,dns,
domai
nnameandconf
igur
ethenet
wor
kasst
ati
cormanual
l
y)
#nmcl
iconnect
ionup "
Syst
em et
h0" (
toupt
heconnect
ion)
#sy
stemct
lrest
artnet
wor
k (
tor
est
artt
henet
wor
kser
vice)
#sy
stemct
lenabl
enet
wor
k (
toenabl
ethenet
wor
kser
vice)
#i
fconf
ig (
toseet
heI
Paddr
essoft
heNI
Ccar
d)
#pi
ng<I
Paddr
ess> (
tocheckwhet
hert
heI
Pispi
ngi
ngor
not
)
20.Whatar
ethedi
ff
erencesbet
weenRHEL-6andRHEL-7net
wor
kconf
igur
ati
onf
il
es?
RHEL-6 RHEL-7
/
etc/
sysconf
ig/
net
wor
k-scr
ipt
s i
sthedi
rect
ory /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s i
sthedi
rect
ory
whi
chcont
ainst
heNI
Cconf
igur
ati
oni
nfor
mat
ion. whi
chcont
ainst
heNI
Cconf
igur
ati
oni
nfor
mat
ion.
/
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-<dev
ice /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-<dev
ice
name> i
sthef
il
ewhi
chcont
ainst
heNI
C name> i
sthef
il
ewhi
chcont
ainst
heNI
C
conf
igur
ati
ondet
ail
s. conf
igur
ati
ondet
ail
s.
/
etc/
resol
ve.
conf i
sthef
il
ewhi
chcont
ains /
etc/
resol
ve.
conf i
sthef
il
ewhi
chcont
ains
DNSser
verI
P anddomai
nnamel
ocat
ion. DNSser
verI
P anddomai
nnamel
ocat
ion.
/
etc/
sysconf
ig/
net
wor
k i
sthehost
name /
etc/
host
name i
sthehost
nameconf
igur
ati
on
conf
igur
ati
onf
il
e. f
il
e.
/
etc/
host
s i
sthef
il
ewhi
chcont
ainst
hel
ocal /
etc/
host
s i
sthef
il
ewhi
chcont
ainst
hel
ocal
DNSser
verI
Paddr
ess. DNSser
verI
Paddr
ess.

21.Whatar
ethedi
ff
erencesbet
weenDy
nami
candSt
ati
cconf
igur
ati
oni
nfor
mat
ion?
Dy
nami
cconf
igur
ati
oni
nfor
mat
ion St
ati
cconf
igur
ati
oni
nfor
mat
ion
Dev
ice=<NI
Cdev
icename> Dev
ice=<NI
Cdev
icename>
HWADDR=02:
8a:
a6:
30:
45 HWADDR=02:
8a:
a6:
30:
45
Boot
prot
o=DHCP Boot
prot
o=none (
meansst
ati
cnet
wor
k)
Onboot
=yes (
yes meanswhenev
erwer
est
art
t
hesy
stem t
hisconnect
ionwi
l
lbeact
ivat
edand
Onboot
=yes
nomeanswhenev
erwer
est
artt
hesy
stem t
he
connect
ionwi
l
lbedeact
ivat
ed)
Ty
pe=Et
her
net Ty
pe=Et
her
net
User
ctl
=yes/
no-
--
->I
fiti
syesal
lnor
mal
user
s User
ctl
=yes/
no-
--
->I
fiti
syesal
lnor
mal
user
s
candi
sabl
etheNI
Ccar
dandI
fiti
snoex
cept candi
sabl
etheNI
Ccar
dandI
fiti
snoexcept

Rat
nakar
Page52
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
ootusernobodycandi
sabl
etheNI
Ccar
d. r
ootusernobodycandi
sabl
etheNI
Ccar
d.

22.Howt
osett
hehost
namet
empor
ari
lyandper
manent
ly?
RHEL-6:
#host
name <f
ull
yqual
i
fieddomai
nname> (
tosett
hehost
namet
empor
ari
l
y)
#v
im /
etc/
sysconf
ig/
net
wor
k (
tosett
hehost
nameper
manent
ly)
HOSTNAME=<f
ull
yqual
i
fieddomai
nname>
(
sav
eandexi
tthi
sfi
l
e)
#ser
vicenet
wor
krest
art (
toupdat
ethehost
namei
nthenet
wor
k)
#chkconf
ignet
wor
kon (
toenabl
etheconnect
ionatnex
treboot
)

RHEL-7:
#host
name <f
ull
yqual
i
fieddomai
nname> (
tosett
hehost
name
t
empor
ari
l
y)
#host
namect
lset
-host
name <f
ull
yqual
i
fieddomai
nname> (
tosett
he
host
nameper
manent
ly)
#sy
stemct
lrest
artnet
wor
k (
toupdat
ethehost
name
i
nthenet
wor
k)
#sy
stemct
lenabl
enet
wor
k (
toenabl
etheconnect
ion
atnextr
eboot
)
23.Howt
otr
oubl
eshooti
ftheNI
Cisnot
wor
king?
(
a)Fi
rstcheckt
heNI
Ccar
dispr
esentornotby#i
fconf
ig command.
(
b)I
fpr
esentt
hencheckt
hest
atusoft
heNI
C car
disenabl
edordi
sabl
edbycl
i
ckon
Sy
stem menuont
hest
atus bar
,thensel
ectNet
wor
kConnect
ionsmenu.
(
c)Cl
i
ckonI
PV4set
ti
ngst
ab,sel
ectt
hedev
iceet
h0oranyot
herandsel
ectEnabl
e
but
ton,t
henAppl
yandOK.
(
d)Open/
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h0f
il
echeckUser
ctl
=yesorno.I
fiti
s
y
esmakei
tasno,
then checkOnboot
=yesorno.I
fiti
snomakei
tasy
esand
sav
ethatf
il
e.
(
e)I
fnotpr
esentt
hencheckt
hest
atusoft
heNI
C car
disenabl
edordi
sabl
edbycl
i
ckon
Sy
stem menuont
he st
atusbar
,thensel
ectNet
wor
kConnect
ionsmenu.
(
f)Cl
i
ckonI
PV4set
ti
ngst
ab,sel
ectt
hedev
iceet
h0oranyot
herandsel
ectEnabl
e
but
ton,t
henAppl
yandOK.
(
g)Usi
ng#set
up(
inRHEL-6)or#nmcl
i(i
nRHEL-7)commandsassi
gnt
heI
P
addr
esst
othesy
stem and r
est
artt
henet
wor
kser
viceby#ser
vicenet
wor
k
r
est
art(
inRHEL-6)or#sy
stemct
lrest
artnet
wor
k(i
n RHEL-7)commands
andenabl
etheser
viceatnextr
ebootby#chkconf
ignet
wor
kon(
inRHEL-6)or
#sy
stemct
lenabl
enet
wor
k(i
nRHEL-7)commands.
(
h)Thenupt
heconnect
ionby#i
fconf
iget
h0up(
inRHEL-6)or#nmcl
iconnect
ion
up<connect
ionname> commands.

Rat
nakar
Page53
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Ev
ent
houghi
tisnotwor
kingmaybet
hef
aul
tinNI
Ccar
d.I
fso,
cont
actt
hehar
dwar
e
v
endorbyt
aki
ngt
he per
missi
onsf
rom hi
gheraut
hor
it
ies.
24.Whati
sbondi
ngandhowt
oconf
igur
ebondi
ng?(
from RHEL-6)
Whati
sli
nkaggr
egat
ionorbr
idgi
ngort
eami
ngandhowt
oconf
igur
eteami
ng?(
from
RHEL-7)
Bondi
ngorTeami
ngorBr
idgi
ng:
Col
l
ect
ionofmul
ti
pleNI
Ccar
dsandmaket
hem assi
ngl
econnect
ion(
vir
tual
)NI
Ccar
d
i
scal
l
edbondi
ng.
I
tisnot
hingbutbackupofNI
Ccar
ds.
I
nRHEL-6i
tiscal
l
edasBondi
ngorBr
idgi
ng.
I
nRHEL-7i
tiscal
l
edasTeami
ngorLi
nkaggr
egat
ion.
Ther
ear
e3t
ypesofbackupi
nBondi
ngorTeami
ng.
(
a)Mode0 -
--
--
> RoundRobbi
n
(
b)Mode1 -
--
--
> Act
ivebackup
(
c)Mode3 -
--
--
> Br
oadcast
ing
Mode0:
 I
tpr
ovi
desl
oadbal
anci
ngandf
aul
ttol
erance.
 Dat
awi
l
lbeshar
edbybot
hNI
Ccar
dsi
nroundr
obbi
n.
 I
foneNI
Ccar
dfai
l
edt
henanot
herNI
Ccar
dwi
l
lbeact
ivat
edt
ocommuni
cat
ewi
th
t
heser
ver
 So,
ther
eisal
oadbal
anci
ngandf
aul
ttol
erancef
eat
ures.
Mode1:
 Act
ivebackupmeansonl
yoneNI
Ccar
disact
ivat
edatat
imeandanot
heronei
sin
downst
ate.
 So,
ther
eisnol
oadbal
anci
ng.
 Buti
foneNI
Ccar
disf
ail
edt
henanot
herNI
Ccar
dwi
l
lbeact
ivat
edaut
omat
ical
l
y.
Mode3:
 I
nthi
smodebr
oadcast
ingi
sdone.
 I
nthi
sthesamedat
awi
l
lbet
ransf
err
edt
hrought
woNI
Ccar
ds.
 Sot
her
eisnol
oadbal
anci
ng.
 Buti
foneNI
Ccar
disf
ail
edt
hensecondNI
Ccar
dwi
l
lbeact
ivat
edaut
omat
ical
l
y.
So,
all
the3modesar
esuppor
tsonl
yfaul
ttol
erance,
butr
oundr
obbi
nist
heonl
yone
modet
hatpr
ovi
desl
oad bal
anci
ng.
Requi
rement
stoconf
igur
e:
(
i)Mi
nimum t
woNI
Ccar
ds.
(
ii
)OneI
Paddr
ess.
(
ii
i) Connect
iont
ypei
sbond(
inRHEL-6)and t
eam (
inRHEL-7)nott
he
et
her
nett
ype.
Her
enoneedt
oassi
gnt
heI
Paddr
essesf
ort
woNI
Ccar
dsandwear
egi
vi
ngonl
y

Rat
nakar
Page54
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

oneI
Paddr
esst
obondor t
eam.
Bondi
ngconf
igur
ati
on:(
inRHEL-6)
(
i)#v
im /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-bond0
DEVI
CE=bond0
I
PADDR=<I
Paddr
ess>
TYPE=et
her
net
NETMASK=255.
225.
225.
0or<I
Paddr
esscl
assnet
mask>
ONBOOT=y
es
BOOTPROTO=none
USERCTL=no
MASTER=y
es
BONDI
NG_
OPTS="
mode0 ormode1 ormode3 mi
i
mon=50" (
Sav
eandexi
tthi
s
f
il
e)
(
ii
)vi
m /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h1
DEVI
CE=et
h1
ONBOOT=y
es
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=y
es (
Sav
eandex
itt
hisf
il
e)
(
ii
i) v
im /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h2
DEVI
CE=et
h2
ONBOOT=y
es
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=y
es (
Sav
eandex
itt
hisf
il
e)
(
iv) Toaddv
irt
ualNI
Ccar
dset
h1andet
h2:
#set
up -
--
--
> Net
wor
king -
--
--
> Dev
iceconf
igur
ati
on-
--
--
> NewDev
ice -
--
--
>
et
h1
Name:
eth1
Dev
ice:
eth1 (
sav
eandexi
tthi
sset
up)
#set
up -
--
--
> Net
wor
king -
--
--
> Dev
iceconf
igur
ati
on-
--
--
> NewDev
ice -
--
--
>
et
h2
Name:
eth2
Dev
ice:
eth2 (
sav
eandexi
tthi
sset
up)
(
v)Addi
ngbond0connect
ion:
#set
up -
--
--
> Net
wor
king -
--
--
> Dev
iceconf
igur
ati
on-
--
--
> NewDev
ice -
--
--
>
bond0
Name:
bond0

Rat
nakar
Page55
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Dev
ice:
bond0
I
Paddr
ess:
<IPaddr
ess>
Net
mask:
255.
255.
255.
0
Def
aul
tgat
eway:
<gat
ewayI
Paddr
ess> (
sav
eandexi
tthi
sset
up)
#i
fdownbond0
#i
fdownet
h1
#i
fdownet
h2
#i
fupbond0
#ser
viceNet
wor
kManagerst
op
#ser
vicenet
wor
krest
art
#chkconf
ignet
wor
kon
#ser
viceNet
wor
kManagerr
est
art
#cat/
proc/
net
/bondi
ng/
bond0 (
tocheckt
hebondi
ng
i
nfor
mat
ion)
#wat
ch-
n1 cat/
proc/
net
/bondi
ng/
bond0 (
tocheckt
hebondi
ng
i
nfor
mat
ionf
orev
ery1mi
nut
e)
#echo"
eth1">/
sys/
dev
ices/
vir
tual
/net
/bond0/
bondi
ng/
act
ive_
slav
e(t
oputt
he
et
h1NI
Cinact
ivest
ate)
Teami
ngconf
igur
ati
on:
(
i)Addt
het
eam0connect
ionby
#nmcl
iconnect
ionaddcon-
name t
eam0 i
fname t
eam0 t
ype t
eam
conf
ig'
{"r
unner
":{"
name":"
roundr
obbi
n"or"
act
ivebackup"or
"
broadcast
ing"}
}'
(
ii
)Addt
het
woNI
Ccar
dsonebyonet
otheabov
ecr
eat
edconnect
ionby
#nmcl
iconnect
ionaddcon-
namepor
t1i
fnameet
h1t
ypet
eam-
slav
emast
er
t
eam0
#nmcl
iconnect
ionaddcon-
namepor
t2i
fnameet
h2t
ypet
eam-
slav
emast
er
t
eam0
(
ii
i)Assi
gnt
hest
ati
cIPaddr
esst
othet
eam0connect
ionby
#nmcl
iconnect
ionmodi
fyt
eam0i
pv4.
addr
esses<I
Paddr
ess>/
<net
mask>
i
pv4.
met
hodst
ati
c
(
iv) Upt
heconnect
ionby
#nmcl
iconnect
ionupt
eam0
(
v)Toseet
het
eam0connect
ionupdet
ail
sby
#t
eamdct
lteam0st
ate
(
vi) Tocheckt
heconnect
ioncommuni
cat
ionby
#pi
ng -
Iteam0 <I
Paddr
ess>
(
vii
)Todownt
heoneNI
Ccar
dint
eam0by
#nmcl
iconnect
iondownpor
t1
(
vii
i
)teamdct
lteam0 st
ate (
tocheckt
het
eam0NI
Ccar
dupordowndet
ail
s)

Rat
nakar
Page56
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

25.Whati
sthedi
ff
erencebet
ween 
TCP 
and 
UDP 
prot
ocol
?
TCPi
saconnect
ionor
ient
edpr
otocol
andcont
aint
hei
nfor
mat
ionofsenderaswel
las
r
ecei
ver
.
Exampl
e:HTTP,FTP,
Tel
net
 TCPi
ssl
owert
hanUDPduet
oit
ser
rorchecki
ngmechani
sm
 UDPpr
otocol
sar
econnect
ionl
esspacket
shav
enoi
nfor
mat
iont
owher
etheyar
e
goi
ng.Theset
ypeofpor
tsar
egener
all
yusedf
orbr
oadcast
ing.
 
Forexampl
e:DNS,DHCP
 UDPar
efast
er
26.Whatar
ethebenef
it
sofNI
CTeami
ng?
(
i) 
Loadbal
anci
ng
(
ii
)Faul
tTol
erance
(
ii
i) Fai
l
over
27.Ment
ional
lthenet
wor
kconf
igur
ati
onf
il
esy
ouwoul
dcheckt
oconf
igur
eyouret
her
net
car
d?
(
i)/
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h*
(
ii
)/et
c/sy
sconf
ig/
net
wor
k
(
ii
i) /
etc/
resol
ve.
conf
(
iv)/
etc/
nsswi
tch.
conf
28.Whati
stheuseof/
etc/
resol
ve.
conf
?
I
tcont
ainst
hedet
ail
sofnameser
ver
,i.
e.,det
ail
sofy
ourDNSser
verwhi
chhel
psus
connectt
oInt
ernet
.
29.Whati
stheuseof/
etc/
host
sfi
le?
Tomapanyhost
namet
oit
srel
evantI
Paddr
ess.
30.Whati
sthecommandt
ocheckal
ltheopenpor
tsofy
ourmachi
ne?
#nmapl
ocal
host
31.Whati
sthecommandt
ocheckal
ltheopenpor
tsofr
emot
emachi
ne?
#nmap<I
Paddr
essorhost
nameoft
her
emot
esy
stem>
32.Whati
sthecommandt
ocheckal
lthel
ist
eni
ngpor
tsandser
vicesofy
ourmachi
ne?

net
stat-
ntul
p
33.Howcany
oumakeaser
vicer
unaut
omat
ical
lyaf
terboot
?
#chkconf
ig 
<ser
vicename> on
34.Whatar
ethe6r
unl
evel
sofl
inux?Andhowcany
ouconf
igur
eyourscr
iptt
orunonl
y
whent
hesy
stem boot
s i
nto 
GUI
 andnott
oanyot
herr
unl
evel
?
 
0Powerof
f
1 Si
ngl
euser
2 Mul
tiuserwi
thoutnet
wor
k
3 Mul
ti
userwi
thnet
wor
k
4 Dev
elopmentpur
pose
5 GUI

Rat
nakar
Page57
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

6 Rest
art
#chkconf
ig-
-l
evel
5ser
vice_
nameon
#chkconf
ig-
-l
evel
1234ser
vice_
nameof
f
35.Whati
sa3wayhandshakepr
otocol
?Gi
veanexampl
eofi
t.
SYN-sy
stem 1sendsSYNsi
gnal
tor
emot
esy
stem.
SYN-
ACK-r
emot
esy
stem r
ecei
vest
hesy
nsi
gnal
andsendsacksi
gnal
.
ACK-sy
stem agai
nrecei
vesacksi
gnal
from r
emot
esy
stem andconnect
ioni
s
est
abl
i
shed.
ForExampl
e: 
Wheny
oupi
ngt
oamachi
ney
ouar
esendi
ngaSYNsi
gnal
whi
chi
sACKby
t
her
emot
emachi
ne t
heni
tsendsaSYNACKsi
gnal
backt
othehostmachi
ne.Thent
he
hostmachi
ner
ecei
vesSYNACKandsendst
he ACKsi
gnal
backt
oconf
ir
mthesame.
36.Whatar
ethepossi
bleway
stochecki
fyoursy
stem i
sli
steni
ngt
opor
t67?
#nmapl
ocal
host|
grep67
#net
stat-
ntul
p|gr
ep67
37.Expl
ainaboutI
PV6?
I
t'
slengt
his128bi
ts.I
t'
snet
maski
s64
#nmcl
iconnect
ionmodi
fy"
Syst
em et
h0"i
pv6.
addr
esses 2005:
db8:
0:1:
:
a00:
1/64
i
pv6.
met
hodst
ati
c
(
toaddt
heI
PV6v
ersi
onofI
Paddr
esst
othe
connect
ion"
Syst
em et
h0")
#nmcl
iconnect
ionmodi
fy"
Syst
em et
h0"i
pv4.
addr
esses'
172.
25.
5.11/
24
172.
25.
5.254'i
pv4.
dns
172.
25.
254.
254 i
pv4.
dns-
sear
chex
ampl
e.com i
pv4.
met
hod st
ati
cipv
6.
addr
esses2005:
ac18:
:
45/
64
i
pv6.
met
hodst
ati
c (
toassi
gni
pv4andi
pv6I
Paddr
essest
o
"
Syst
em et
h0connect
ion)
#nmcl
iconnect
iondown"
Syst
em et
h0" (
todownt
he"
Syst
em et
h0"
connect
ion)
#nmcl
iconnect
ionup"
Syst
em et
h0" (
toupt
he"
Syst
em et
h0"connect
ion)
38.Howt
otr
oubl
eshooti
fthenet
wor
kisnotr
eachi
ng?
(
i)Fi
rstcheckt
henet
wor
kcabl
eisconnect
ed ornotby#et
htool <NI
C dev
ice
name> command.i
f connect
edt
hencheckt
heI
Paddr
essi
sassi
gnedornotby#
i
fconf
ig <NI
Cdev
icename> command.
(
ii
)Thencheckt
hesy
stem upt
imeby#upt
ime command.
(
ii
i)Thencheckt
henet
wor
kser
vicesst
atusby#ser
vicenet
wor
kst
atus and #
ser
viceNet
wor
kManager st
atus commands.
(
iv) Thencheckt
henet
wor
kser
viceatRunLev
elby#Chkconf
ig -
-l
ist
net
wor
k command.
(
v)Thencheckwhet
hert
hesour
cenet
wor
kanddest
inat
ionnet
wor
kar
eint
hesame
domai
nornot
.

Rat
nakar
Page58
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
v)Thenf
inal
l
ycheckt
her
out
ingt
abl
eby#r
out
e-n command.

Ot
herusef
ulcommands:
#pi
ng<I
Paddr
essorhost
name> (
tocheckt
hepi
ngi
ng)
Nor
mal
l
ythepi
ngcommandpi
ngscont
inuousl
yunt
ilast
opsi
gnal
reachesbyCt
rl+c,
sot
oav
oidcont
inuouspi
ngi
ngby
#pi
ng-
c<number
><I
Paddr
ess> (
topi
ngupt
othespeci
fi
ednoof
t
imes)
#i
pcal
c-m <I
Paddr
ess) (
tof
indt
hesubnetmaskf
ort
hat
speci
fi
edI
Paddr
ess)
Nor
mal
l
yIPaddr
essesar
eassi
gnedbyI
SP(
Int
ernetSer
vicePr
ovi
der
)andmanagedby
I
ANA(
Int
ernetAssi
gn
NumberAut
hor
it
y)
#i
fconf
ig (
toseeorcheckal
ltheNI
Cdev
ice
namesandI
P addr
esses)
#et
htool <NI
Cdev
icename> (
tocheckt
henet
wor
kcabl
eis
connect
edornot
)
#mi
i
tool<NI
Cdev
icename> (
Iti
sal
sousedt
ocheckt
henet
wor
k
cabl
ebuti
twor
kson phy
sical
syst
em noton
v
irt
ual
syst
em andsuppor
tsi
nRHEL-6onl
y)
#i
paddrshow (
toshowal
lNI
Cdev
icespr
esentont
he
sy
stem)
#host
name (
toseet
hehost
namewi
thf
ull
yqual
i
fied
domai
nname)
#host
name-
i (
toseet
heI
Paddr
essoft
hesy
stem)
#host
name-
d (
tocheckt
hedomai
nnameoft
he
sy
stem)
#host
name-
s (
tocheckt
hehost
namewi
thoutdomai
n
name)
#net
stat-
r (
tocheckt
hedef
aul
tgat
ewayand
r
out
ingt
abl
e)
#r
out
e (
tocheckt
hedef
aul
tgat
ewaywi
th
r
out
ingt
abl
e)
#i
prout
e (
todi
spl
ayt
heNI
Cdev
icewi
thdef
aul
t
gat
eway
)
#di
g or#hostor#nsl
ookup (
all
areusedt
oresol
vet
hename
t
oIPandI
Ptoname)
#nsl
ookup <I
Paddr
ess> (
tor
esol
veI
Ptoname)
#nsl
ookup<host
name> (
tor
esol
venamet
oIP)
#host<I
Paddr
ess> (
tor
esol
veI
Ptoname)

Rat
nakar
Page59
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#host<f
ull
yqual
i
fieddomai
nname> (
tor
esol
venamet
oIPaddr
ess)
#di
g-x <I
Paddr
ess> (
tor
esol
veI
Paddr
esst
oname)
#di
g <f
ull
yqual
i
fieddomai
nname> (
tor
esol
venamet
oIPaddr
ess)
#nmcl
i (
Net
wor
kManagerCommandLi
ne
I
nter
faceusedt
o
conf
igur
ethenet
wor
kset
upi
nRHEL-7)
#set
up (
toset
upt
hest
ati
cnet
wor
kinRHEL-2,
3,
4,5and6)
#nmt
ui (
toset
upt
hest
ati
cnet
wor
kinGUImode
f
orRHEL-7)
#nmcl
idev
iceshow (
Itdi
spl
aysal
ltheNI
Cdev
icesnet
wor
k
i
nfor
mat
ionoft
hesy
stem )
#nmcl
idev
iceshowet
h0 (
toseeal
lthenet
wor
kdev
ices
i
nfor
mat
ionoft
heet
h0)
#nmcl
iconnect
ionornmcl
iconnect
ionshow (
toseeal
lthenet
wor
kconnect
ion
names)
#nmcl
iconnect
ionaddcon-
name<connect
ionname>i
fname<NI
Cdev
icename>
t
ypeet
her
net
(
tocr
eat
eanewconnect
ionnamef
or
et
h0)
#nmcl
iconnect
ionshow -
-act
ivat
e (
itshowswhi
chconnect
ioni
s
act
ivecur
rent
ly)
#nmcl
iconnect
ionaddcon-
name <connect
ionname> i
fname <NI
Cdev
icename>
t
ypeet
her
net
(
toaddaconnect
ionnamet
oNI
Cdev
ice)
#nmcl
iconnect
ionmodi
fy<connect
ionname>i
pv4.
addr
esses'
<IP
addr
ess>/
<net
mask><def
aul
tgat
eway
>'
i
pv4.
dns <dnsser
verI
Paddr
ess>i
pv4.
dsn-
sear
ch <domai
nname> i
pv4.
met
hod
<st
ati
c/manual
>
(
tomodi
fyt
heconnect
ionasst
ati
candassi
gnt
heI
P,gat
eway
,dnsI
P,
domai
nname)
#nmcl
iconnect
iondel
ete <connect
ionname>(
todel
etet
hespeci
fi
edconnect
ion)
#nmcl
iconnect
ionmodi
fy<connect
ionname>i
pv4.
met
hod<st
ati
c/manual
>(t
o
modi
fydy
nami
cconnect
ion
t
ost
ati
cconnect
ion)
#nmcl
iconnect
ionup<connect
ionname> (
toact
ivat
eorupt
hespeci
fi
ed
connect
ion)
#nmcl
iconnect
iondown<connect
ionname> (
todi
sabl
eordownt
hespeci
fi
ed
connect
ion)
#nmcl
iconnect
ionshow <connect
ionname>(
toseet
hei
nfor
mat
ionaboutt
he

Rat
nakar
Page60
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

speci
fi
edNI
Cdev
ice)
#pi
ng -
I<NI
C dev
icename><I
Paddr
ess> (
tocheckt
heconnect
ionf
rom NI
C
dev
icet
oIPaddr
ess)
#host
name <f
ull
yqual
i
fieddomai
nname> (
tosett
hehost
namet
empor
ari
l
y)
#host
namect
lset
-host
name <f
ull
yqual
i
fieddomai
nname> (
tosett
hehost
name
per
manent
lyi
nRHEL-7)
NOTE:Whenev
erwechangeanypar
amet
ersi
n/et
c/sy
sconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-
<NI
Cdev
icename> f
il
e,t
henwehav
etor
eloadt
hatf
il
eandagai
nwehav
etoup
t
heconnect
ion(
not
hingbutact
ivat
ethe connect
ionby #nmcl
iconnect
ion
r
eload command.
#nmcl
iconnect
ionr
eload (
tor
eloadt
heconf
igur
ati
onoft
heconnect
ioni
fany
changesoni
tandi
trel
oadsal
l
conf
igur
ati
onf
il
es)
#nmcl
iconnect
ionr
eload /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-<NI
Cdev
icename>
(
tor
eloadasi
ngl
efi
l
e)
#host
namect
lst
atus (
itdi
spl
aysf
ull
det
ail
soft
hehost
nameand
wor
ksi
nRHEL-7onl
y)
#nmcl
inet
wor
kingof
f (
todi
sabl
eal
ltheconnect
ionsatat
ime)
#nmcl
idev
icest
atus (
todi
spl
ayal
lNI
Cdev
iceconnect
ions
st
atuses)
#nmcl
iconnect
ionmodi
fy<connect
ionname>+i
pv4.
dns<secondar
ydnsser
verI
P>
(
toaddasecondar
y
dnsser
verI
Ptot
heexi
sti
ngconnect
ion)
#net
stat-
ntul
p (
tocheckhowmanyopenpor
tsar
e
t
her
einl
ocal
syst
em)
#ss -
ntul
p ( " "
)
#nmap (
tocheckhowmanyopenpor
tsar
e
t
her
einr
emot
esy
stem)
#t
racepat
h (
itdi
spl
ayst
her
out
ingi
nfor
mat
ion)
#mi
i
tool<NI
Cdev
icename> (
tocheckt
henet
wor
kcabl
eis
connect
edornot
)
#et
htool<NI
Cdev
icename> ( " " )
#i
fconf
ig (
tocheckt
heNI
Ccar
disenabl
eornot
)
#i
fup <NI
C dev
icename> (
toenabl
eorupt
heNI
Ccar
d)
#i
fdown <NI
Cdev
icename> (
todi
sabl
eordownt
heNI
Ccar
d)
#r
out
e-n (
tocheckt
hegat
eway
)
#cat/
etc/
resol
ve.
conf (
tocheckt
hednsser
veri
nfor
mat
ion)
#cat/
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-<NI
Cdev
icename> (
toseet
heNI
C
dev
icei
nfor
mat
ion)

Rat
nakar
Page61
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#host
name orcat/
etc/
sysconf
ig/
net
wor
k (
tocheckt
hehost
namei
nRHEL-6)
#host
namect
lst
atus orcat/
etc/
host
name(
tocheckt
hehost
namei
nRHEL-7)
#pi
ng <I
Paddr
ess> (
tocheckt
heconnect
ion
communi
cat
ion)
#chkconf
ig -
-l
ist (
tol
i
stal
ltheser
viceswhi
char
erunni
ng
atboot
imei
nRHEL-6&7)
#sy
stemct
lli
st-
uni
t-
fi
les (
tol
i
stal
lthepr
ocesseswhi
char
e
r
unni
ngatboott
imei
nRHEL-7)
#chkconf
ig -
-l
evel<ser
vicename> (
itwi
l
lsett
heser
viceatr
unl
evel
3whent
he
sy
stem i
sboot
ing)
#ser
vice -
-st
atus-
all (
toseet
hel
i
stofal
lthepr
ocesseswhi
char
e
cur
rent
lyr
unni
ng)
#l
s/et
c/i
nit
.d (
ist
hel
ocat
ionofal
ltheser
vicesanddeamons
i
nRHEL-6)
#l
s/usr
/l
ib/
syst
emd/
syst
em (
ist
hel
ocat
ionofal
ltheser
vicesanddeamons
i
nRHEL-7)
#/
etc/
rc.
local (
ist
hel
astscr
iptt
ober
unwhent
hesy
stem i
s
boot
ing)
(
Ifweent
eras sshd st
opatt
hel
astl
i
neoft
hescr
iptf
il
ethen sshd wi
l
lbe
st
oppedev
ent
hought
hat
sshd i
senabl
ed)
#ser
vicesshdst
atus (
tocheckt
hesshdst
atus)
#ser
vice -
-ser
vice-
all (
toseet
hepr
ocessI
D ofal
ltheser
vices)
#net
stat-
ntul
p (
toseeal
ltheser
viceswi
thpor
tno.
,st
atus,
pr
ocessI
Dandal
lopen por
tsi
nlocal
syst
em,
r
out
ingt
abl
eandNI
Cdev
icei
nfor
mat
ion)
-
n--
--
-> por
tno.(
numer
icno) -
t--
--
->t
cppr
otocol
-
u--
--
-> updpr
otocol -
l--
--
-> por
tisl
i
steni
ng
ornot
-
p--
--
-> di
spl
ayt
hepr
ocessI
D
#net
stat -
r (
toseeal
lrout
ingt
abl
einf
ormat
ion)
#net
stat -
i (
toseeal
ltheNI
Ccar
dsi
nfor
mat
ion)
#nmap (
toseet
henet
wor
kmappi
ngi
e.,openpor
tsl
i
st
onr
emot
esy
stem)
Not
e:Bydef
aul
tthi
scommandwi
l
lnotav
ail
abl
e.So,
fir
sti
nst
all
thenmappackage
by#y
oui
nst
all
nmap-
y
#nmap <r
emot
esy
stem I
Paddr
ess> (
toseeal
ltheser
viceswhi
char
erunni
ngi
nthe
speci
fi
edr
emot
esy
stem)
#nmap<r
emot
eIP1><r
emot
eIP2><r
emot
eIP3>(
toseet
her
unni
ngser
viceson
speci
fi
edr
emot
esy
stems)

Rat
nakar
Page62
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#nmap 172.
25.
0.11-50 (
toseet
her
unni
ngser
viceon
172.
25.
0.11t
o172.
25.
0.50sy
stems)
#nmap -
p 80<r
emot
eIP> (
toseet
heht
tppor
tisr
unni
ngornotonspeci
fi
ed
r
emot
esy
stem)
#nmap -
p 80-90 <r
emot
eIP> (
toseepor
tno'
s80t
o90ar
erunni
ngornot
onr
emot
esy
stems)
#nmap -
sp 172.
25.
0.0/
24 (
toseeal
lthesy
stemswhi
char
einupst
atei
e.,
172.
25.
0.1,
172.
25.
0.2,
(
wher
es-
-scan& p-
-pi
ng) 172.
25.
0.3,
..
..
..
upt
o
172.
25.
0.254sy
stems)
Openaf
il
e,wr
it
eal
lthesy
stemsI
Paddr
esses,
sav
e&ex
itt
hef
il
e.Ex
ampl
ehasgi
ven
bel
ow,
#v
im coss
172.
25.
2.50
172.
25.
3.50
172.
25.
4.50.
..
.et
c.,(
sav
eandexi
tthi
sfi
l
e)
#nmap -
iL coss (
toscanal
ltheI
Paddr
essesbyr
eadi
ngt
hecoss
f
il
e)(
wher
e-i-
--
->i
nput
,-L-
--
->l
i
st)
#nmap -
-i
fl
ist (
toseeal
lther
out
ingt
abl
einf
ormat
ioni
nthenet
wor
k)
#nmap 172.
25.
0.10-20 -
-excl
ude 172.
25.
0.15 (
toscanal
lthesy
stemsf
rom
172.
25.
0.10t
o172.
25.
0.20
sy
stemsandex
cludi
ng172.
25.
0.15sy
stem)
#nmcl
iconnect
ionshow -
-act
ive (
tocont
rol
thenet
wor
kconnect
ions)
#i
pli
nk (
tocheckt
henet
wor
kconnect
ion)
#pi
ng -
Iet
h1 <I
Paddr
ess> (
tocheckt
he2ndNI
Ccar
dconnect
ion)

Rat
nakar
Page63
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

5.Managi
ngSELi
nux

1. Whati
sSELi
nux?
I
tisaonet
ypeofsecur
it
ythatenhancest
hesecur
it
ythatal
l
owsuser
sand
admi
nist
rat
orsmor
econt
rol
overwhi
chuser
sandappl
i
cat
ionscanaccesswhi
ch
r
esour
ces,
suchasf
il
es,
Standar
dLi
nuxaccesscont
rol
set
c.,
I
tismai
nlyusedt
opr
otecti
nter
nal
dat
a(notf
rom ext
ernal
dat
a)f
rom sy
stem ser
vices.
I
nreal
timeSELi
nuxi
sdi
sabl
edandi
nst
eadoft
hisI
Ptabl
esar
eused.I
tpr
otect
sal
lthe
ser
vices,
fil
esanddi
rect
ori
esbydef
aul
tifSELi
nuxi
senabl
ed.
2. I
nhowmanyway
swecani
mpl
ementt
heSELi
nux?Expl
aint
hem.
Wecani
mpl
ementt
heSELi
nuxmai
nlyi
n2modes.
(
i)Enabl
ed
(
ii
)Di
sabl
ed(
def
aul
tmode)
Enabl
ed:

Rat
nakar
Page64
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Enabl
edmeansenabl
i
ngt
heSELi
nuxpol
i
cyandt
hismodeofSELi
nuxi
sdi
vi
dedi
ntot
wo
par
ts.
(
a)Enf
orci
ng
(
b)Per
missi
ve
Di
sabl
ed:
Di
sabl
edmeansdi
sabl
i
ngt
heSELi
nuxpol
i
cy.
3. Whati
sEnf
orci
ngmodei
nSELi
nux?
Enf
orci
ngmeansSELi
nuxi
son.I
tchecksSELi
nuxpol
i
cyandst
oredal
og.Nocan
accesst
heser
vicesbydef
aul
tbutwecanchanget
hepol
i
cywhenev
erweneeded.
4. Whati
sPer
missi
vemodei
nSELi
nux?
SELi
nuxi
sonandi
tdon'
tcheckSELi
nuxpol
i
cyandst
oredt
hel
og.Ev
ery
bodycan
accesst
heser
vicesbydef
aul
tandwecanal
sochanget
heSELi
nuxpol
i
cy.I
tisal
so
cal
l
edasdebuggi
ngmodeort
roubl
eshoot
ingmode.I
nthi
smodeSELi
nuxpol
i
ciesand
r
ulesar
eappl
i
edt
osubj
ect
sandobj
ect
sbutact
ionsar
enotaf
fect
ed.
5. Whati
sDi
sabl
edmodei
nSELi
nux?
SELi
nuxi
stur
nedof
fandnowar
ningandl
ogmessageswi
l
lbegener
atedandst
ored.
6. Whatar
eBool
eans?
Bool
eansar
evar
iabl
est
hatcanei
therbesetast
rueorf
alse.Bool
eansenhancet
he
ef
fectofSELi
nuxpol
i
ciesi
mpl
ement
edbyt
heSy
stem Admi
nist
rat
ors.Apol
i
cymay
pr
otect
scer
tai
ndeamonsorser
vicesbyappl
yi
ngv
ari
ousaccesscont
rol
rul
es.
7. Whati
sSELi
nuxpol
icy
?
TheSELi
nuxpol
i
cyi
sthesetofr
ulest
hatgui
det
heSELi
nuxsecur
it
yengi
ne.I
tdef
ines
t
ypesf
orf
il
eobj
ect
sanddomai
nsf
orpr
ocess.I
tusesr
olest
oli
mitt
hedomai
nst
hat
canbeent
eredandt
heuseri
dent
it
iest
ospeci
fyt
her
olet
hatcanbeat
tai
ned.
8. Whatar
ether
equi
redf
il
esf
orSELi
nux?
#v
im/
etc/
sel
i
nux
/conf
ig -
--
--
> I
tismai
nfi
l
eforSELi
nux
.
#v
im /
etc/
sysconf
ig/
sel
i
nux -
--
--
> I
tisal
i
nkf
il
etot
heabov
efi
l
e.
#v
im/
var
/l
og/
audi
t/
audi
t.
log -
--
--
> SELi
nuxl
ogmessageswi
l
lbest
oredi
nthi
sfi
l
e.
9. whati
sthecommandt
oseet
heSELi
nuxmode?
#get
enf
orce (
tocheckt
heSELi
nuxmode)
10.Whati
scommandt
osett
heSELi
nuxmodet
empor
ari
ly
?
#set
enf
orce 0 or1 (
tosett
heSELi
nuxmode.Wher
e'0'-
--
--
> per
missi
veand'
1'-
--
--
>Enf
orci
ng)
Not
e:(
i)Tochanget
heSELi
nuxmodef
rom Per
missi
vet
oEnf
orci
ng orEnf
orci
ngt
o
Per
missi
vemodest
he sy
stem r
est
arti
snotr
equi
red.
(
ii
)TochangeEnf
orci
ngmodet
oDi
sabl
edmode orDi
sabl
edmodet
o
Enf
orci
ngmodet
hesy
stem r
est
arti
srequi
red.
(
ii
i)Theabov
ecommandsar
echangedt
heSELi
nuxmodet
empor
ari
l
yonl
y.To
maket
hesel
i
nuxchanges per
manent
lyt
henopen /
etc/
sel
i
nux/
conf
ig
andgot
o,

Rat
nakar
Page65
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

SELI
NUX=Enf
orci
ng or Per
missi
ve or Di
sabl
ed
(
sav
eandex
itt
hisf
il
e)
11.Whati
scommandt
oseet
heSELi
nuxpol
icydet
ail
s?
#sest
atus (
toseet
heSELi
nuxpol
i
cydet
ail
s)
Ot
herusef
ulcommands:
#l
s-Z <f
il
ename> (
toseet
heSELi
nuxcont
extoft
hef
il
e)
#l
s -
ldZ<di
rect
oryname> (
toseet
heSELi
nuxcont
extoft
hedi
rect
ory
)
#ps -
efZ|
grep<pr
ocessname> (
toseet
heSELi
nuxcont
extoft
hepr
ocess
r
unni
ngont
hesy
stem)
#ps -
efZ|
grep ht
tp (
toseet
heSELi
nuxcont
extoft
heht
tppr
ocessr
unni
ng
ont
hesy
stem)
#chcon -
t<ar
gument
><f
il
e/di
rect
oryname> (
tochangeSELi
nuxcont
extoft
he
f
il
eordi
rect
ory
)
#chcon -
tpubl
i
c_cont
ent
_t /
publ
i
c (
tochanget
heSELi
nuxcont
extoft
he
/
publ
icdi
rect
ory
)
#chcon -
R publ
i
c_cont
ent
_t /
publ
i
c (
tochanget
heSELi
nuxcont
extoft
he
/
publ
icdi
rect
oryand
i
tscont
ent
s)
#r
est
orecon -
v <f
il
e/di
rect
oryname> (
tor
est
oret
hepr
evi
ousSELi
nuxcont
ext
oft
hef
il
e/di
rect
ory
)
#r
est
orecon -
v/publ
i
c (
tor
est
oret
hepr
evi
ousSELi
nux
cont
extoft
hatdi
rect
ory
)
#r
est
orecon -
Rv <di
rect
ory
> (
tor
est
oret
hepr
evi
ousSELi
nuxcont
ext
oft
hedi
rect
oryand
i
tscont
ent
s)
#r
est
orecon -
Rv /
publ
i
c (
tor
est
oret
hepr
evi
ousSELi
nux
cont
extoft
he/
publ
i
c
di
rect
oryandi
tscont
ent
s)
#get
sebool -
a|gr
ep <ser
vicename> (
toseet
hebool
eansoft
he
speci
fi
edser
vice)
#get
sebool -
a|gr
ep f
tp (
toseet
hebool
eansoft
hef
tpser
vice)
#set
sebool <bool
ean><opt
ionon/
off
> (
tochanget
hebool
eanofaspeci
fi
ed
ser
vice)
#set
sebool al
l
ow_
ftpd_
anon_
wri
te on (
tochanget
hebool
eanoft
he
f
tpdser
vicet
empor
ari
l
y)
#set
sebool -
P <ser
vicename>= <0/
1> (
tochanget
hebool
eanf
ort
heser
viceon
orof
fper
manent
ly)
#set
sebool -
P samba_
expor
t_al
l
_rw=1 (
tochanget
hebool
eanf
orsamba
ser
viceper
manent
lyon)

Rat
nakar
Page66
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

6.Boot
ingPr
ocedur
eandKer
nelpar
amet
ers

1. Expl
aint
heboot
ingpr
ocedur
e?
I
nLi
nuxsy
stemst
heboot
ingi
sdonei
n6st
ages.
 BI
OS
 MBR
 GRUB
 Ker
nel
 I
nit
 Runl
evel
BI
OS:
BI
OSst
andsf
orBasi
cInputandOut
putSy
stem.Whenev
erwepoweront
hesy
stem ,
the
sy
stem r
unssel
f di
agnost
icchecksanddet
ect
sal
ltheconnect
edi
nputandout
per
ipher
als.Thi
spr
ocessi
scal
l
edPOST(
PowerOn Sel
fTest
).I
fanyer
ror
sfoundi
t
di
spl
aysont
hescr
een.ThenBI
OSl
ocat
est
heboot
ingdi
ski
nthesy
stem and l
ocat
es
andl
oadst
hePr
imar
ybootl
oadernot
hingbutMBR(
Mast
erBootRecor
d)i
ntot
hememor
y.
So,
in si
mpl
eter
mst
heBI
OSl
oadst
heMBRi
ntomemor
yandexecut
est
heMBR.
MBR:
MBRst
andsf
orMast
erBootRecor
d.I
tisl
ocat
edi
nthe1stsect
oroft
heboot
abl
edi
sk
(
itmaybe/
dev
/hda or/
dev
/sda)
.Thesi
zeoft
heMBRi
s512by
tesandi
tcont
ainst
hree
component
s.
(
i)Pr
imar
ybootl
oaderi
nfor
mat
ionandi
tssi
zei
s446by
tes.
(
ii
)Par
ti
ti
ont
abl
einf
ormat
ionandi
tssi
zei
s64by
tes.
(
ii
i) MBRv
ali
dat
ioncheckandi
tssi
zei
s2by
tes.I
tsmai
npur
posei
swhet
hert
he
MBRi
sval
i
dornot
.
Thepr
imar
ybootl
oadercont
ainst
hesecondar
ybootl
oadernot
hingbutGRUB orLI
LO

Rat
nakar
Page67
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
inol
dsy
stems)
.
Thenpr
imar
ybootl
oaderl
ocat
esandl
oadst
hesecondar
ybootl
oaderi
ntomemor
y.
So,
insi
mpl
eter
mst
heMBRl
oadsandexecut
est
heGRUBbootl
oader
.
GRUB orLI
LO:
GRUBst
andsf
orGr
andUni
fi
edBootl
oader
.LI
LOst
andsf
orLi
nuxLoaderandi
susedi
n
ol
dLi
nuxsy
stems.I
fwe hav
emul
ti
pleker
nel
imagesi
nst
all
edi
noursy
stem,
wecan
choosewhi
chonet
obeexecut
ed.GRUBdi
spl
aysaspl
ashscr
een,
wai
tsf
orf
ewseconds.I
f
wedonotent
erany
thi
ng,
itl
oadst
hedef
aul
tker
nel
imageasspeci
fi
ed i
nthegr
ub
conf
igur
ati
onf
il
e.GRUBhast
heknowl
edgeoft
hef
il
esy
stem (
theol
dLI
LOdi
dn'
tunder
stand
t
hesy
stem)
.GRUBconf
igur
ati
onf
il
eis/
boot
/gr
ub/
grub.
conf(
/et
c/gr
ub.
confi
sal
i
nkt
o
t
his)
.Thi
sfi
l
econt
ains ker
nelandi
nit
rdi
mages.So,
insi
mpl
eter
msGRUBj
ustl
oads
andexecut
esker
nel
andi
nit
rdi
mages.
Ker
nel
:
Ker
nel
ini
ti
ali
sesi
tsel
fandl
oadst
heker
nel
modul
esandmount
sther
ootf
il
esy
stem as
speci
fi
edi
nthe"
root
=" i
ngr
ub.
confandt
henker
nel
execut
est
he/
sbi
n/i
nitpr
ogr
am.
Si
ncei
nitwast
he1stpr
ogr
am t
obeexecut
edby Li
nuxker
nel
,i
thast
hepr
ocessI
D(PI
D)
of1.Wecanseet
hisi
dby #ps -
ef|gr
epi
nit command.i
nit
rd st
andsf
ori
nit
ial
RAM Di
sk.i
nit
rdi
susedbyker
nel
ast
empor
aryf
il
esy
stem unt
ilker
nel
isboot
edandt
he
r
ealr
oott
hef
il
esy
stem i
smount
ed.I
tal
socont
ainsnecessar
ydr
iver
scompi
l
edi
nsi
de
whi
chhel
psi
ttoaccesst
he har
ddr
ivepar
ti
ti
onsandot
herhar
dwar
e.
i
nitl
evel:
I
nthi
sini
tpr
ogr
am r
eadst
he/
etc/
ini
tt
ab f
il
eandputt
hesy
stem i
ntospeci
fi
edr
un
l
evel
.i
niti
dent
if
iest
he def
aul
trunl
evel
from /
etc/
ini
tt
ab f
il
eandwecanchanget
he
t
hisdef
aul
trunl
evel
whenev
erweneeded.We canf
indt
hedef
aul
trunl
evelby #gr
ep
"
ini
tdef
aul
t"/
etc/
ini
tt
ab commandonoursy
stem.Nor
mal
l
ythe
def
aul
trunl
eveli
nLi
nuxi
s3i
nCLI(
CommandLi
neI
nter
face)modeand 5i
nGUI
(
Graphi
calUserI
nter
face) mode.
RunLev
elPr
ogr
ams:
Thef
oll
owi
ngr
unl
evel
sar
eav
ail
abl
einLi
nuxsy
stems.
 0 -
--
--
> hal
torshut
downt
hesy
stem
 1 -
--
--
> Si
ngl
eusermode
 2 -
--
--
> Mul
tiuserwi
thoutNFS
 3 -
--
--
> Ful
lmul
tiusermodebutnoGUIandonl
yCLImode
 4 -
--
--
> Unused
 5 -
--
--
> Ful
lmul
tiusermodewi
thGUI(
X11sy
stem)
 6 -
--
--
> r
eboott
hesy
stem
Whenev
erwest
artt
heLi
nuxsy
stem i
sboot
ingwecanseev
ari
ousser
vicesget
ti
ng
st
art
ed.Thoseser
vicesar
e l
ocat
edi
ndi
ff
erentr
unl
evel
spr
ogr
amsexecut
edf
rom t
her
un
l
evel
dir
ect
oryasdef
inedbyourdef
aul
trun l
evel
.Dependi
ngonourdef
aul
tini
tlev
elset
ti
ng,

Rat
nakar
Page68
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
hesy
stem wi
l
lexecut
ethepr
ogr
amsf
rom oneoft
he f
oll
owi
ngdi
rect
ori
es.
 Runl
evel0 -
--
--
> /
etc/
rc.
d/r
c0.
d
 Runl
evel1 -
--
--
> /
etc/
rc.
d/r
c1.
d
 Runl
evel2 -
--
--
> /
etc/
rc.
d/r
c2.
d
 Runl
evel3 -
--
--
> /
etc/
rc.
d/r
c3.
d
 Runl
evel4 -
--
--
> /
etc/
rc.
d/r
c4.
d
 Runl
evel5 -
--
--
> /
etc/
rc.
d/r
c5.
d
 Runl
evel6 -
--
--
> /
etc/
rc.
d/r
c6.
d
Theabov
edi
rect
ori
esar
eal
sohav
ingsy
mbol
i
cli
nksav
ail
abl
efort
hosedi
rect
ori
es
under/
etc/
rc0.
d, /
etc/
rc1.
d,.
..
.et
c.,So,
the /
etc/
rc0.
disl
i
nkedt
o/et
c/r
c.d/
rc0.
d
Boot
ingpr
ocedur
einRHEL-7:
Upt
oker
nel
theboot
ingpr
ocessi
ssameast
heabov
e./
boot
/gr
ub2/
grub.
conf i
sthe
GRUBconf
igur
ati
onf
il
ein RHEL-7.sy
stemdi
sthei
nit
ial
processi
nRHEL-7andi
ts
pr
ocessI
Dis1.
l
inux16r
eadt
her
oot(/)f
il
esy
stem andt
heni
nit
rd16pr
ocesswi
l
lmountt
her
oot(/)
f
il
esy
stem i
nread& wr
it
emodeandst
art
sthesy
stemdpr
ocess.Andt
hesy
stemdpr
ocess
wi
l
lreadt
he/
etc/
fst
abf
il
eand mountal
lthef
il
esy
stems.Theni
treadst
hef
il
e
/
etc/
syst
emd/
syst
em/
def
aul
t.
tar
getf
il
eandbr
ingst
he sy
stem i
ntot
hedef
aul
trunl
evel
accor
dingt
othescr
ipt
sthepr
ocesseswi
l
lst
artorst
op.
2. Howt
ocheckt
hecur
rentr
unl
eveloft
hesy
stem?
#who -
r (
toseet
hepr
esentr
unl
evel
oft
hesy
stem)
3. Howt
ochanget
hedef
aul
trunl
evel
?
Fi
rstopent
he /
etc/
ini
tt
ab f
il
eby#v
im/
etc/
ini
tt
ab commandandgot
olastl
i
ne
changet
her
unl
evel numberaswer
equi
redandt
henr
eboott
hesy
stem by#i
nit6
command.Af
terr
eboot
ingt
hesy
stem check t
hecur
rentr
unl
evelby #who -
r
command.
4. Howt
ost
artt
hegr
aphi
cali
nter
facei
fthesy
stem i
sinr
unl
evel3now?
#st
art
x (
itchangest
her
unl
evel3t
o5andr
eboot
sthesy
stem)
5. Howt
otr
oubl
eshooti
fthebootdi
ski
snotav
ail
abl
e?
(
i)Fi
rstcheckt
hehar
ddi
ski
spr
esenti
nthesy
stem ornot
.Ifnotpr
esentconnectt
he
har
ddi
skandr
est
artt
he sy
stem.
(
ii
)Ift
hehar
ddi
ski
spr
esent
,thengot
oBI
OSandf
indt
hel
ocat
ionoft
hehar
ddi
sk.
(
ii
i)Checkt
hebootpr
ior
it
yint
heBI
OS.I
fbootpr
ior
it
yisnott
hehar
ddi
skt
henchangei
t
t
ohar
ddi
skand r
est
artt
hesy
stem.
(
iv) Ev
ent
hought
hesy
stem i
snotst
art
edt
henboott
hesy
stem wi
thCDROM i
n
si
ngl
eusermodeandopent
he /
boot
/gr
ub/
grub.
conff
il
eandseet
hehar
ddi
sk
nameandpar
ti
ti
onnumber
.Nor
mal
l
yitshoul
dbe /
dev
/hda1(
ift
hehar
d
di
ski
sIDEhar
ddi
sk)or/
dev
/sda1(
ift
hehar
ddi
ski
sSATA orSCSI
).I
fthehar
d
di
sknameandpar
ti
ti
onnumberi
sdi
ff
erenti
nst
eadoft
heor
igi
nal
thenchanget
hem and

Rat
nakar
Page69
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
eboott
hesy
stem wi
thhar
ddi
sk.
(
v)I
ftheGRUB i
scor
rupt
edt
henr
eboott
hesy
stem wi
thCDROM i
nsi
ngl
eusermode
andr
est
oret
hegr
ub i
nfor
mat
ionf
rom t
her
ecentbackupandt
henr
est
art
t
hesy
stem wi
thhar
ddi
sk.
6. Howt
oreboott
hepr
oduct
ionser
ver
?
(
i)I
ngener
alt
hepr
oduct
ionser
ver
swi
l
lnotber
eboot
edf
requent
lybecauset
heend
user
swi
l
lsuf
feri
fthe pr
oduct
ionsser
verar
eindownst
ate.I
fanychanges
madet
othesy
stem l
i
kegr
ub,
sel
i
nuxpol
i
cy,
def
aul
trun l
evel
ischangedandi
f
ker
nel
pat
chesar
eappl
i
edt
hesy
stem r
ebooti
srequi
red.
(
ii
)Ifanyi
nconsi
stencyi
sroot(/)f
il
esy
stem,
thent
aket
hebusi
nessappr
oval
from
hi
gheraut
hor
it
ies,
makea pl
anf
orpr
operschedul
eandal
soi
nfor
mtot
hedi
ff
erent
t
eamsl
i
keappl
i
cat
iont
eam t
ost
opt
heappl
i
cat
ion, dat
abaset
eam t
ost
opt
he
dat
abases,
QC t
eam t
ost
opt
het
est
ing,
moni
tor
ingpeopl
etoi
gnor
etheal
ert
s
f
rom t
hisser
verandot
hert
eamsi
fanyandt
henr
eboott
hesy
stem wi
thCDROM i
nsi
ngl
e
usermodeand t
henr
un#f
sckcommandont
hatf
il
esy
stem.
(
ii
i) I
fO/
Sdi
ski
scor
rupt
edordamagedt
hen,
reboott
hesy
stem t
empor
ari
l
y
wi
tht
hemi
rr
ordi
skt
henf
ixt
hat pr
obl
em andagai
nboott
hesy
stem wi
thor
igi
nal
di
sk.
7. Whati
sthedi
ff
erencebet
ween#r
ebootand#i
nit6 commands?
Bot
hcommandsar
eusedt
orest
artorr
eboott
hesy
stem.
#r
ebootcommandwi
l
lnotsendt
heki
l
lsi
gnal
stot
hesy
stem andi
twi
l
lki
l
lal
lthe
r
unni
ngpr
ocessesand ser
vicesf
orcef
ull
yandt
henr
est
artt
hesy
stem.
#i
nit6 commandwi
l
lsendt
heki
l
lsi
gnal
stot
hesy
stem andi
twi
l
lst
opal
lthe
pr
ocessesandser
vicesoneby oneandt
henr
est
artt
hesy
stem.
8. Whati
sconsol
epor
tandhowt
oconnectt
otheconsol
epor
t?
Consol
epor
tisusedt
oconnectt
hesy
stem ev
ent
hought
hesy
stem i
snotboot
edwi
th
t
hemai
nO/
S.Thi
spor
t i
susedt
oconnectt
hesy
stem f
ort
roubl
eshoot
ingpur
pose
onl
y.Wecanconnectt
heconsol
epor
tassameasconnectt
osy
stemsLANpor
tandi
tis
al
sohav
ingI
Paddr
ess,
usernameandpasswor
dtoconnectt
otheconsol
e.
Ther
ear
edi
ff
erentt
ypesofconsol
epor
tsf
ordi
ff
erentt
ypesofser
ver
s.Theyar
egi
ven
bel
ow.
Ser
verName Nameoft
heConsol
epor
t Expansi
onname
DRAC -
--
>DELLRemot
eAccess
Cont
rol
l
ers
i
-DRAC -
--
>Int
egr
atedDELLRemot
e
DELL DRAC ori
-DRAC
Access

Cont
rol
l
ers
I
BM Powerser
ies HMC Har
dwar
eManagementConsol
e

Rat
nakar
Page70
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

HP I
LO I
ntegr
atedLi
ghtOut

9. Sy
stem i
scont
inuousl
yreboot
ing.Howt
otr
oubl
eshooti
t?
(
i)Connectt
hesy
stem t
hroughconsol
epor
tthr
oughput
tybypr
ovi
dingI
Paddr
ess,
usernameandpasswor
d. (
ii
) Atconsol
epr
omptandbootwi
thCDROM i
nsi
ngl
euser
modeandmountt
her
oot(/-
--
>O/
S)f
il
esy
stem ont
empor
arymountpoi
nt.
(
ii
i) Checkanywr
ongent
ri
esi
nthecr
onj
obsi
e.,
cront
abedi
torseeanyr
eboot
scr
ipt
sar
ether
eornot
.Iff
ound r
emov
ethoseent
ri
esandr
eboott
hesy
stem.
(
iv) I
ftheabov
eisnotr
esol
ved,
thencheckt
hememor
y(RAM)
.
(
v)I
fRAM modul
eisnotwor
kingt
hesy
stem getpani
candi
tmaycont
inuousl
yreboot
s.
(
vi) I
ftheRAM modul
eiswor
kingt
hencheckt
heRAM si
zewhet
hert
hesuf
fi
cient
RAM t
hatr
equi
rest
orunt
he appl
i
cat
ioni
sav
ail
abl
eornot
.Ifnott
her
ethen
i
ncr
easi
ngt
heRAM si
zemayber
esol
vet
hisi
ssue.
(
vii
)Check "
/var
/log/
messages"f
il
eforanymessagesr
egar
dingcont
inuous
r
eboot
ing.
(
vii
i
)Ev
ent
hought
her
eisasuf
fi
cientRAM maybeswapspacei
snotsuf
fi
cientt
orun
al
ltheser
vicesand appl
i
cat
ionst
hensy
stem getpani
candmay
cont
inuousl
yreboot
s.I
fso,
theni
ncr
easi
ngt
heswapsi
zemay r
esol
vet
hisi
ssue.
10.Whati
sTCPhandshaki
ng?
Thepr
ocedur
ethatt
akespl
acebet
weent
woTCP/
IPnodest
oest
abl
i
shaconnect
ion.
Knownast
heSy
nchr
oni
zat
ion,
Synchr
oni
ze-
Acknowl
edgementandAcknowl
edgement
handshake.
Forexampl
eifcomput
erAt
ransmi
tsaSy
nchr
oni
zepackett
ocomput
erB,
whi
chsends
backaSy
nchr
oni
ze- Acknowl
edgepackett
ocomput
eA.Comput
erAt
hent
ransmi
tsan
Acknowl
edgepackett
ocomput
erB andt
he connect
ioni
sest
abl
i
shed.Thi
swhol
e
abov
esai
dpr
ocessi
scal
l
edt
heTCPhandshaki
ng.
11.Howmanyl
inkswi
l
lbecr
eat
edwhenwecr
eat
ethedi
rect
ory
?
Whenev
erwecr
eat
eanydi
rect
oryt
her
ear
etwol
i
nkswi
l
lbecr
eat
ed.
12.Whatar
ethedi
ff
erencesbet
weenr
unl
evel2 andr
unl
evel
3?
RunLev
el2:
(
i)I
tsuppor
tsmul
ti
useroper
ati
ons.
(
ii
)Mul
ti
pleuser
scanaccesst
hesy
stem.
(
ii
i) Al
lthesy
stem deamonswi
l
lrunexceptNFSandsomeot
hernet
wor
kser
vice
r
elat
eddeamons.
(
iv) So,
wit
houtNFSwecanuseal
lot
herser
vices.
RunLev
el3:
(
i)I
tisal
sosuppor
tsMul
tiuseroper
ati
ons.
(
ii
)Mul
ti
pleuser
scanaccesst
hesy
stem.
(
ii
i) Al
lthesy
stem deamonsi
ncl
udi
ng NFSandot
hernet
wor
krel
atedser
vice
deamonswi
l
lrun.

Rat
nakar
Page71
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
iv)So,
wecanav
ail
all
theser
vicesi
ncl
udi
ngNFSal
so.
13.Ser
verr
unni
ngi
nsi
ngl
eusermode,
cany
oul
ogi
nremot
elyandhow?
Wecanl
ogi
ntot
hesy
stem r
emot
elyi
nsi
ngl
eusermodeal
sobuti
tispossi
blet
o
connectt
oconsol
einst
eadof LANpor
tthr
oughput
tyt
ool
bygi
vi
ngI
Paddr
ess,
user
nameandpasswor
d.Thenconsol
epor
tappear
sandboott
hesy
stem wi
thCDROM i
nsi
ngl
e
usermode.
14.Howt
ocheckt
hepr
esentker
nelv
ersi
on?
#uname -
r (
itdi
spl
ayst
hepr
esentker
nel
ver
sion)
#uname -
a (
itdi
spl
ayst
hepr
esentker
nel
ver
sionwi
thot
herdet
ail
s)
#cat/
boot
/gr
ub/
grub.
conf (
int
hisf
il
eal
sowecanf
indt
heker
nel
ver
sion)
15.Whati
sthecommandt
oseet
hesy
stem ar
chi
tect
ure?
#ar
ch or #uname -
m(bot
hcommandsgi
vest
hear
chi
tect
ureoft
hesy
stem)
16.Howt
ocheckt
hev
ersi
onoft
heO/
S?
#cat/
etc/
redhat
-r
elease (
giv
est
hev
ersi
onoft
heO/
S)
17.Howt
orepai
rthecor
rupt
edbootl
oaderandr
ecov
eri
t?
Thi
spr
obl
emsmaybeoccuri
ftheGRUBi
scor
rupt
ed.So,
wehav
etor
ecov
ert
heGRUB.
Basi
cal
l
yther
epai
ri
ng ofGRUBmeansi
nst
all
i
ngt
henewgr
ubont
heexi
sti
ngone
f
rom RHEL-6DVD.Thest
epsar
egi
venbel
ow.
(
i)I
nser
ttheRHEL-6DVDandmakesur
ethatsy
stem shoul
dbootf
rom CD/
DVD.
(
ii
)Boott
hesy
stem i
nRescueI
nst
all
edSy
stem mode.
(
ii
i) Sel
ectt
hel
anguagewi
thwhi
chwewantt
ocont
inueandcl
i
ckonOK.
(
iv) Sel
ectt
heKey
boar
dty
peasUSandcl
i
ckOK.
(
v)Sel
ectLocal
CD/
DVD andcl
i
ckOK.
(
vi) Mov
ethecur
sort
oNOt
oignor
etheNet
wor
king.
(
vii
)Mov
ethecur
sort
oCont
inuet
abt
omountt
her
oot(/)f
rom CD/
DVD andpr
ess
Ent
erkey
.
(
vii
i
)Nowt
her
oot(/)f
il
esy
stem i
smount
edon/
mnt
/sy
simage,
her
ecl
i
ckonOKand
Pr
essEnt
ert
ocont
inue.
(
ix) Sel
ectt
he"
shel
lSt
artshel
l
"opt
ionandcl
i
ckonOK,
thenshel
lwi
l
lbe
di
spl
ayedonscr
een.
(
xi) Atshel
lpr
omptt
ypeas#chr
oot/
mnt
/sy
simage command,pr
essEnt
er.
(
xii
)Checkt
he/
bootpar
ti
ti
onby #f
disk -
l command.
(
xii
i
)Inst
all
thenewgr
ubont
hebootdev
icei
e.,
maybe/
dev
/sda2 by#gr
ub-
inst
all
<dev
icename> command
(
Forexampl
e#gr
ub-
inst
all/
dev
/sda2)
.
(
xiv
)Ifi
tshownoer
rorr
epor
tedt
hatmeanswehav
esuccessf
ull
yrecov
eredt
hegr
ub.
(
xv)Thent
ype #exi
tcommandandagai
nty
pe#exi
tor#r
ebootcommandt
o
r
eboott
hesy
stem.
18.Whatar
eModul
esorKer
nelModul
es?Howt
ofi
ndt
heKer
nelModul
es?
Thedr
iver
sisLi
nuxsy
stem ar
eknownasModul
esorKer
nel
Modul
es.Thesemodul
es

Rat
nakar
Page72
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

ar
eassi
gnedbyker
nel dependi
ngont
hehar
dwar
e.Har
dwar
ecanonl
ybe
communi
cat
edandcanwor
kef
fi
cient
lywhent
hepr
oper modul
eisl
oadedi
ntheker
nel
.
wecanf
indt
heker
nel
modul
esby#l
s/et
c/l
ib/
modul
es command.
Al
ltheker
nel
modul
esi
nthesy
stem wi
l
lbeendedwi
th".
ko"ext
ensi
on.So,
wecan
seeal
lthemodul
esi
nthe sy
stem by #f
ind / -
name *
.ko command.
19.Whatot
hercommandsr
elat
edt
oker
nelmodul
es?
#l
smod (
tol
i
stal
lthecur
rent
lyl
oadedmodul
es)
#l
smod|
grep -
i<modul
ename> (
tocheckwhet
hert
hepar
ti
cul
armodul
e
i
sloadedornot
)
#l
smod|
grep -
ifat (
tocheckt
hef
atmodul
eisl
oadedornot
)
Ther
emi
ghtbeasi
tuat
ionwher
eourmodul
eisnotwor
kingpr
oper
ly,
int
hatcasewe
hav
etor
emov
ethat modul
eandr
e-i
nst
all
itagai
nby
,
#modpr
obe -
r <modul
ename> (
tor
emov
ethespeci
fi
edmodul
e)
#modpr
obe -
rfat (
tor
emov
ethef
atmodul
e)
#modpr
obe <modul
ename> (
toi
nst
allorr
e-i
nst
all
themodul
e)
#modpr
obe f
at (
toi
nst
allorr
e-i
nst
all
the
modul
e)
#modi
nfo<modul
ename> (
toseet
hespeci
fi
edmodul
einf
ormat
ion)
#uname (
toseet
hewhi
chO/
Sispr
esenti
nthe
sy
stem)
#uname -
s (
toseewhi
chO/
Sker
nel
ist
hisei
ther
Li
nuxorUni
x)
#r
pm -
qa ker
nel -
-l
ast (
toseet
heker
nel
inst
all
ati
ondat
eand
t
ime)
#r
pm -
qa ker
nel
* (
toseehowmanyker
nel
sar
ether
ein
t
hesy
stem)
#l
s/pr
oc (
toseet
heker
nel
processes
i
nfor
mat
ion)
#l
s/boot (
toseet
hepr
esentker
nel
ver
sion
cr
eat
edt
ime) #l
s/et
c/l
i
b/modul
es (
inst
all
edker
nel
modul
edr
iver
s)
#l
s/usr
/sr
c (
ker
nel
sour
cecodel
ocat
ion)
#kudzu (
toscant
henewhar
dwar
einRHEL-4)
#depmod (
toscant
henewhar
dwar
efr
om RHEL-
5,
6and7)
#r
mmod<modul
ename> (
tor
emov
ethespeci
fi
edmodul
e)
#i
nsmod<modul
ename> (
toi
nst
all
theker
nel
modul
ewi
thout
dependencymodul
es)
20.Howt
oseet
her
unl
evel
?
#who -
r (
toseet
hecur
rentr
unl
evel
)

Rat
nakar
Page73
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

21.Howt
obl
ockt
heUSB/CDROM dr
iver
?
#l
smod|
grep -
iusb (
toseet
heUSBmodul
eisl
oadedornot
)
#mount (
tocheckt
heUSBi
smount
edornot
)
#modpr
obe -
r usb_
stor
age (
remov
etheUSBmodul
e,i
fiti
smount
ed
i
twi
l
lnotr
emov
e)
#umount /
<mountpoi
nt> (
tounmountt
heUSBi
fiti
smount
ed)
#v
im /
etc/
modpr
obe.
d/bl
ockl
i
st.
conf (
itwi
l
lopent
hebl
ockl
i
st.
conff
il
e,t
hen
putanent
ryofUSB)

bl
ockl
i
st usb_
stor
age (
aft
ert
ypet
hissav
eandexi
tthi
s
f
il
e)
22.Whati
s"wai
t"andwher
eiti
sst
ored?
(
i)I
fther
eisnotenoughmemor
ytor
unt
hepr
ocess,
theni
twi
l
lwai
tforf
reespacei
n
memor
y.Thatpr
ocessi
s cal
l
edwai
t.
(
ii
)wai
tisst
oredi
nbuf
ferl
i
kecachememor
y.
23.Whati
srunl
evel
?
(
i)Runl
eveli
snot
hingbutt
oputt
hesy
stem i
ndi
ff
erentl
evel
stoper
for
m di
ff
erent
mai
ntenancemodes.
(
ii
)Ther
ear
e7r
unl
evel
s.Thosear
e0,1,2,3,4,5and 6.
(
ii
i)Theabov
elev
elsar
eusedt
oputt
hesy
stem i
ndi
ff
erentst
agest
oav
ail
dif
fer
ent
ser
vices.
24.Whati
sthedef
aul
trunl
evel
?
(
i)Whenweboott
heser
vert
hesy
stem aut
omat
ical
l
ygot
oonepar
ti
cul
arr
unl
evel
.That
r
unl
evel
iscal
l
edt
he def
aul
trunl
evel
.
(
ii
)InLi
nuxt
hedef
aul
trunl
evel
is5i
nGUIand 3i
nCLI
.
(
ii
i)Wecanmodi
fyt
hedef
aul
trunl
evel
byputanent
ryi
n/et
c/i
nit
tab f
il
e.
25.Whi
chr
unl
evelar
eyouusi
ng?
Runl
evel3.
26.Howt
ochanget
her
unl
evelt
empor
ari
ly
?
#i
nit <r
unl
evel
no.
> (
tochanget
her
unl
evel
tempor
ari
l
y)
Exampl
e:#i
nit0 ori
nit1 ori
nit2 ori
nit3 or i
nit4 or i
nit5 or i
nit6
27.CanImountont
wodi
sksal
ter
nat
ivel
ywhenboot
ing?
Noi
tisnotpossi
blet
omountont
wodi
sksal
ter
nat
ivel
ywhenboot
ingbecausewecan
speci
fyonl
yonedi
skas bootdi
skbutnott
wodi
sksasboot
ingdi
sksi
nBI
OSset
ti
ngs.
So,
iti
snotpossi
blet
omountont
wodi
sksal
ter
nat
ivel
ywhenboot
ing.

Rat
nakar
Page74
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

7.JobAut
omat
ion

1. Whati
sJobschedul
ing?
Thepr
ocessofcr
eat
ingt
hej
obsandmaket
hem occuront
hesy
stem r
epeat
edl
yhour
ly,
dai
l
y,weekl
y,mont
hly andy
ear
lyi
scal
l
edJobschedul
i
ng.I
nLi
nuxandot
herUni
x
sy
stemst
hispr
ocessi
shandl
edbyt
hecr
onser
vice ordeamoncal
l
edcr
ondandat
d
i
stheatj
obsdeamonwhi
chcanbeusedt
oschedul
ethet
asks(
alsocal
l
edas j
obs)
.
2. Whati
sthei
mpor
tanceoft
hej
obschedul
ing?
Thei
mpor
tanceoft
hej
obschedul
i
ngi
sthatt
hecr
it
ical
tasksl
i
kebackups,
whi
cht
he
cl
i
entusual
l
ywant
stobe t
akeni
nni
ght
s,caneasi
l
yper
for
medwi
thoutt
hei
nter
vent
ion
oft
headmi
nist
rat
orbyschedul
i
ngacr
onj
ob.I
f t
hecr
onj
obi
sschedul
edcar
eful
l
ythen
t
hebackupwi
l
lbet
akenatanygi
vent
imeoft
hecl
i
entandt
her
ewi
l
lbe noneedf
ort
he
admi
nist
rat
ort
oremai
nbackatni
ght
stot
aket
hebackup.
3. Whatar
ethedi
ff
erencesbet
weencr
onandatj
obs?
cr
onj
ob:
(
i)cr
onj
obsar
eschedul
i
ngj
obsaut
omat
ical
l
yatapar
ti
cul
art
ime,
dayoft
heweek,
weekoft
hemont
hand mont
hoft
hey
ear
.
(
ii
)Thej
obmaybeaf
il
eorf
il
esy
stem.
(
ii
i) Wecannotgett
hei
nfor
mat
ionasal
ogf
il
eift
hej
obwasf
ail
edt
oexecut
eie.
,
wheni
twasf
ail
edandwher
e i
swasf
ail
edandal
socannotexecut
eaut
omat
ical
l
ythe
f
ail
edj
obs.
atj
ob:
(
i)atj
obsar
eex
ecut
esonl
yonce.
(
ii
)Her
eal
sowecannotgett
hei
nfor
mat
ioni
fthej
obi
sfai
l
edandi
tisal
sodonot
execut
ethef
ail
edj
obs aut
omat
ical
l
y.
4. Whatar
ethei
mpor
tantf
il
esr
elat
edt
ocr
onandatj
obs?
 /
etc/
cront
ab -
--
--
>ist
hef
il
ewhi
chst
oresal
ltheschedul
edj
obs.
 /
etc/
cron.
deny -
--
--
>ist
hef
il
eusedt
orest
ri
ctt
heuser
sfr
om usi
ngcr
onj
obs.
 /
etc/
cron.
all
ow -
--
--
>isusedt
oal
l
owonl
yuser
swhosenamesar
ement
ionedi
n

Rat
nakar
Page75
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
hisf
il
etousecr
onj
obs
andt
hisf
il
edoesnotexi
stbydef
aul
t.
 /
etc/
at.
deny -
--
--
>sameascr
on.
denyf
orr
est
ri
cti
ngt
heuser
stouseatj
obs.
 /
etc/
at.
all
ow -
--
--
> sameascr
on.
all
owf
oral
l
owi
nguser
stouseatj
obs.

5. Whati
sthef
ormatoft
hecr
onj
ob?
#cr
ont
ab -
e (
toedi
tthecr
onj
obedi
tort
ocr
eat
eorr
emov
e
t
hecr
onj
obs)
<minut
es><hour
s><dayofthemont
h><monthoftheyear><dayoft
heweek><j
obor
scr
ipt>
(0-59) (0-23) ( 1-31)
(1-12orjan,
feb,.
..
)( 0-6orsun,mon,.
..
)

Opt
ions Expl
anat
ion
* I
st r
eatedasawi ldcar d.Meaninganypossibleval
ue.
I
st r
eatedasev er5mi nutes,hours,
daysormont hs.Repl
aci
nghe5wit
hany
*
/5
numericalval
uewi ll
changet hisopti
on.
2,
4,6 Treat
edasanOR, soifplacedinthehours,
thiscoul
dmeanat2,4or6o-cl
ock
Treat
sf oranyvaluebet ween9and17.Soi fpl
acedindayoft
hemont
ht hi
swoul
dbe
9-
17
days9t hr
ough17ori fputinhours,i
twouldbebetween9AM and 5PM.

6. Howt
ocheckt
heassi
gnedcr
onj
obsofcur
rent
lyl
ogi
nuser
?
#cr
ont
ab -
l-u <username> (
tocheckt
hespeci
fi
eduser
'sassi
gned
cr
onj
obs)
#cr
ont
ab -
l-u r
aju (
tocheckt
her
ajuuser
'sassi
gnedcr
on
j
obs)
#cr
ont
ab -
l (
tocheckt
her
ootuser
'sassi
gnedcr
on
j
obs)
7. Howt
oal
l
ow ordenycr
onj
obsf
orauser
?

Foral
low Fordeny
(
i)Open /
etc/
cron.
all
ow f
il
e. (
i) Open /
etc/
cron.
deny f
il
e.
(
ii
)Puttheent
ri
esoftheusernameswhom do (
ii
)Puttheent
ri
esoftheusernameswhom do
we we
wantt
oall
owthecronjobs. wantt
odenythecronjobs.

8. Whati
satj
obandat
qsour
ce?
(
i)atj
obsar
eex
ecut
esonl
yonce.
(
ii
)at
qmeanshowmanyatj
obsar
einqueueby#at
q command.
9. Howt
ocheckt
hej
obs?
#at -
l (
tocheckt
heatj
obs)
10.Howt
oaddcr
ont
abent
ryi
ncommandmode?
(
i)#def
ine edi
tor
=vi
m (
todef
inet
heedi
torasv
im)
(
ii
)#expor
t$edi
tor (
expor
tthedef
inededi
tor
)
(
ii
i) #cr
ont
ab -
e (
toedi
tthecr
ont
ab)

Rat
nakar
Page76
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

11.Howt
otr
oubl
eshooti
fthecr
onj
obf
ail
ed?
(
i)Seet
hecr
ont
abent
ri
esf
orsy
ntact
ical
err
ors.I
fther
ear
eanyer
ror
sthencor
rect
t
hem,
other
wisei
twi
l
lnot execut
e.
(
ii
)Checkwhet
hert
hecr
onddeamoni
swor
kingornot
.Ifi
tisr
unni
ng,
thenst
opt
he
deamonandagai
nst
art t
hedeamon.Ev
ent
hought
hepr
obl
em occur
s,t
hent
he
cr
ont
abent
ri
esmaybewr
ong.
(
ii
i) I
fal
ltheabov
ear
eok,
thenseewhet
hert
heuserwhoex
ecut
ingcr
onj
ob
hasper
missi
onst
oexecut
ethe cr
onj
obsornoti
e.,
checkt
heuserent
ri
esi
n
/
etc/
cron.
all
ow and /
etc/
cron.
deny f
il
es.
(
iv) I
fal
lar
eok,
agai
nputt
hej
obent
ryi
ncr
ont
abandexecut
eit
.
12.Howt
oschedul
ethecr
ont
askorj
ob?
(
i)Openoneshel
lscr
iptf
il
e.
(
ii
)Ent
eral
lthecommandswhi
char
erequi
redt
ocompl
etet
het
askorj
ob.
(
ii
i) I
fthej
obr
equi
resmor
eCPU andmor
ememor
y,t
henschedul
ethosej
obsat
ni
ghtt
imeornon-
peakhour
s (
gener
all
yni
ghtt
imei
sthenon-
peakt
ime)
.
(
iv)Thenopencr
ont
abedi
torby#cr
ont
ab -
e <username> commandandt
hen
putt
heent
ri
esasbel
ow,
<mi
nut
es><hour
s><dayoft
hemont
h><mont
hoft
hey
ear
><dayoft
heweek><scr
ipt
namewi
thpat
h>
(
v)Sav
eandexi
tfr
om t
hecr
ont
abedi
tor
.
13.Howt
oaddatj
obanddel
etet
heatj
ob?
Addi
ng:
(
i)#at <t
ime> (
toent
ert
heatj
ob)
(
ii
)Bef
oret
hatopenaf
il
evi
m andent
ert
hej
obcommandsi
nthatf
il
eandsav
eas
xxxx.
sh(
somenamewi
th ext
ensi
onmustbeas.
sh)
(
ii
i) Ent
ert
heabov
esav
edf
il
enamewi
thi
ntheatj
obedi
tor
.
(
iv) Pr
essCt
rl+dt
oex
itf
rom t
heedi
tor
.
(
v)Thensy
stem wi
l
lassi
gnaj
obi
dtot
hatj
ob.Wecanseet
hel
i
stofatj
obsby#
at
q command.
Del
ete:
(
i)Seet
hej
obi
dwhi
chj
obwewantt
odel
eteby#at
q commandandnot
ethatj
ob
i
d.
(
ii
)Thendel
etet
hatj
obby #at-
r <j
obi
d> command.
14.Howt
oknowcur
rent
lyschedul
edatj
obs?
#at
q (
toseet
hecur
rent
lyschedul
edatj
obs)
15.Howt
oal
l
ow ordenyatj
obsf
orauser
?

Foral
low Fordeny
(
i)Open /
etc/
at.
all
ow f
il
e. (
i) Open /
etc/
at.
deny f
il
e.

Rat
nakar
Page77
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
ii
)Puttheent
ri
esoft
heusernameswhom do (
ii
)Puttheent
ri
esoftheusernameswhom do
we we
wantt
oall
owtheatj
obs. wantt
odenytheatjobs.

16.Wher
eist
hel
ocat
ionoft
hecr
ont
abandatj
obs?
/
var
/spool
/cr
on -
--
--
> i
sthecr
ont
abf
il
elocat
ion.
/
var
/spool
/at-
--
--
>ist
heatj
obsf
il
elocat
ion.
17.Wher
eist
hel
ocat
ionoft
hecr
ont
abandatj
obsl
ogf
il
es?
/
var
/l
og/
cron -
--
--
>ist
hel
ogf
il
elocat
ionf
orbot
hcr
onandatj
obs.
Ot
herusef
ulcommands:
#ser
viceat
drest
art (
tor
est
artt
heat
ddeamoni
nRHEL-6)
#chkconf
igat
don (
toenabl
etheat
ddeamonatnex
tboot
i
nRHEL-6)
#ser
viceat
dst
atus (
toseet
hest
atusoft
heat
ddeamoni
n
RHEL-6)
#ser
viceat
dst
op (
tost
opt
heat
ddeamoni
nRHEL
-6)
#ser
viceat
dst
art (
tost
artt
heat
ddeamoni
nRHEL
-6)
#ser
vicecr
ondr
est
art (
tor
est
artt
hecr
onddeamoni
nRHEL-6)
#chkconf
igcr
ondon (
toenabl
ethecr
onddeamonatnext
booti
nRHEL-6)
#ser
vicecr
ondst
atus (
toseet
hest
atusoft
hecr
onddeamon
i
nRHEL-6)
#ser
vicecr
ondst
op (
tost
opt
hecr
onddeamoni
nRHEL-6)
#ser
vicecr
ondst
art (
tost
artt
hecr
onddeamoni
nRHEL-6)
#sy
stemct
lrest
artat
d (
tor
est
artt
heat
ddeamoni
nRHEL-7)
#sy
stemct
lenabl
eat
d (
toenabl
etheat
ddeamonatnex
tboot
i
nRHEL-7)
#sy
stemct
lst
atusat
d (
toseet
hest
atusoft
heat
ddeamoni
n
RHEL-7)
#sy
stemct
lst
opat
d (
tost
opt
heat
ddeamoni
nRHEL-7)
#sy
stemct
lst
artat
d (
tost
artt
heat
ddeamoni
nRHEL-7)
#sy
stemct
lrest
artcr
ond (
tor
est
artt
hecr
onddeamoni
n
RHEL-7)
#sy
stemct
lenabl
ecr
ond (
toenabl
ethecr
onddeamonat
nextbooti
nRHEL-7)
#sy
stemct
lst
atuscr
ond (
toseet
hest
atusoft
hecr
ond
deamoni
nRHEL-7)
#sy
stemct
lst
opcr
ond (
tost
opt
hecr
onddeamoni
nRHEL-7)
#sy
stemct
lst
artcr
ond (
tost
artt
hecr
ondeamoni
nRHEL-7)

Rat
nakar
Page78
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#at-
l (
toseet
hel
i
stofatj
obs)
#at
q (
toseet
hej
obsi
nthequeue)
#at
rm <j
ob i
d> (
tor
emov
ethespeci
fi
edatj
ob)
#at<t
ime> (
tosett
heatj
obt
obeexecut
edatt
he
speci
fi
edt
ime)
#at9:
30 (
tosett
heatj
obt
obeexecut
edat9:
30
AM)
Exampl
e:#at9:
30
at
>user
addgopal
at
>gr
oupaddmanager
at
>rm-
rf/
opt
at
>tar-
cvf/
root
/et
c.t
ar /
etc/
*
pr
ess Ct
rl+d t
osav
eandexi
tfr
om atj
ob
#at-
r<j
ob i
d> (
tor
emov
ethespeci
fi
edj
ob)
*atj
obscanbeper
for
medonl
yonet
ime.I
tcannotr
epeatdai
l
y.
*atj
obsonceschedul
ed,
wecannotedi
tthej
obsormodi
fyt
het
imeoft
hej
ob.
#atnow +5mi
n (
toexecut
etheatj
obnowaf
ter5
mi
nut
es)
at
>touch f
1f2f
3
at
>mkdi
r/r
am
at
><EOT> orCt
rl+d (
tosav
eandexi
tfr
om atj
obedi
tor
)
#t
ail
f/v
ar/
log/
cron (
toseet
hel
ast10l
i
nesofatorcr
onl
og
f
il
econt
ent
s)
#atJan202015 (
toschedul
etheatj
obon20t
h
Jan2015)
#at5PM Jan132015 (
toschedul
etheatj
obon13t
hJan2015
at5PM)
#atnoon+4day
s (
toschedul
etheatj
obt
odayand
af
ter4day
s)
#atmi
dni
ght (
toschedul
etheatj
obt
odaymi
dni
ght
)
#atmi
dni
ght+4day
s (
toschedul
etheatj
obt
odaymi
dni
ght
andaf
ter4day
s)
#v
im /
etc/
at.
deny (
todenyt
heatj
obsf
orspeci
fi
eduser
s)
#v
im /
etc/
at.
all
ow (
toal
l
owt
heatj
obsf
orspeci
fi
eduser
s)
*I
fbot
h/et
c/at
.deny and /
etc/
at.
all
ow f
il
esar
edel
eted,
exceptr
ootuserev
ery
userwi
l
lbedenyt
o
execut
eatj
obs.
*Onceschedul
edt
hecr
onj
obs,
wecanmodi
fy,
edi
tthatj
obanyno.oft
imes.
#cat/
etc/
cront
ab (
toseet
hecr
onj
obsl
i
st)
#cr
ont
ab -
lu <username> (
tol
i
stal
lthecr
onj
obsoft
hespeci
fi
ed

Rat
nakar
Page79
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

user
)
#cr
ont
ab -
eu <username> (
tocr
eat
eoredi
tthecr
onj
obs)
#cr
ont
ab -
ru <username> (
toer
aseorr
emov
ethespeci
fi
eduser
's
cr
onj
obs)
#cr
ont
ab -
r<j
ob i
d> (
tor
emov
ethespeci
fi
edcr
onj
obs)
#v
im /
etc/
cron.
deny (
todenyt
hecr
onj
obsf
orspeci
fi
ed
user
s)
#v
im /
etc/
cron.
all
ow (
toal
l
owt
hecr
onj
obsf
orspeci
fi
ed
user
s)
*I
fbot
hfi
l
esar
eremov
eordel
eted,
exceptr
ootuseral
ltheuser
sar
edenyt
oex
ecut
e
t
hecr
onj
obs.
#cr
ont
ab -
eu r
aju
55 14 20 1 2 /
usr
/sbi
n/user
add gopal
;usr
/sbi
n/gr
oupadd
t
eam
(
sav
e&exi
tthi
scr
ont
ab)
*Thi
sjobex
ecut
est
heuser
addandgr
oupaddcommandsonTuesday20t
hJan
ev
eryy
ear
Exampl
esf
orcr
ont
ab:
(
i)58 14,
15 20-
25 1 2,
3,
6 /
usr
/sbi
n/passwd
wher
e 58-
--
--
>58mi
nut
es
14,
15-
--
--
> 14hour
sand15hour
s(14:
58and 15:
58)
20-
25-
--
--
>dat
es20,
21,
22.23,
24and25
1 -
--
--
>Januar
y
2,
3,6-
--
--
>2ndday
,3r
ddayand6t
hday
(
ii
)58 15 * * * <command>
wher
e 58 -
--
--
> 58mi
nut
es
15 -
--
--
> 15hour
s(at15:
58)
*** -
--
--
> ev
eryday

(
ii
i) 58 *
/2 * * * <commands>
wher
e 58 -
--
--
> 58mi
nut
es
*
/2-
--
--
>Ev
ery 2 hour
s
*** -
--
--
> ev
eryday
(
iv)00 *
/2 * * * sy
nc;echo"
--
-">/
sys/
class/
scsi
_host
s/host
2/scan
(
v)@r
eboot <mai
lcommand> (
ever
yreboot
,onemai
lwi
l
lbesendt
o
t
her
oot
)
(
vi) @mont
hly <command> (
ever
ymont
hthecommandwi
l
lbe
execut
ed)
(
vii
)@y
ear
ly <command> (
ever
yyeart
hespeci
fi
edcommandwi
l
l
beexecut
ed)

Rat
nakar
Page80
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
vii
i
)@r
eboot /
usr
/sbi
n/ or /
bin/
sh /
root
/coss.
sh (
ever
yreboott
he
speci
fi
edscr
iptf
il
ewi
l
lbe
execut
ed)
*I
fthesy
stem i
sschedul
edf
oraj
ob,
butatt
hatt
imet
hesy
stem i
sunderdownt
hen
anacr
oncommandi
s
r
esponsi
blef
ort
hosependi
ngj
obst
obeex
ecut
ed.
#cat/
etc/
anacr
on i
stheconf
igur
ati
onf
il
eforanacr
onj
obs.
#anacr
on (
anacr
oni
susedt
oexecut
ethependi
ngcr
onj
obs)
#v
im/
etc/
rc.
local (
toexecut
ethecr
onpendi
ngj
obsaut
omat
ical
l
y
whenev
ert
hesy
stem i
sreboot
ed)
* Opent
heabov
efi
l
eandgot
olastl
i
neandt
ypeas,anacr
on t
hensav
eandexi
tthi
s
f
il
etoexecut
ethe pendi
ngj
obsaut
omat
ical
l
ywhenev
ert
hesy
stem i
sreboot
ed.

8.Admi
nist
rat
ingRemot
eSy
stems(
SSH)

Rat
nakar
Page81
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

1. Whati
sremot
eadmi
nist
rat
ionandexpl
aini
t?
(
i)Remot
eadmi
nist
rat
ionmeansadmi
nist
rat
ionofser
ver
swhi
char
elocat
edi
n
r
emot
ely
.
(
ii
)Nor
mal
l
yser
ver
sar
epl
acedi
ndat
acent
ersl
i
kebooksar
rangedi
nar
ack.
(
ii
i) Thesedat
acent
ersar
enor
mal
l
ylocat
edi
nUS,
UKandAust
ral
i
a..
.et
c.,
(
iv) Gener
all
ywel
ogi
nasnor
mal
useri
nlocal
syst
emsandgett
her
emot
e
deskt
oporconsol
eusi
ngr
emot
e deskt
opt
ool
sli
keput
ty,
VNCser
ver
,..
.et
c.,
(
v)I
fiti
sthr
oughr
emot
edeskt
op,
wecanmanaget
heser
ver
susi
ngt
heGUIt
ool
s.
(
vi)I
fiti
sthr
oughput
ty,
wecanmanaget
heser
vesusi
ngcommandl
i
nei
nter
faceonl
y.
I
nbot
hway
sweshoul
d gi
veser
vernameorI
Paddr
ess,
por
tno.
,usernameand
passwor
d.
2. Whati
sSSHandexpl
aini
t?
SSH i
sst
andsf
orSecur
eShel
l
.Itwasdesi
gnedandcr
eat
edt
opr
ovi
det
hebest
secur
it
ywhenaccessi
nganot
hercomput
err
emot
ely
.Notonl
ydoesi
tencr
yptt
he
sessi
on,
ital
sopr
ovi
desbet
teraut
hent
icat
ionf
aci
l
iti
es.
Onwi
ndowssy
stemsi
nst
all
theput
tysof
twar
eandt
hroughput
tywecanaccesst
he
r
emot
esy
stem byconf
igur
ingssh.
SShi
spr
otocol
whi
chf
aci
l
itat
essecur
edcommuni
cat
ionbet
weent
wosy
stemsusi
ng
Cl
i
ent
-Ser
verar
chi
tect
ureandal
l
owsuser
stol
ogi
ntot
heser
verhostsy
stemsr
emot
ely
.
I
tisusedt
oconnectt
oremot
esy
stem andper
for
m admi
nist
rat
ivet
askorj
obs.By
def
aul
tssht
akespasswor
daut
hent
icat
ionmechani
sm andi
tspor
tno.i
s22.Thr
ough
ssht
hedat
awi
l
lbet
ransf
err
edi
nencr
ypt
edf
ormat
.
3. Whati
stel
net
?
Tel
neti
samechani
sm t
oconnectandt
oadmi
nist
rat
ether
emot
esy
stem f
rom l
ocal
sy
stem.Thi
sist
heol
destpr
ogr
am whi
chi
sav
ail
abl
eonmostnet
wor
kcapabl
e
oper
ati
ngsy
stems.Accessi
ngar
emot
eshel
laccountt
hrought
het
elnetmet
hodi
s
dangerbecausei
nthatev
ery
thi
ngt
haty
ousendorr
ecei
veov
ert
hatt
elnetsessi
oni
s
v
isi
blei
npl
aint
extony
ourl
ocal
net
wor
kandt
hel
ocal
net
wor
koft
hemachi
ney
ouar
e
connect
ingt
o.
So,
any
onecansni
fft
heconnect
ioni
n-bet
weencanseeourusername,
passwor
d,
emai
landot
hermessagest
hatwer
eadandcommandt
hatwer
un.Fort
heser
easons
weneedamor
esophi
sti
cat
edpr
ogr
am t
hant
elnett
oconnectt
oar
emot
ehost
.
4. Whatar
ethedi
ff
erencesbet
weenTel
netandSSH?
Tel
net SSH
(a)Throughsshal sowecanconnectthe
(
a)Thr oughtel
netwecanconnectt
heremote remote
sy
st em,butanynet
wor
khackermayseethe system,butnobodycanseet
hetransf
err
ed
t
ransferreddata.Andt
hetel
netportno.i
s23. data.
Andthesshportno.i
s22.
(
b)Dat
awi
l
lbet
ransf
err
edi
nnon-
encr
ypt
ed
(
b)Dat
awi
l
lbet
ransf
err
edi
nencr
ypt
edf
ormat
.
f
ormat
.

Rat
nakar
Page82
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
c)Wecannott
rustt
hist
elnetconnect
ion. (
c)Wecant
rustt
hissshconnect
ion.

(
d)Wecannotgi
vet
het
rust
ingi
ntel
net
. (
d)Wecangi
vet
het
rust
ingi
nssh.
(e)Bysnoopi
ngorsniff
ingt
echnol
ogi
eswe
(e)Bysnoopingorsniff
ingtechnol
ogi
eswecan
cannot
see
seethedatal
ikesyst
em nameorhost
name,
thedatali
kesystem orhostname,
logi
nname,
l
ogin
passwor dandotherdata.
name,passwordandotherdat
a.
So,ther
eisnosecurity.
So,t
herei
sasecurit
y
(
f)#t
elnet
<IPaddressoft
her
emotesyst
em> (
f)#ssh<I
Paddressoft
heremot
esyst
em>
(
provi
deloginnameandpasswor
d) (
provi
del
oginnameandpasswor
d)

5. I
nhowmanyway
swecanconnectt
her
emot
ehostt
hroughssh?
Thr
oughsshwecanconnectt
her
emot
ehostbyt
womet
hods.
(
i)CommandLi
neI
nter
face(
CLI
).
Exampl
e:#ssh <I
Paddr
essoft
her
emot
esy
stem>(
prov
idel
ogi
nnameand
passwor
d)
(
ii
)Gr
aphi
cal
UserI
nter
face(
GUI
).
Exampl
e:openVNSser
verwi
ndowandpr
ovi
der
emot
ehost
name,
logi
nnameand
passwor
d.
6. Whatar
ether
equi
rement
sforssh?
(
i)Remot
esy
stemsI
Paddr
ess.
(
ii
)Remot
esy
stemsusernameandpasswor
d
(
ii
i)Apr
opernet
wor
kie.
,ourl
ocal
andr
emot
esy
stemsshoul
dbei
nthesamenet
wor
k.
(
iv)Opensshpackaget
oconf
igur
ethessh.
7. I
nhowmanyway
swecanconnectt
her
emot
esy
stem?
(
i)t
elnet (
ii
)ssh
(
ii
i)r
logi
n (
iv)r
cp
(
v)f
tp (
vi)scp
(
vii
)sf
tp (
vii
i
)tf
tp
8. Whati
sthesy
ntaxf
orssh?
#ssh <I
Paddr
essoft
her
emot
esy
stem> -
l <username>
#ssh <username>@<I
Paddr
essoft
her
emot
esy
stem>
#ssh <username>@<r
emot
ehost
namewi
thf
ull
yqual
i
fieddomai
nname>
* Af
terex
ecut
inganyoft
heabov
ecommands,
itmayasksusernameandpasswor
d.
Thent
ypeusernameand
passwor
dst
oconnectt
her
emot
esy
stems.
9. Howt
oconf
igur
ethesshwi
thkey
basedaut
hent
icat
ionorexpl
aint
hessht
rust
ing?
(
i)SSH key
basedaut
hent
icat
ioni
susedt
oaccesst
her
emot
esy
stem wi
thoutaski
ng
anypasswor
ds.
(
ii
)Fort
hat
,fi
rstwehav
etogener
atet
hepubl
i
candpr
ivat
ekey
sbyexecut
ing#ssh-

Rat
nakar
Page83
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

key
gen commandonour sy
stem.Thent
hepubl
i
candpr
ivat
ekey
sar
egener
ated
i
n/home/
<username>/
.ssh l
ocat
ion.i
e.,
.ssh di
rect
oryi
nuser
shomedi
rect
ory
.
Andt
hekey
sar
eid_
rsa(
pri
vat
ekey
)and i
d_r
sa.
pub(
publ
i
ckey
).
(
ii
i)Thencopyt
hepubl
i
ckey i
d_r
sa.
pub ont
her
emot
esy
stem byexecut
ingt
hebel
ow
command.
#ssh-
copy
-id -
i <username>@<I
Paddr
essoft
her
emot
esy
stem>
(
iv) Got
oremot
esy
stem andcheckwhet
hert
heabov
ekeyi
scopi
edornotby#
cat/
home/
<user name>/
.ssh/
aut
hor
ized_
key
s f
il
e.Andt
hepr
ivat
ekey
shoul
dbei
noursy
stem.
(
v)Whenev
erwear
etr
yingt
oest
abl
i
shaconnect
iont
hepubl
i
ckeyonr
emot
esy
stem
shoul
dbemat
chedwi
tht
hepr
ivat
ekeyonoursy
stem.ot
her
wiset
her
eisno
connect
ioni
sest
abl
i
shed.
(
vi)I
fbot
hpubl
i
candpr
ivat
ekey
sar
emat
chedt
henconnect
ionwi
l
lbeest
abl
i
shedand
f
ir
stt
imei
twi
l
laskt
he passwor
d.Oncet
heconnect
ioni
sest
abl
i
shed,
nextt
ime
onwar
dsi
twon'
taskanypasswor
ds.
#ssh <username>@<r
emot
ehost
nameorI
Paddr
ess> (
fi
rstt
imei
t
wi
l
laskst
hepasswor
d)
(
vii
)Theaut
hent
icat
ioni
sdonet
hrought
hepubl
i
candpr
ivat
ekey
s,sot
hist
ypeof
aut
hent
icat
ioni
scal
l
ed key
basedaut
hent
icat
ion.
10.Howt
opr
eventt
her
emot
elogi
nrootuserorhowt
oconf
igur
ethessht
opr
eventt
he
r
emot
elogi
nforr
oot
?
(
i)Thel
ocat
ionoft
hesshconf
igur
ati
onf
il
eis/
etc/
ssh/
sshd_
conf
ig
(
ii
)Opent
heconf
igur
ati
onf
il
eby #v
im /
etc/
ssh/
sshd_
conf
ig
-
--
--
> got
oli
neno.42(
inRHEL-6)or
-
--
--
> got
oli
neno.48(
inRHEL-7)Per
mit
Root
Logi
n y
es
anduncommentt
hatl
i
neandt
ypeas "no"i
npl
aceof"y
es"andsav
eandexi
tthi
sfi
l
e.
(
ii
i)Thenr
est
artt
heorr
eloadt
hesshddeamonby
#ser
vicesshdr
est
art (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artsshd (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-7)
#chkconf
igsshdon (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-6)
#sy
stemct
lenabl
esshd (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-7)
#ser
vicesshdr
eload (
tor
eloadt
hesshddeamoni
n
RHEL-6)
#sy
stemct
lrel
oadsshd (
tor
eloadt
hesshddeamoni
nRHEL-7)
(
iv) Thennor
ootusercannotaccessoursy
stem r
emot
elyt
hroughsshser
vice.
11.Howt
oal
l
owt
her
emot
euser
stor
unGUIcommandst
hroughssh?

Rat
nakar
Page84
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Opensshconf
igur
ati
onf
il
eby#v
im/
etc/
ssh/
sshd_
conf
ig
-
--
--
> got
oli
neno.109i
nRHEL-6or
-
--
--
> got
oli
neno.117i
nRHEL-7X11For
war
ding no
t
ypeas "y
es"i
npl
aceof "no"t
hensav
eandex
itt
hisf
il
e.
*I
fiti
syes,t
henGUIcommandscanbeexecut
edont
her
emot
esy
stem.
*I
fiti
sno,t
henGUIcommandscannotbeexecut
edont
her
emot
esy
stem.
(
ii
)Thenr
est
artt
hesshdser
viceordeamont
oef
fectt
heabov
emodi
fi
cat
ionby
#ser
vicesshdr
est
art (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artsshd (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-7)
#chkconf
igsshdon (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-6)
#sy
stemct
lenabl
esshd (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-7)
#ser
vicesshdr
eload (
tor
eloadt
hesshddeamoni
n
RHEL-6)
#sy
stemct
lrel
oadsshd (
tor
eloadt
hesshddeamoni
nRHEL-7)
(
ii
i) #gedi
t (
toopent
hegedi
tedi
tor
onr
emot
ely
)
12.Howt
oal
l
owempt
ypasswor
dthr
oughssh?
(
i)Opent
hesshconf
igur
ati
onf
il
eby#v
im/
etc/
ssh/
sshd_
conf
ig
-
--
--
> got
oli
neno.65i
nRHEL-6 or
-
--
--
> got
oli
neno.77i
nRHEL-7 Per
mit
Empt
yPasswor
d no
t
ypeas "y
es"i
npl
aceof "no"t
hensav
eandexi
tthi
sfi
l
e.
*I
fiti
syes,t
hent
her
emot
esy
stem wi
l
lbeal
l
owt
heuser
swi
thempt
ypasswor
d
i
e.,
wit
houtpasswor
d.
*I
fiti
sno,t
hent
her
emot
esy
stem wi
l
lnotbeal
l
owt
heuser
swi
thempt
y
passwor
ds.
(
ii
)Thenr
est
artt
hesshdser
viceordeamont
oef
fectt
heabov
emodi
fi
cat
ionsby
#ser
vicesshdr
est
art (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artsshd (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-7)
#chkconf
igsshdon (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-6)
#sy
stemct
lenabl
esshd (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-7)
#ser
vicesshdr
eload (
tor
eloadt
hesshddeamoni
n
RHEL-6)

Rat
nakar
Page85
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#sy
stemct
lrel
oadsshd (
tor
eloadt
hesshddeamoni
nRHEL-7)
(
ii
i)Now,
theuser
swhoar
ehav
ingempt
ypasswor
dsar
eal
soaccesst
her
emot
e
sy
stemst
hroughssh.
13.Howt
opr
eventt
hepasswor
daut
hent
icat
ionmechani
sm i
nssh?
(
i)Opent
hesshconf
igur
ati
onf
il
eby#v
im/
etc/
ssh/
sshd_
conf
ig
-
--
--
> got
oli
neno.66i
nRHEL-6 or
-
--
--
> got
oli
neno.78i
nRHEL-7 Passwor
dAut
hent
icat
ion no
t
ypeas "no"i
npl
aceof "y
es"t
hensav
eandexi
tthi
sfi
l
e.
*I
fiti
syes,t
hent
her
emot
esy
stem wi
l
laskt
hepasswor
d.
*I
fiti
sno,t
hent
her
emot
esy
stem wi
l
lnotaskanyt
ypeofpasswor
ds.
(
ii
)Thenr
est
artt
hesshdser
viceordeamont
oef
fectt
heabov
emodi
fi
cat
ionsby
#ser
vicesshdr
est
art (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artsshd (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-7)
#chkconf
igsshdon (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-6)
#sy
stemct
lenabl
esshd (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-7)
#ser
vicesshdr
eload (
tor
eloadt
hesshddeamoni
n
RHEL-6)
#sy
stemct
lrel
oadsshd (
tor
eloadt
hesshddeamoni
nRHEL-7)
(
ii
i)Now,
wecanaccesst
her
emot
esy
stemst
hroughsshwi
thoutPasswor
d
Aut
hent
icat
ionmechani
sm.
14.Howt
oal
l
ow ordenyt
heusesorgr
oupt
oaccesst
her
emot
esy
stemst
hroughssh?
(
i)I
fwewantt
oal
l
ow ordenyt
hepar
ti
cul
aruser
sthengot
olastl
i
neoft
hessh
conf
igur
ati
onf
il
eandt
ypeas
Deny
User
s <user1><user2><user
3>.
..
etc.
,(t
heseuser
swi
l
lbedeni
edt
hessh
ser
vice)
Al
l
owUser
s <st
udent
><user4><user5>.
..
etc.
,(t
heseuser
swi
l
lbeal
l
owedt
hessh
ser
vice)
Deny
Group <gr
oup1><gr
oup2><gr
oup3>.
..
etc.
,(t
hesegr
oupuser
swi
l
lbedeni
ed
t
hesshser
vice)
Al
l
owGr
oup <gr
oup1><gr
oup2><gr
oup3>.
..
etc.
,(t
hesegr
oupuser
swi
l
lbe
al
l
owedt
hesshser
vice)
(
ii
)Thenr
est
artt
hesshdser
viceordeamont
oef
fectt
heabov
emodi
fi
cat
ionsby
#ser
vicesshdr
est
art (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artsshd (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-7)

Rat
nakar
Page86
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#chkconf
igsshdon (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-6)
#sy
stemct
lenabl
esshd (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-7)
#ser
vicesshdr
eload (
tor
eloadt
hesshddeamoni
n
RHEL-6)
#sy
stemct
lrel
oadsshd (
tor
eloadt
hesshddeamoni
nRHEL-7)
15.Howal
lowt
hespeci
fi
edno.ofuser
stoaccessr
emot
esy
stem atat
ime?
(
i)Opent
hesshconf
igur
ati
onf
il
eby #v
im/
etc/
ssh/
sshd_
conf
igt
hengot
o
MaxAut
hTr
ies l
i
neandt
ypeas,
MaxAut
hTr
ies<no.
>(t
ypeanynumer
icv
alueequal
toMax.user
stoal
l
owatat
ime
i
npl
aceof<no.
>,
t
hensav
eandexi
tthi
sfi
l
e)
(
ii
)Thenr
est
artt
hesshdser
viceordeamont
oef
fectt
heabov
emodi
fi
cat
ionsby
#ser
vicesshdr
est
art (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artsshd (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-7)
#chkconf
igsshdon (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-6)
#sy
stemct
lenabl
esshd (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-7)
#ser
vicesshdr
eload (
tor
eloadt
hesshddeamoni
n
RHEL-6)
#sy
stemct
lrel
oadsshd (
tor
eloadt
hesshddeamoni
nRHEL-7)
16.Howt
oal
l
ow ordenyt
hehost
sornet
wor
kst
ouset
hessh?
TodenyI
Paddr
esses orhost
names:
(
i)Open/
etc/
host
s.deny
fil
eby#v
im/
etc/
host
s.deny andgot
olastl
i
neandt
ypeas,
sshd:<I
Paddr
ess1><I
Paddr
ess2><I
Paddr
ess3>.
..
etc.
,(t
odenyI
P1,
IP2,
IP3,
.
..
etc.
,
)
sshd:<host
name1><host
name2><host
name3>.
..
etc.
,
sshd:*
.exampl
e.com *
.my
133t
.or
g..
.et
c.,(
todenyal
lthehost
sfr
om t
hese
domai
ns)
sshd:192.
168.
0.172.
25.
0..
..
etc.
, (
todeny192.
168.
0and 172.
25.
0net
wor
ks)
sshd:ALLExcept<host
name orI
Paddr
ess>(
todenyal
lthehost
sorI
P
addr
essesex
ceptt
hespeci
fi
ed
onei
nthatnet
wor
k) andsav
e&ex
itt
hef
il
e.
(
ii
)Thenr
est
artt
hesshdser
viceordeamont
oef
fectt
heabov
emodi
fi
cat
ionsby
#ser
vicesshdr
est
art (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-6)

Rat
nakar
Page87
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#sy
stemct
lrest
artsshd (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-7)
#chkconf
igsshdon (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-6)
#sy
stemct
lenabl
esshd (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-7)
#ser
vicesshdr
eload (
tor
eloadt
hesshddeamoni
n
RHEL-6)
#sy
stemct
lrel
oadsshd (
tor
eloadt
hesshddeamoni
nRHEL-7)
Toal
lowI
Paddr
esses orhost
names:
(
i)Open/
etc/
host
s.al
low f
il
eby #v
im/
etc/
host
s.al
low andgot
olastl
i
neand
t
ypeas,
sshd:<I
Paddr
ess1><I
Paddr
ess2><I
Paddr
ess3>.
..
etc.
,(t
oal
l
ow I
P1,
IP2,
IP3,
.
..
etc.
,
)
sshd:<host
name1><host
name2><host
name3>.
..
etc.
,
sshd:*
.exampl
e.com *
.my
133t
.or
g..
.et
c.,(
toal
l
owal
lthehost
sfr
om t
hese
domai
ns)
sshd:192.
168.
0.172.
25.
0..
..
etc.
, (
toal
l
ow192.
168.
0and 172.
25.
0
net
wor
ks)
sshd:ALLExcept<host
name orI
Paddr
ess>(
toal
l
owal
lthehost
sorI
P
addr
essesex
ceptt
hespeci
fi
ed
onei
nthatnet
wor
k) andsav
e&ex
itt
hef
il
e.
(
ii
)Thenr
est
artt
hesshdser
viceordeamont
oef
fectt
heabov
emodi
fi
cat
ionsby
#ser
vicesshdr
est
art (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artsshd (
tor
est
artt
hesshddeamonor
ser
vicei
nRHEL-7)
#chkconf
igsshdon (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-6)
#sy
stemct
lenabl
esshd (
toenabl
ethesshddeamonatnext
r
ebooti
nRHEL-7)
#ser
vicesshdr
eload (
tor
eloadt
hesshddeamoni
n
RHEL-6)
#sy
stemct
lrel
oadsshd (
tor
eloadt
hesshddeamoni
nRHEL-7)
17.Howt
ocheckwhet
hert
hesshi
srunni
ngornotonr
emot
ehost
?
#nmap -
p22 <I
Paddr
essoft
her
emot
ehost
> (
toseet
hesshi
srunni
ngornot
onr
emot
esy
stem)
18.Howt
otr
oubl
eshooti
fthecl
ienthascompl
aint
hatIam notaccessi
ngt
heser
ver
usi
ngssh?
(
i)Fi
rstcheckt
hepi
ngi
ngoft
hecl
i
entsy
stem.I
fiti
snotpi
ngi
ngt
hencheckt
heI
P

Rat
nakar
Page88
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

addr
essoft
hecl
i
entsy
stem. I
fcl
i
entsy
stem andsev
ersy
stem ar
eindi
ff
erent
domai
nsornet
wor
ksi
twi
l
lnotpi
ng.So,
bri
ngt
hecl
i
ent sy
stem i
ntot
henet
wor
k
oft
heser
versy
stem.Checkt
henet
wor
kiswor
kingornotandal
socheckwhet
her t
he
net
wor
kcabl
eisconnect
edornot
.
(
ii
)Ifbot
hsy
stemsar
epi
ngi
ngt
hencheckwhet
hert
he openssh packagei
sinst
all
ed
ornot
.Ifnoti
nst
all
ed t
heni
nst
all
thatpackageandconf
igur
esshont
hecl
i
ent
sy
stem andr
est
artt
hesshddeamon.
(
ii
i)Checkt
hecl
i
ent<I
Paddr
essorhost
name>i
n/et
c/host
s.denyf
il
es.I
fther
eisan
ent
ryoft
hecl
i
ent sy
stem i
nthi
sfi
l
e,t
henr
emov
ethatent
ryandr
est
artt
hesshd
deamon.
(
iv)Fi
nal
l
yopent
hesshconf
igur
ati
onf
il
eby#v
im/
etc/
ssh/
sshd_
conf
ig andsee
anycl
i
entusernamei
s pr
esentornotandcheckot
herl
i
nesf
orcl
i
entent
ri
esi
nthi
sfi
l
e,
i
fpr
esentr
emov
ethoseent
ri
es,
sav
ethat f
il
eandr
est
artt
hesshdser
vice.
(
v)Fi
nal
l
ycheckwhet
hert
hecl
i
entuseri
sther
eint
heser
verornot
,ifnotcr
eat
ethe
cl
i
entuser
,assi
gnt
he passwor
dshar
ethosedet
ail
stocl
i
ent
.Ifuseri
sther
ethen
checkwhet
hert
hecl
i
entuser
'spasswor
dis l
ocked,
accountex
pir
edandanyot
heror
not
,ifl
ockedt
henr
emov
ethel
ock,
ifcl
i
entaccounti
sex
pir
edt
hen act
ivat
ethat
account
,assi
gnt
hepasswor
dandmaket
hessht
rust
ingbet
weencl
i
entandser
ver
sy
stems.
19.Howt
ocopyt
hef
il
efr
om oursy
stem t
oremot
esy
stem?
#scp <sour
cef
il
enamewi
thf
ull
pat
h><I
Paddr
essoft
her
emot
esy
stem>:
<dest
inat
ion
l
ocat
ion>
Exampl
e:ssh /
root
/scr
ipt
1 192.
168.
1.1:
/r
oot
/scr
ipt
1(t
ocopy/
root
/scr
ipt
1fi
l
eint
o
192.
168.
1.1sy
stem)
ssh -
r/r
oot
/raj
u/ 192.
168.
1.1:
/r
oot
/raj
u/(
tocopy/
root
/raj
udi
rect
oryt
o
r
emot
esy
stem)
*scpmeanssecur
edcopyt
ocopyt
hef
il
esordi
rect
ori
esf
rom l
ocal
syst
em t
o
r
emot
esy
stem.

20.Whati
srsy
ncandexpl
aini
t?
r
synci
sav
erygoodpr
ogr
am f
orbacki
ngupormi
rr
ori
ngadi
rect
oryt
reeoff
il
esf
rom
onemachi
net
oanot
hermachi
neandf
orkeepi
ngt
het
womachi
nes"i
nsy
nc"
.Iti
s
desi
gnedt
ospeedupf
il
etr
ansf
erbycopi
ngt
hedi
ff
erencesbet
weent
wof
il
esr
ather
t
hancopi
nganent
ir
efi
l
eev
eryt
ime.
I
frsy
nci
scombi
nedwi
thssh,
itmakesagr
eatut
il
it
ytosy
nct
hedat
asecur
ely
ot
her
wisebysni
ff
inganyonecanseeourdat
aie.
,nosecur
it
yforourdat
a.
21.Asy
stem i
sabl
etopi
ngl
ocal
lybutnotoutsi
te.Why
?
(
i)Maybet
her
eisnoaccesst
oout
side.
(
ii
)Maybeout
sidei
sindi
ff
erentnet
wor
kfr
om t
hel
ocal
.
(
ii
i) Maybeper
missi
oni
sdeni
edf
ort
hatsy
stem t
oaccessout
side.

Rat
nakar
Page89
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
iv) I
fther
eisaccess,
butr
out
erormodem ornet
wor
kswi
tchorNI
Cmaynotbe
wor
kingt
oaccesst
heout
side.
(
v)Maybeout
sidei
snotav
ail
abl
etempor
ari
l
y.
22.Asy
stem i
sechoi
ngt
hepi
ng,
butnotabl
etol
ogi
nvi
atel
net
.Why
?
(
i)Checkt
elnetser
vicei
sst
art
edornot
.Ifnotst
art
ed,
star
tthet
elnetser
vice.
(
ii
)Maybet
elnetser
vicei
sdi
sabl
ed,
ifso,
enabl
ethet
elnetser
vice.
(
ii
i) Maybet
elnetpor
tisbl
ocked,
ifso,
rel
easet
hatpor
tno.
(
iv)Maybet
elnetper
missi
oni
sdeni
ed,
ifso,
changet
heper
missi
onst
oal
l
owt
het
elnet
ser
vice.
(
v)Checkal
lthef
il
eswhet
hert
het
elnetser
vicei
sbl
ockedornot
,ifbl
ockedr
emov
e
t
hoseent
ri
es.
23.Howwi
lly
oul
ogi
norst
artt
hesy
stem i
nwhatmodei
fyoudon'
tknowt
her
oot
passwor
d?
(
i)I
ftheuserhav
ingsudoper
missi
ons,
thenl
ogi
nassudouser
.
(
ii
)Ifnosudoper
missi
onst
henbootwi
thCDROM i
nsi
ngl
eusermodeandst
artt
he
sy
stem.Thenpr
ovi
det
he r
ootpasswor
dtor
ootuseri
fther
eisnor
ootpasswor
d.
(
ii
i)Ev
ent
houghi
fiti
snotpossi
blet
henf
inal
l
ybr
eakt
her
ootpasswor
d.
Ot
herusef
ulcommands:
#t
elnet<I
Paddr
ess orhost
name> (
toconnectt
hespeci
fi
edr
emot
esy
stem
t
hrought
elnet
)
#ssh <I
Paddr
ess orhost
name> (
toconnectt
hespeci
fi
edr
emot
e
sy
stem t
hroughssh)
User
name:
xxxxxx
Passwor
d:x
xxxxxx
#ssh <I
Paddr
ess> -
l<username> (
toconnectt
her
emot
esy
stem usi
ng
username)
Passwor
d:x
xxxxxx
#ssh 192.
168.
1.1-
lroot (
toconnectt
hisr
emot
esy
stem
asr
ootuser
)
#ssh r
oot
@192.
168.
1.1 (
toconnectt
hisr
emot
esy
stem
asr
ootuser
)
#ssh r
oot
@ser
ver
1.exampl
e.com (
toconnectt
heser
ver
1sy
stem i
n
exampl
e.com domai
n)
#w (
toseeal
ltheuser
swhoar
elogi
ntoour
sy
stem)
#w -
f (
toseeal
ltheuser
swhoar
elogi
ntooursy
stem
wi
thot
herdet
ail
s)
#ssh <I
Paddr
ess> (
ifwenotspeci
fi
edt
heusername,
theni
twi
l
laskt
hecur
rent
user
spasswor
dand sear
ch
t
hecur
rentaccounti
nremot
esy
stem)

Rat
nakar
Page90
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#cat/
root
/.
ssh/
known_
host
s (
toseet
hessht
rust
ingr
emot
ehost
sfi
nger
pr
inti
nfor
mat
ion)
#ssh r
oot
@192.
168.
1.1 <command> (
tor
unacommandonr
emot
ehostwi
thout
l
ogi
ntot
hatsy
stem)
#ssh r
oot
@192.
168.
1.1-
X (
tor
unGUIcommandsont
her
emot
esy
stem because
bydef
aul
tthesshi
s conf
igur
ed
ascommandl
i
nei
nter
face,Xi
scapi
tal
)
#l
ast
b (
toseet
hel
ogi
nfai
l
edt
ri
es)
#l
ast-
x|gr
epshut
down (
toseet
hedat
e&t
imeoft
he
sy
stem'
slastshut
down)
9.Memor
yManagement(
Swap)

1. Whati
sswap?
Swapspacei
nLi
nuxi
susedwhent
heamountoft
hePhy
sical
memor
y(RAM)i
sful
l
.If
t
hesy
stem needsmor
ememor
yresour
cesandt
heRAM i
sful
l
,inact
ivepagesi
nthe
memor
yar
emov
edf
rom RAM t
oswapspace.I
thel
pst
hemachi
neswhi
char
ehav
ing
smal
lamountRAM andi
tshoul
dnotbeconsi
der
edar
epl
acementf
ormor
eRAM.Swap
i
slocat
edont
hehar
ddi
skswhi
chhav
esl
oweraccesst
imet
hanPhy
sical
memor
y.
2. Whati
sther
ecommendedswapspace?
Gener
all
yther
ecommendedswapspacei
sdoubl
etheRAM si
ze,
butt
hef
oll
owi
ngt
abl
e
showsact
ual
amount
.
Apar
tfr
om t
hebel
owr
ecommendat
ionabasi
crul
eisappl
i
edt
ocr
eat
etheswap
par
ti
ti
on.
*I
ftheRAM si
zei
slesst
hanorequal
to2GB,
thent
hesi
zeoft
heswap=2XRAM
si
ze.
*I
ftheRAM si
zei
smor
ethan2GB,
thent
hesi
zeoft
heswap=2GB+RAM si
ze.
RecommendedAmountofSwap
AmountofRAM i
ntheSy
stem
Space
4GB orl
ess Mi
n.2GB
4GB -16GB Mi
n.4GB
16GB-64GB Mi
n.8GB
64GB-256GB Mi
n.16GB
256GB-512GB Mi
n.32GB

3. I
sitnecessar
ytocr
eat
etheswapatt
het
imeofi
nst
all
ati
on?
Yes,
swapspacei
scompul
sor
ytobecr
eat
edatt
het
imeofi
nst
all
ati
on.Butaddi
ti
onal
swapspacecanbecr
eat
edanddel
etedatanypoi
ntoft
ime,
wheni
tisr
equi
red.
Somet
imesweneedt
oincr
easet
heswapspace,
sowecr
eat
eaddi
ti
onal
swapspace
whi
chwi
l
lbeaddedt
otheexi
sti
ngswapspacet
oincr
easet
hesi
ze.
4. Whati
sswap-
inandswap-
outorpage-
in and page-
out
?

Rat
nakar
Page91
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

swap-
in orpage-
out:
I
fwer
unoropenanyappl
i
cat
ion,
itr
equi
ressomeamountofmemor
ytol
oadi
ts
f
eat
ures.So,
fir
sti
tlooksoroccupyphy
sical
memor
y(RAM)
.Ift
her
eisnotenough
spacei
nRAM,
theappl
i
cat
ion'
sdat
aist
ransf
err
edf
rom RAM t
oswapspace.I
fthe
pagesar
emov
ingf
rom RAM t
oswapspace,
thati
scal
l
edswap-
inorpage-
out
.
swap-
outorpage-
in:
I
fol
derorpr
evi
ousappl
i
cat
ioni
scl
osed,
thent
hespaceoccupi
edbyt
hose
appl
i
cat
ionsal
socl
ear
ed.i
e.,
someoft
hespacei
sav
ail
abl
einRAM.So,
aut
omat
ical
l
y
somedat
awhi
chi
sal
readyoccupi
edi
nswapspacei
sal
somov
edf
rom swapt
oRAM.
I
fthepagesar
emov
ingf
rom swapspacet
oRAM,
thati
scal
l
edswap-
outorpage-
in.
5. Howpagi
ngspacei
sal
locat
ed?
(
i)Pagi
ngmeansdat
atr
ansf
err
edf
rom RAM t
oswapspace.
(
ii
)Ifweopenorr
unanyappl
i
cat
ion,
fir
sti
twi
l
loccupyt
her
equi
redspacei
nRAM.I
f
t
her
eisnotenoughspace i
nRAM,
thensomeamountofappl
i
cat
ion'
sdat
awi
l
lbe
t
ransf
err
edf
rom RAM t
oswapspace.i
e.,
swapspacei
sal
l
ocat
edt
othatappl
i
cat
ion.
Thi
sal
l
ocat
ioni
scal
l
edpagi
ngspaceorpage-
outal
l
ocat
ion.
(
ii
i) pagi
ngwi
l
ltakespl
acei
nswapbybl
ocks.Fi
rsti
twi
l
lcr
eat
ether
equi
redno.
ofbl
ocksi
nswapspace.
(
iv) I
fRAM spacecl
ear
edbyol
derorot
herappl
i
cat
ions,
thenswapoccupi
eddat
a
i
str
ansf
err
edf
rom swapt
o RAM.Thi
siscal
l
edpage-
in.So,
thatmuchamountof
spacei
sunal
l
ocat
edi
nswapi
e.,
remov
edt
hecr
eat
ed bl
ocksi
nswap.
6. Howt
ocr
eat
etheswappar
ti
ti
on?
#f
disk -
l (
toseet
heav
ail
abl
edi
sksi
nthesy
stem)
#f
disk /
dev
/sdb
Command(
m f
orhel
p):n (
tocr
eat
eanewpar
ti
ti
on)
Fi
rstcy
li
nder: (
pressEnt
erkey
)
Lastcy
li
nder:
+2048M
Command (
m orhel
p):t (
tochanget
hehexcode)
Par
ti
ti
onno.(
1-2):
2 (
tochanget
hepar
ti
ti
onnumberhexcode)
Hexcode:82 (
82i
sthehexcodef
orLi
nuxswap)
Command (
m f
orhel
p):w (
wri
tet
hechangest
othedi
sk)
#par
tpr
obe or#par
tpr
obe /
dev
/sdb (
toupdat
ethepar
ti
ti
ont
abl
einf
ormat
ion)
#mkswap /
dev
/sdb2 (
toconv
ertt
her
awdi
skt
oswapf
il
e
sy
stem)
#swapon /
dev
/sdb2 (
tot
urnont
heswappar
ti
ti
on)
#v
im /
etc/
fst
ab (
tomaket
heper
manentmountofswap
par
ti
ti
on)
/
dev
/sdb2 swap swap def
aul
ts 0 0
(
sav
eandexi
tthi
sfi
l
e)
#mount-
a (
tomountal
lthepar
ti
ti
onswhi
char
ehav
ing

Rat
nakar
Page92
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

ent
ri
esi
n/et
c/f
stabf
il
e)
#df -
hT (
wil
lnotshowt
heswapsi
ze)
#f
ree -
m (
toseet
het
otal
RAM andswapsi
ze)
7. Howt
oremov
etheswappar
ti
ti
on?
#swapon -
s (
toseet
heswappar
ti
ti
onnamesordi
sks)
#swapof
f/dev
/sdb2 (
tot
urnof
ftheswapspace)
#v
im/
etc/
fst
ab (
opent
hisf
il
eandr
emov
etheswappar
ti
ti
on
ent
ry)
(
aft
err
emov
ingt
heswappar
ti
ti
onsav
eandexi
tthi
sfi
l
e)
#f
disk /
dev
/sdb (
todel
etet
heswappar
ti
ti
on)
Command (
mforhel
p):
d (
dfort
odel
etet
hepar
ti
ti
on)
Par
ti
ti
onno.(
1-2):
2
Command (
mforhel
p):
w (
towr
it
ethechangesi
ntot
hedi
sk)
#par
tpr
obe or#par
tpr
obe /
dev
/sdb
#f
ree -
m (
toseet
heRAM aswel
lasswapsi
zes)
8. I
nhowmanyway
scanwecr
eat
etheswapspaces?
(
i)Bycr
eat
inganewswappar
ti
ti
onont
hedi
sk.(
separ
ateswappar
ti
ti
on)
(
ii
)Bycr
eat
ingswapf
il
e.
9. Howt
ocr
eat
etheswapspaceusi
ngt
heswapf
il
e?
Somet
imesi
tisunabl
etocr
eat
easwappar
ti
ti
onbecausemaybet
her
eisnodi
skspace
ormaybet
hepar
ti
ti
onl
i
miti
sal
readyexceeded.So,
int
hesescenar
ioswehav
eto
cr
eat
eonl
ythespacef
il
e.
#dd i
f=/
dev
/zer
o of=/
root
/l
inuxswap bs=1M count=2048(
tocr
eat
e2048MB
empt
yfi
l
e)
#du -/
root
/l
inuxswap (
toseet
hel
i
nuxswapsi
ze)
#mkswap /
root
/l
inuxswap (
toconv
ertt
heexi
sti
ngf
il
esy
stem t
o
swapf
il
esy
stem)
#swapon /
root
/l
inux
swap (
tot
urnont
heswapf
il
e)
#v
im /
etc/
fst
ab (
tomakeaper
manentmountofswapspace)
/
root
/l
inux
swap swap swap def
aul
ts 0 0
(
sav
eandexi
tthi
sfi
l
e)
#mount-
a (
tomountal
lthepar
ti
ti
onswhi
char
ehav
ing
ent
ri
esi
n/et
c/f
stabf
il
e)
#df -
hT (
wil
lnotshowt
heswapsi
ze)
#f
ree -
m (
toseet
het
otal
RAM andswapsi
ze)
10.Whati
svi
rt
ualmemor
y?
Thecombi
nat
ionofPhy
sical
memor
y(RAM)andswapspacei
scal
l
edt
hev
irt
ual
memor
y.
So,
Vir
tual
memor
y=Phy
sical
memor
y(RAM)+swapspace.
Ot
herusef
ulcommands:

Rat
nakar
Page93
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#swap -
s (
toseehowmanyswappar
ti
ti
onsar
ether
eand
wi
tht
hei
rnames)
#swapon -
a (
tot
urnonal
ltheswappar
ti
ti
ons)
#swapof
f-a (
tot
urnof
fal
ltheswappar
ti
ti
ons)
#cat/
etc/
mtab (
toseet
hecur
rentandt
empor
arymountpoi
nts)
#mount
poi
nt <di
rect
oryormountpoi
nt> (
tocheckt
hespeci
fi
eddi
rect
oryi
sa
nor
mal
dir
ect
ory ora
mountpoi
nt)
#df -
ih (
tocheckhowmanyi
nodenumber
sar
eav
ail
abl
eint
he
mount
edpar
ti
ti
ons)
11.Whathappenswhent
he/
usri
sful
l
?
(
i)User
scannotl
ogi
ntot
hesy
stem.
(
ii
)Ifal
readyl
ogi
nuser
snotabl
etoexecut
eanycommand.
12.Whathappenswhenmemor
yie.
,pagei
nspacei
sful
l
?
(
i)Thenewappl
i
cat
ionscannotl
oadduet
olackofmemor
y.
(
ii
)So,user
scannotl
ogi
ntot
heappl
i
cat
ionandcannotaccesst
heappl
i
cat
ions
f
eat
ures.
(
ii
i) So,i
fwei
ncr
easet
heswapmemor
ytot
her
equi
redsi
zet
hent
hepr
obl
em wi
l
l
besol
ved.
13.Howt
orest
oret
hedat
aandupgr
adey
ourO/
S?
(
i)Wecanr
est
oret
hedat
afr
om backupby
,tar
,cpi
o,dd,
netbackuporot
hert
ool
s.
(
ii
)Ifi
tisi
nmi
rr
or,
wecansy
nct
hedat
afr
om mi
rr
oreddi
sk.
(
ii
i) Wecanupgr
adet
heO/
Sint
woway
s.
(
a)Onl
ine:
TheO/
Sisupgr
adedf
rom pr
evi
oust
opr
esentwhi
l
ethesy
stem i
srunni
ng.I
tis
r
iskyandt
akesl
ongt
ime.
(
b)Of
fl
ine:
Fi
rstt
akebackupofal
lthesy
stem andt
henr
emov
epr
evi
ousO/
Sandi
nst
all
t
hepr
esentO/
Sand r
est
oret
hebackupf
rom backupdi
sksort
apes.So,
i
tisv
eryeasyandnon-
ri
skyj
ob.

Rat
nakar
Page94
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

10.Sof
twar
eManagement

1. Whati
ssof
twar
e?
Sof
twar
eisacol
l
ect
ionofpr
ogr
amst
oper
for
m somet
asksormanagesy
stems,
appl
i
cat
ions,
dat
abases,
.
..
etc.
,
2. Whati
spackageandpackagemanagement
?
Packagei
snot
hingbutasof
twar
etoper
for
m somet
asks.Sof
twar
eist
hebasi
cofany
O/
Sal
l
owi
ngt
oinst
all
andusedi
ff
erentut
il
it
ies.
Packagemanagementmeansi
nst
all
i
ng,
updat
ing,
quer
ying,
repai
ri
ngandr
emov
ing
packages.I
nLi
nuxt
her
ear
etwot
ool
stoper
for
m packagemanagement
.
r
pm -
--
--
>redhatpackagemanager and y
um -
--
--
>yel
l
owdogupdat
ermodi
fi
er.
3. Whati
srpm?
r
pm i
sapackagemanagi
ngsy
stem (
col
l
ect
ionoft
ool
stomanagesof
twar
epackages)
.
r
pm i
sapower
fulandmostpopul
aropensour
cet
ool
usedf
orsof
twar
emanagement
f
ori
nst
all
i
ng,
uni
nst
all
i
ng(
remov
ing)
,ver
if
ying,
quer
yingandupdat
ingsof
twar
e
packages.I
tisi
nst
all
edunder/
var
/li
b/r
pm dat
abasedi
rect
ory
.Itdeal
swi
th.
rpm f
il
es,
whi
chcont
ainst
heact
ual
inf
ormat
ionaboutt
hepackages.Ther
pm l
ogmessageswi
l
l
best
oredi
n/v
ar/
log/
yum.
log f
il
e.
4. Whatar
ethedr
awbacksofr
pm?
(
i)r
pm cannotr
esol
vet
hedependency
.Itmeans,
ifwewantt
oinst
all
anysof
twar
e,f
ir
st
t
hedependency packagesshoul
dbei
nst
all
ed.
(
ii
)Ther
eisnoconf
igur
ati
onf
il
eforr
pm.
5. Whatar
ethebasi
cmodesofr
pm commands?
(
i)I
nst
all-
--
--
> usedt
oinst
all
rpm packages.
(
ii
)Updat
e--
--
-> usedt
oupdat
edt
hepackages.
(
ii
i)Tr
oubl
eshoot
ing -
--
--
> usedt
orepai
rthepackages.
(
iv)Remov
e--
--
-> usedt
oremov
eoruni
nst
all
thepackages.
(
v)Quer
ying -
--
--
> usedt
oquer
y(gat
heri
nfor
mat
ion)onpackages.
6. Howmanyt
ypesofpackagesar
eav
ail
abl
einLi
nux?
(
i)x
86_
64.
rpm -
--
--
> 64bi
tpackageandcanbei
nst
all
on64bi
tO/
Sonl
y.
(
ii
) x86.
rpm -
--
--
> 32bi
tpackageandcanbei
nst
all
on32bi
tor64bi
tO/
Sonl
y.
(
ii
i) i
386.
rpm -
--
--
> 32bi
tpackageandcanbei
nst
all
on32bi
tor64bi
tO/
Sonl
y.
(
iv) i
486.
rpm -
--
--
> " "
(
v) i
586.
rpm -
--
--
> " "

Rat
nakar
Page95
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
vi) i
686.
rpm -
--
--
> 64bi
tpackageandcanbei
nst
all
on64bi
tO/
Sonl
y.
(
vii
)noar
ch.
rpm -
--
--
> no-
archi
tect
ureandcanbei
nst
all
onei
ther32bi
tor64bi
tO/
S.
7. Whati
sthesy
ntaxofr
pm commandwi
thf
ull
opt
ions?
#r
pm <opt
ions><packagename>
Theopt
ionsar
e, -
i--
--
->i
nst
all
-
v--
--
->v
erbose
-
h--
--
-> pr
ogr
essi
nhashcodes(i
n%)
-
qi-
--
--
> quer
yinf
ormat
ionaboutt
hepackage
-
ql-
--
--
>li
stal
lpackager
elat
edf
il
es.
-
qd-
--
-> quer
yaboutt
hedocumentoft
hepackage
-
qc-
--
--
> di
spl
ayst
heconf
igur
ati
onf
il
esf
ort
hatpackage
-
qa-
--
--
> quer
yonal
li
nst
all
edpackages
-
V--
--
->(
capi
talV)t
over
if
ythepackagef
orr
epai
rthatpackage
-
R--
--
->l
i
stal
ldependentpackages
-
-f
orce-
--
--
>inst
all
thepackagef
orcef
ull
y
-
-nodeps-
--
--
>inst
all
thepackagewi
thoutdependency(
donotcheck
t
hedependenci
es)
-
-l
ast-
--
--
> al
li
nst
all
edpackageswi
thdat
eandt
ime
Ot
herusef
ulr
pm commands:
#r
pm -
ivh <packagename> (
toi
nst
all
thepackage)
#r
pm -
qa (
tol
i
stal
li
nst
all
edpackages)
#r
pm -
qa <packagename> (
tocheckwhet
hert
hepackagei
s
i
nst
all
edornot
)
#r
pm -
qa|
wc -
l (
tocounthowmanypackagesal
ready
i
nst
all
ed)
#r
pm -
qa -
-l
ast|
less (
tocheckl
asti
nst
all
edpackages)
#r
pmquer
y -
qa (
tol
i
stal
lthei
nst
all
edpackages)
#r
pm -
qa|
grep -
i<packagename> (
tocheckt
hespeci
fi
edpackagei
s
i
nst
all
edornot
)
#r
pm -
ivh -
-t
est <packagename> (
tocheckt
hepackageconsi
stency
)
*I
fthei
nst
all
ati
onst
atusshows100%,
thent
hepackagei
singoodcondi
ti
onor
consi
stent
.Butwhi
l
eshowi
ng
t
hehashpr
ogr
essi
fitshowsanyer
ror
,thent
hepackagei
sini
nconsi
stentst
ate.
#r
pm -
ivh f
inger
* (
toi
nst
all
thef
ingerpackage)
#r
pm -
qa f
inger (
tocheckwhet
hert
hepackagei
s
i
nst
all
edornot
)
#f
inger<username> (
tocheckwhet
hert
hei
nst
all
edpackage
i
swor
kingornot
)
#r
pm -
e <packagename> (
toer
aseorr
emov
eoruni
nst
all
the
package)

Rat
nakar
Page96
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#r
pm -
evv <packagename> (
tor
emov
ethepackagei
nver
bosemode)
#r
pm -
-t
est -
iv
h (
tot
estt
hepackagebef
orei
nst
all
i
ngi
e.,
whet
hert
he
packagei
ssui
tabl
eornot
)
#r
pm -
qi <packagename> (
toseet
hedet
ail
sori
nfor
mat
ionont
he
i
nst
all
edpackage)
#r
pm -
ql <packagename> (
tol
i
stal
lpackager
elat
edf
il
es)
#r
pm -
qlc <packagename> (
tol
i
stal
ltheconf
igur
ati
onf
il
esoft
hat
package)
#r
pm -
qd <packagename> (
tol
i
stal
lthedocumentf
il
esoft
hat
package)
#r
pm -
ivh <packagename> -
-f
orce (
toi
nst
all
thepackagef
orcef
ull
y)
#r
pm -
qR <packagename> (
tol
i
stt
hedependenci
esoft
hatpackage)
#r
pm -
qip <packagef
ull
name> (
todi
spl
ayt
hepackage
i
nfor
mat
ionbef
orei
nst
all
ati
on)
#whi
ch <commandname> (
todi
spl
ayt
hel
ocat
ionoft
hatcommand)
#r
pm -
qf <l
ocat
ionoft
hecommand> (
tocheckt
hepackagenamef
or
t
hatcommand)
#r
pm -
V <packagename> (
tov
eri
fyt
hatpackage,
ie.
,100%
packagei
sther
eornot
,if anyf
il
es
mi
ssedi
nthatpackage,
thosear
edi
spl
ayedasal
i
st)
#r
pm -
ivh <packagename> -
-r
epl
acepkgs(
tor
epl
acet
hemi
ssedf
il
esi
nthat
package)
#r
pm -
qp -
-changel
og <packagename>(
displ
aysal
lthechangedl
ogsl
i
kel
at
t
ime,
whent
hepackage
i
sinst
all
ed,
..
..
.et
c.,
)
#r
pm -
qp -
-scr
ipt
s <packagename> (
toseet
hepackagei
nst
all
ati
on
scr
ipt
s)
#r
pm -
K <packagef
ull
name> (
toseet
hepackagekey
)
#r
pm -
Uvh <packagename> (
toupdat
ethepackage)
* Updat
eisov
erwr
it
etheol
dver
sionoft
hepackage.I
fanypr
obl
emsi
nnewpackage,
wecannotsol
vet
hose i
ssues.So,
thebet
teronei
sinst
all
thatpackageasaf
reshone
(
notupdat
eopt
ion)
.
* Updat
ewi
l
llookf
ir
stt
hepackagei
sav
ail
abl
eint
hatsy
stem ornot
.Ifi
tisav
ail
abl
e,
i
twi
l
lupdat
ethatpackageot
her
wisei
twi
l
linst
all
asf
reshpackage.
#r
pm -
qRp <packagename> (
tocheckt
hedependencypackagesof
t
hatpackagebef
orei
nst
all
)
#r
pm -
ivh <packagename> -
-nodeps (
toi
nst
all
thepackagewi
thout
dependentpackages)
8. Whati
syum andexpl
aint
hey
um?

Rat
nakar
Page97
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

y
um st
andsf
ory
ell
owdogupdat
ermodi
fi
ed.y
um i
sapackagemanagement
appl
i
cat
ionf
orcomput
ersr
unni
ngonLi
nuxO/
S.y
um i
sast
andar
dmet
hodofmanagi
ng
t
hei
nst
all
ati
onandr
emov
alofsof
twar
e.I
tisf
rom RHEL-5onwar
ds.Packagesar
e
downl
oadedf
rom col
l
ect
ionscal
l
edr
eposi
tor
ies,
whi
chmaybeonl
i
ne,
onanet
wor
kand
oroni
nst
all
ati
onmedi
a.y
um i
saf
rontendt
ool
forr
pm.I
tisusedt
oresol
vet
he
dependencywhi
chcannotbedonebyr
pm.They
um commandhasaccesst
he
r
eposi
tor
ywher
ethepackagesar
eav
ail
abl
eandcani
nst
all
,updat
e/upgr
ade,
remov
e
andquer
ythepackagesaut
omat
ical
l
y.
9. Whatar
ethei
mpor
tantf
il
est
hatar
erel
atedt
oyum?
/
etc/
yum.
conf -
--
--
>ist
hey
um conf
igur
ati
onf
il
e.
/
etc/
yum.
repos.
d -
--
--
>ist
hedi
rect
orywhi
chcont
ainst
hey
um r
eposi
tor
y
conf
igur
ati
onf
il
e.
/
etc/
yum.
repos.
d/xxxxx.
repo -
--
--
->i
sthey
um r
eposi
tor
yconf
igur
ati
onf
il
e.
/
var
/li
b/y
um -
--
--
>ist
hedi
rect
orywhi
chcont
ainst
hey
um dat
abases.
/
var
/log/
yum.
log -
--
--
>ist
hef
il
ewhi
chst
orest
hey
um l
ogmessages.
10.Howset
upt
hey
um ser
ver
?
(
i)I
nser
ttheRHELDVD,
got
othatdi
rect
oryandi
nst
all
thev
sft
pdpackageby#r
pm -
i
vh v
sft
pd*
(
ii
)Got
o/v
ar/
ftp/
pubdi
rect
oryandcr
eat
erhel
6di
rect
oryby#mkdi
rrhel
6
(
ii
i) Got
oDVDmount
eddi
rect
oryandcopyal
ltheDVDcont
enti
nto
/
var
/ft
p/pub/
rheldi
rect
oryby
#cp -
rvpf /
medi
a/DVD/ /
var
/ft
p/pub/
rhel
6
(
iv)Rest
artt
hev
sft
pdser
viceby#ser
vicev
sft
pdr
est
artcommand.
(
v)Thenenabl
ethev
sft
pdser
viceby#chkconf
igv
sft
pdon command.
(
vi)Got
o/et
c/y
um.
repos.
d di
rect
oryandcr
eat
eoney
um r
eposi
tor
yfi
l
eby#v
im
l
inux.
repo command.
(
vii
)Int
heabov
efi
l
ethecont
ent
sar
easbel
ow,
[
li
nux] (
Linuxr
epoi
d)
name=y
um r
eposer
ver (
yum ser
vername)
baseur
l=f
il
e:/
//v
ar/
ftp/
pub/
rhel
6 orbaseur
l=f
tp:
//<I
Paddr
essoft
he
sy
stem>/
pub/
rhel
6
gpgcheck=0 (
0meanswhi
l
einst
all
i
ngi
twi
l
lnotask
anysi
gnat
urekey
sof y
um packages,
Ifi
tis1,
theni
twi
l
laskt
he
si
gnat
urekey
swhi
l
einst
all
i
ngt
hepackages)
+98u enabl
ed=1 (
ifmul
ti
pler
eposi
tor
iesar
ether
e,
t
henenabl
ethi
sonl
y)
(
sav
eandex
itt
hisf
il
e)
(
vii
i
)#y
um cl
eanal
l (
tocl
eant
heol
doneupdat
ethenew
r
eposi
tor
y)
(
ix) #y
um r
epol
ist (
itdi
spl
aysno.ofpackagesi
n

Rat
nakar
Page98
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
hatr
eposi
tor
y)
11.Howt
oset
upt
hey
um cl
ient
?
(
i)Got
o/et
c/y
um.
repos.
d di
rect
oryandcr
eat
ether
eposi
tor
yfi
l
eby #v
im
l
inux.
repo
(
ii
)Ty
pet
heent
ri
esasbel
ow,
[
li
nux] (
Linuxr
epoi
d)
name=y
um r
epocl
i
ent (
yum r
epocl
i
ent
)
baseur
l=f
tporht
tp:
//<I
Paddr
essoft
heser
ver
>/pub/
rhel
6
gpgcheck=0 (
0meanswhi
l
einst
all
i
ngi
twi
l
lnotask
anysi
gnat
urekey
sof y
um packages,
Ifi
tis1,
theni
twi
l
laskt
he
si
gnat
urekey
swhi
l
einst
all
i
ngt
hepackages)
enabl
ed=1 (
ifmul
ti
pler
eposi
tor
iesar
ether
e,t
henenabl
ethi
sonl
y)
(
sav
eandex
it)
(
ii
i)#y
um cl
eanal
l (
tocl
eant
heol
doneupdat
ethenew
r
eposi
tor
y)
(
iv) #y
um r
epol
ist (
itdi
spl
aysno.ofpackagesi
n
t
hatr
eposi
tor
y)
12.Howt
oconf
igur
ethey
um r
eposi
tor
ytodenysomepackagest
obei
nst
all
ed?
(
i)Toconf
igur
ethey
um t
ool
they
um conf
igur
ati
onf
il
eis/
etc/
yum.
conf
(
ii
)Todenysomepackages,
opent
hey
um conf
igur
ati
onf
il
eby #v
im /
etc/
yum.
conf
command.
(
ii
i)Got
olastl
i
neandt
ypeas,excl
ude=*
(al
l
)ker
nel
*ft
p* t
hensav
eandexi
tthi
sfi
l
e.
(
iv)Thenker
nel
*and f
tp* packageswi
l
lbedeni
edwhenwet
ryi
ngt
oinst
all
those
packages.
13.Howt
ochanget
hey
um r
eposi
tor
ydef
aul
tlocat
ion?
(
i)Openy
um conf
igur
ati
onf
il
eby #v
im /
etc/
yum.
conf command.
(
ii
)Got
olastl
i
neandt
ypeas,r
eposi
tor
y=<y
um r
eposi
tor
ynewl
ocat
ionwi
thf
ull
pat
h>
t
hensav
eandexi
t t
hisf
il
e.
(
ii
i)Thent
hey
um r
eposi
tor
ynewl
ocat
ionwi
l
lbechangedf
rom ol
donenewone.
14.Howt
ochanget
hey
um l
ogf
il
edef
aul
tlocat
ion?
(
i)Opent
hey
um conf
igur
ati
onf
il
eby #v
im /
etc/
yum.
conf command.
(
ii
)Got
olastl
i
neandt
ypeas,l
og=<y
um l
ogf
il
enewl
ocat
ionwi
thf
ullpat
h> t
hen
sav
eandexi
tthi
sfi
l
e.
(
ii
i)Thent
hedef
aul
tlogl
ocat
ioni
schangedf
rom /
var
/log/
yum.
log f
il
etonew
l
ocat
ion.
15.Howt
oconf
igur
ethey
um t
orest
ri
ctt
hear
chi
tect
ure(
64bi
tor32bi
t)et
c.,
?
(
i)Opent
hey
um conf
igur
ati
onf
il
eby #v
im /
etc/
yum.
conf command.
(
ii
)Got
olastl
i
neandt
ypeas, exact
arch=1 t
hensav
eandexi
tthi
sfi
l
e.
(
ii
i)1meansf
ir
sti
tinst
all
s64bi
tpackages and i
fiti
s0t
hen32bi
tpackageswi
l
lbe
i
nst
all
ed.

Rat
nakar
Page99
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
iv) Opent
hey
um conf
igur
ati
onf
il
eby #v
im /
etc/
yum.
conf command.
(
v)Got
olastl
i
neandt
ypeas, cachedi
r=<downl
oadnewl
ocat
ion> t
hensav
eand
exi
tthi
sfi
l
e.
(
vi) Thenwhenev
erwei
nst
all
thepackagest
hedownl
oadedl
ocat
ionwi
l
lbet
he
newl
ocat
ion.
(
vii
)Opent
hey
um conf
igur
ati
onf
il
eby #v
im /
etc/
yum.
conf command.
(
vii
i
)Got
olastl
i
neandt
ypeas,assumey
es=1 t
hensav
eandex
itt
hisf
il
e.
(
ix)Whenev
erwei
nst
all
anypackageusi
ngy
um t
hennoneedt
oment
ion-
yopt
ioni
f
assumey
es=1andi
f assumey
es=0 t
henwehav
etoment
ion-
yopt
ionwhenwe
i
nst
all
thepackage.
16.Whati
sO/
Spat
chandhowt
oaddt
hosepat
chesonpr
oduct
ionser
ver
sorhowt
o
upgr
adet
heker
nel
?
(
i)O/
Spat
chi
snot
hingbutupdat
ethenewker
nel
.Nor
mal
l
yO/
Spat
chi
ssof
twar
ethat
cont
ainssome pr
ogr
amst
ofi
xthebugsi
nO/
Sie.
,i
nker
nel
.
(
ii
)Ifourser
veri
sregi
ster
edandconf
igur
edi
nRedHatnet
wor
k,t
henwewi
l
lgett
he
i
nfor
mat
ionaboutt
hat updat
edker
nel
sinf
ormat
ionandt
hendownl
oadt
hatker
nel
updat
ions.
(
ii
i)Ev
eryO/
Spat
chi
ssuppl
i
edwi
thadocumentaboutpr
e-r
equi
sit
est
oappl
ythatpat
ch.
(
iv)Checkt
hepr
e-r
equi
sit
es,
spacer
equi
rement
sandot
her
s.i
fal
lar
eok,
(
v)Thenwet
aket
hebusi
nessappr
oval
andmakeCRQ'
s(Changer
equest
s).
(
vi)Thent
hepr
ojectmanagerwi
l
lini
ti
atet
hemai
lthr
eadi
e.,
sendi
ngt
hemai
lor
messagest
ovar
ioust
eams whoar
edeal
i
ngwi
tht
hatser
ver
.
(
vii
)Wegett
her
esponsef
rom di
ff
erentt
eamswhi
char
einv
olv
ingi
nthi
spr
ocess.
(
a)Forexampl
eMoni
tor
ingt
eam t
oignor
eal
ert
sfr
om t
hatser
veri
fthesy
stem
hangsorr
eboot
ed.
(
b)DBAt
eam i
fdat
abasest
oppedorcr
ashedorsy
stem f
ail
ed.
(
c)Appl
i
cat
iont
eam i
ftheappl
i
cat
ionef
fect
swhi
l
epat
chi
ng.
(
vii
i
)Ift
heser
veri
sincl
ust
er,
thenmov
etheser
vicegr
oupandr
esour
cest
oanot
her
sy
stemsmanual
l
ycal
l
ed swi
tchov
er.
(
ix) I
nfor
mtheAppl
i
cat
iont
eam t
ost
opt
heappl
i
cat
ionanddat
abaset
eam t
o
st
opt
hedat
abase.
(
x)I
ftheser
veri
sincl
ust
ert
her
eisnoneedofr
eboot(
nodownt
ime)el
sedownt
ime
neededt
oreboot
.
(
xi)Checkt
her
ootdi
ski
sinnor
mal
fil
esy
stem orVxVM.
(
xii
)Ifmi
rr
ordi
ski
sther
e,spl
i
tthemi
rr
ordi
skf
rom or
igi
nal
diskandbooti
nsi
ngl
euser
modeandaddt
hepat
ch by #r
pm -
ivh <pat
chname> command.
(
xii
i
)Thenr
eboott
hesy
stem andwon'
tat
tacht
hemi
rr
ordi
skt
oav
oidanyunexpect
ed
si
tuat
ionsorpr
obl
ems andputt
hatser
verundert
estupt
o1weekor10day
s
dependi
ngont
hecompany
'spol
i
cy.
(
xiv
)Af
tert
het
estper
iod,
ift
her
eisnopr
obl
emsr
aisedt
henat
tacht
hesy
stem i
nli
ve

Rat
nakar
Page100
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

modeandal
sowi
th mi
rr
ordi
skt
osy
nct
hedat
atoupdat
ethesy
stem.
(
xv)Thenwei
nfor
mtheAppl
i
cat
ion,
Dat
abase,Moni
tor
ingandot
hert
eamswhoar
e
deal
i
ngwi
tht
hatser
ver t
otestappl
i
cat
ion,
dat
abase,
moni
tor
ingandot
her
sseet
he
st
atus.
(
xvi
)Thenf
inal
l
ycl
oset
hei
ssueorCRQ.
17.Af
teri
nst
all
ati
onofpackageorpat
chi
fthepackageorpat
chi
sremov
edt
henwhatwi
ll
happened?
(
i)I
fker
nel
pat
chi
sremov
ed,
thent
hesy
stem wi
l
lhangandf
orot
her
sther
eisnoef
fect
.
(
ii
)Ifpackagei
sremov
edt
hent
heappl
i
cat
iont
hatbel
ongst
othatr
emov
edpackage
wi
l
lef
fect
.
18.Af
terappl
yi
ngt
hepat
chneedt
oreboott
hesy
stem ornot
?
(
i)I
fthepat
chi
sker
nel
pat
chorcl
ust
eredpat
cht
henonl
ythesy
stem r
ebooti
s
r
equi
red.
(
ii
)Ift
hepat
chi
snor
mal
pat
cht
hent
her
eisnoneedoft
her
ebootr
equi
red.
19.I
fthepackagei
snoti
nst
all
ing.Howt
otr
oubl
eshoot
?
(
i)Checkt
hepackagepr
e-r
equi
sit
est
oinst
all
thepackage.
(
ii
)Ifpr
e-r
equi
sit
esar
enotmat
chedwi
thoursy
stem,
thent
hepackagewi
l
lnotbe
i
nst
all
edi
.e.
,O/
S compat
ibi
l
ityt
oinst
all
thatpackage.
(
ii
i)I
fther
eisnosuf
fi
cientspacei
nthesy
stem,
thepackagewi
l
lnotbei
nst
all
ed.
(
iv)I
fthepackagei
snotpr
oper
lydownl
oaded,
thent
hepackagewi
l
lnotbei
nst
all
ed.
20.I
fthepat
chi
snotappl
iedsuccessf
ull
ywhatwi
lly
oudo?
(
i)Checkwhet
hert
hepat
chi
sinst
all
edpr
oper
lyornotby#r
pm -
qa <pat
chname>
command.
(
ii
)Checkt
he/
var
/log/
yum.
log f
il
etov
eri
fyorseewhyt
hepat
chi
snotsuccessf
ull
y
i
nst
all
ed.
(
ii
i) I
fanypossi
blet
oresol
vedt
hosei
ssues,
resol
veandr
emov
ethatpat
chwi
th
#r
pm -
e <pat
chname> command.
(
iv)I
fanyr
eboot
srequi
redt
oef
fect
,thenr
eboott
hesy
stem.
(
v)Agai
naddt
hatpat
chby #r
pm -
ivh <pat
chname> command.
(
vi)Thencheckt
hepat
chby#r
pm -
qa <pat
chname> command
Ot
herusef
uly
um commands:
#y
um r
epoi
nfo (
tol
i
stal
lthei
nfor
mat
iononal
lthe
r
eposi
tor
ies)
#ay
um r
epoi
nfo <r
epoi
d> (
tol
i
stal
lthei
nfor
mat
iononspeci
fi
ed
r
eposi
tor
y)
#y
um i
nst
all<packagename> -
y (
todownl
oadandi
nst
all
thepackage
and ymeansy
es)
#y
um i
nst
all<packagename> -
d (
todownl
oadt
hepackage)
#y
um er
ase orr
emov
e<packagename> -
y (
tor
emov
eoruni
nst
all
the
packageand ymeansy
es)

Rat
nakar
Page101
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#y
um l
i
sti
nst
all
ed (
todi
spl
ayt
hel
i
stofal
li
nst
all
ed
packages)
#y
um l
i
stav
ail
abl
e (
tol
i
stal
ltheav
ail
abl
epackagest
obe
i
nst
all
ed)
#y
um l
i
stal
l|l
ess (
tol
i
stal
lthei
nst
all
edandnot
i
nst
all
edpackages)
#y
um sear
ch<packagename> (
tosear
chapar
ti
cul
arpackagei
s
av
ail
abl
eornot
)
#y
um i
nfo <packagename> (
todi
spl
ayt
hei
nfor
mat
ionont
hat
package)
#y
um updat
e <packagename> (
ift
heupdat
ever
sionoft
he
speci
fi
edpackagei
sav
ail
abl
e,
t
henupdat
ethatpackage)
#y
um updat
eal
l (
toupdat
eal
lthepackagesnot
hingbutwhol
e
sy
stem wi
l
lbeupdat
ed)
#y
um downgr
ade <packagename>(
tor
ever
tbacki
e.,
gobackt
opr
evi
ousv
ersi
onof
t
hatpackagei
fnew
v
ersi
oni
snotwor
kingpr
oper
ly)
#y
um hi
stor
y (
todi
spl
ayt
hey
um hi
stor
y)
#y
um hi
stor
yinf
o <i
d> (
todi
spl
ayt
hei
nfor
mat
ionof
t
hathi
stor
yid)
#y
um hi
stor
yundo <i
d> (
tor
emov
ethathi
stor
yid)
#y
um hi
stor
yundo <i
d> (
tor
edot
heabov
eremov
edhi
stor
yid)
#y
um gr
oupl
i
st (
todi
spl
ayt
hel
i
stofgr
ouppackages)
#y
um gr
oupi
nst
all <packagename> (
toi
nst
all
thegr
ouppackage)
#y
um i
nst
all
@<gr
ouppackagename> (
toi
nst
all
thegr
ouppackagei
nanot
her
way
)
#y
um gr
oupi
nfo <gr
ouppackagename> (
todi
spl
ayt
hegr
ouppackage
i
nfor
mat
ion)
#y
um gr
oupl
i
sthi
dden (
tol
i
stal
lthegr
ouppackagesnames
i
ncl
udi
ngi
nst
all
edor not
i
nst
all
edandhi
ddengr
ouppackages)
#y
um-
conf
ig-
managerdi
sabl
erepo=<r
epoi
d> (
todi
sabl
ethey
um r
eposi
tor
y.So,
we
cannoti
nst
all
any

packagef
rom t
her
eposi
tor
y)
#y
um cl
eanal
l(t
ocl
eart
hehi
stor
y,i
fwedi
sabl
ether
eposi
tor
yid,
thenwehav
eto
cl
eant
hehi
stor
y,t
hen
onl
yitwi
l
ldi
sabl
ether
eposi
tor
y)
#y
umdownl
oader <packagename> (
todownl
oadt
hepackagef
rom t
he

Rat
nakar
Page102
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
eposi
tor
y,andt
he
downl
oadedl
ocat
ioni
sthepr
esentwor
kingdi
rect
ory
)
#many
um.
conf (
toseet
hemanual
pagesony
um
conf
igur
ati
onf
il
e)
#y
um-
conf
ig-
manager-
-add-
repo=ht
tp:
//cont
ent
.ex
ampl
e.com/
rhel
7.0/
x86_
64/
dvd
(
thent
hey
um r
eposi
tor
ywi
l
lbecr
eat
edaut
omat
ical
l
y
wi
th.
repof
il
eal
so.Andt
hiswor
ksonl
yinRHEL-7)
#subscr
ipt
ion-
manager r
egi
ster-
-user
name=<username> -
-
passwor
d=<passwor
d> (
tor
egi
sterour pr
oductwi
thRHN-
-RedhatNet
wor
k.The
usernameandpasswor
dswi
l
lbepr
ovi
dedbyt
heRedhatwhenwe pur
chaset
he
sof
twar
e)
#subscr
ipt
ion-
manager unr
egi
ster-
-user
name=<username> -
-
passwor
d=<passwor
d> (
tounr
egi
sterour pr
oductwi
thRHN-
-RedhatNet
wor
k.The
usernameandpasswor
dswi
l
lbepr
ovi
dedbyt
heRedhatwhenwe pur
chaset
he
sof
twar
e)

11.BackupandRest
ore

1. Whati
sbackupandwhati
spur
poseoft
hebackup?
Copy
ingf
il
esf
rom l
ocal
diskt
oanyr
emov
abl
emedi
aiscal
l
edbackup.
I
ninf
ormat
iont
echnol
ogy
,abackuport
hepr
ocessofbacki
ngupi
smaki
ngcopi
esof
dat
awhi
chmaybeusedt
orest
oret
heor
igi
nal
aft
eranev
entofdat
aloss.Backuphas
t
wodi
sti
nctpur
poses.
Thepr
imar
ypur
posei
stor
ecov
erdat
aaf
teri
tsl
ossduet
odel
eti
onorcor
rupt
ion.Dat
a
l
ossi
sver
ycommoni
nITi
ndust
ry.
Thesecondpur
poseofbackupi
stor
ecov
erdat
afr
om anear
li
ert
ime.

Rat
nakar
Page103
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Backupi
sthemosti
mpor
tantj
obofasy
stem admi
nist
rat
or,
asasy
stem admi
niti
sour
dut
ytot
akebackupoft
hedat
aev
eryday
.Mostcompani
eshav
egoneoutoft
hemar
ket
becauseofpoorbackuppl
anni
ngorpol
i
cy.
2. Whati
srecov
eryorr
est
ore?
Copy
ingf
il
esf
rom anyr
emov
abl
emedi
atol
ocal
diski
scal
l
edr
ecov
eryorr
est
ore.
Backupwi
l
lbehel
pedi
nhar
dwar
efai
l
ureorsof
twar
efai
l
ureorsy
stem cr
ashed.
3. Whatar
ethebackupt
ool
sav
ail
abl
eint
heI
Tindust
ry?
Pl
atf
orm BackupTool
s
Wi
ndows nt
backup
Li
nux t
ar,
cpi
o,dd,
dump,
rest
ore
3r
dpar
ty Ver
it
asnet
backup,
AmandaandTi
vol
i
4. Whati
starandExpl
aini
torhowt
otakeabackupusi
ngt
ar?
Ar
chi
vi
ngmeanscol
l
ect
ionoff
il
esanddi
rect
ori
esandt
omakeasi
ngl
efi
l
enot
hingbut
compr
essi
on.t
armeanst
apear
chi
vi
ng.I
tisanar
chi
vef
il
e.Byusi
ngt
arcommandwe
cant
akeabackupoff
il
esanddi
rect
ori
es.I
tcannotsuppor
tfi
l
esy
stemsbackupand
al
sonotsuppor
tforl
argef
il
esmor
ethan80GB.t
arwi
l
lnotski
panysi
ngl
efi
l
eincl
udi
ng
badbl
ocksal
so.
Ful
lsy
ntaxoft
ar:
#t
ar <opt
ions><dest
inat
ionf
il
enamewi
thpat
h><sour
cef
il
eordi
rect
orywi
thpat
h>
Theopt
ionsar
e,-
c--
--
-> cr
eat
e
-
v--
--
->v
erbose
-
f--
--
->f
il
ename
-
t--
--
->l
i
sti
ng
-
tv-
--
->l
ongl
i
sti
ng
-
x--
--
-> ext
ract
-
w--
--
>int
eract
ive
-
C--
--
-> speci
fi
clocat
ion (
Capi
talC)
-
u--
--
-> updat
emeansaddi
ngnewcont
ent
stot
heex
ist
ingt
arf
il
e
-
-updat
e -
--
--
> " "
-
-del
ete -
--
--
> del
etest
hecont
ent
sfr
om t
het
arf
il
e
-
p--
--
> pr
eser
vet
heol
dper
missi
onsoft
hef
il
es/
dir
ect
ori
eswhen
ext
ract
ingt
het
arf
il
e
-
z--
--
> gzi
p(gunzi
p)compr
essi
on
-
j--
--
> bzi
p2(
bunz
ip)compr
essi
on
-
J--
--
>xzcompr
essi
on (
from RHEL-7)

Exampl
es:
#t
ar-
cvf/
root
/et
c.t
ar /
etc/
* (
tocopyal
lthef
il
esanddi
rect
ori
es
f
rom /
etcandmakeasi
ngl
efi
l
e

Rat
nakar
Page104
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

andpl
acei
nthe/
root
/et
c.t
arf
il
e)
#t
ar-
tvf/
root
/et
c/t
ar (
tol
ongl
i
sti
ngt
hecont
ent
soft
he/
root
/et
c.t
ar
f
il
e)
#t
ar-
xvf/
root
/et
c.t
ar -
C /
root
1/ (
toext
ractandcopyt
hef
il
esi
n/r
oot
1/
l
ocat
ion)
#t
ar-
xf/
root
/et
c.t
ar (
tol
i
stt
hecont
ent
soft
het
arf
il
e)
#t
ar-
f /
root
/et
c.t
ar -
-updat
e or-
u <f
il
enameordi
rect
ory
>(t
oaddt
henew
cont
ent
stot
heexi
sti
ng
t
arf
il
e)
#t
ar-
f /
root
/et
c.t
ar -
-del
ete <f
il
ename ordi
rect
ory
> (
todel
etet
hef
il
e
f
rom t
het
ar)
#t
ar-
u /
root
/et
c.t
ar /
var (
toaddt
he/
varcont
ent
sint
othe
/
root
/et
c.t
arf
il
e)
#t
ar-
cvf my
tar
.t
ar /-
-xat
trs (
toar
chi
vet
hecont
ent
sal
ongwi
th
SELi
nuxandACLper
missi
ons)
#du -
h /
root
/et
c.t
ar (
toseet
hesi
zeoft
het
arcompr
essedf
il
e)
5. Whatar
ethecompr
essi
ng& uncompr
essi
ngt
ool
sav
ail
abl
efort
arandexpl
aint
hem?
Compr
essi
ngTool
s Uncompr
essi
ngTool
s
#gzi
p(.
gz) #gunzi
p
#bzi
p2 (
.bz2) #bunzi
p2
#xz (
RHEL-7) #unxz
#gzi
p <t
arf
il
ename> (
tocompr
esst
hesi
zeoft
het
arf
il
eandt
he
out
putf
il
eis.
tar
.gz)
#gunzi
p <.
gzcompr
essedf
il
ename> (
touncompr
esst
hecompr
essedt
arf
il
e
andt
heout
puti
s.t
aronl
y)
#bzi
p2 <t
arf
il
ename> (
tocompr
esst
hesi
zeoft
het
arf
il
eand
t
heout
puti
s.t
ar.
bz2)
#bunzi
p2 <.
bz2compr
essedf
il
ename> (
touncompr
esst
hecompr
essedf
il
eand
t
heout
puti
s.t
aronl
y)
6. Whati
sscp,
rsy
ncandhowt
ousei
t?
scpmeans secur
ecopy
.ie.
,ssh+cp=scpwhi
chi
susedt
ocopyt
he
f
il
es/
dir
ect
ori
esi
ntor
emot
esy
stem.
scpwi
l
lcopyf
il
es/
dir
ect
ori
esi
ntor
emot
esy
stem bl
i
ndl
yie.
,i
fthef
il
eal
readyexi
ts,
it
wi
l
lov
erwr
it
ethatf
il
e.
So,
scpwi
l
ltakemor
eti
met
ocopywhencompar
edt
o#r
synct
ool
.
#scp <f
il
ename><username>@ <I
Paddr
essoft
her
emot
esy
stem>:
<l
ocat
iont
obe
copi
ed>
#scp anaconda* r
oot
@192.
168.
1.1:
/r
oot (
tocopyanacondaf
il
eint
o/r
ootoft
he
r
emot
esy
stem)
#scp -
r/et
c/ r
oot
@192.
168.
1.1:
/r
aju (
tocopy /
etc/ di
rect
oryi
nto

Rat
nakar
Page105
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

/
raj
uofr
emot
esy
stem)
#scp -
av /
raj
uroot
@192.
168.
1.1:
/r
oot (
tocopy /
raj
uint
o/r
ootoft
he
r
emot
esy
stem)
#scp -
rroot
@192.
168.
1.1:
/et
c /
home (
tocopy /
etc oft
her
emot
esy
stem
i
nto /
homeoft
he
l
ocal
syst
em)
r
synci
sal
sousedt
ocopyf
il
es/
dir
ect
ori
esi
ntor
emot
esy
stems.r
synct
ool
wil
l
compar
ethenewf
il
esordi
rect
ori
esandcopyonl
ythechangedormodi
fi
edcont
ent
sof
t
hef
il
esi
ntor
emot
esy
stem.So,
itt
akesl
esst
imet
ocopywhencompar
edt
o #scp
t
ool
.
#r
sync -
av r
oot
@192.
168.
1.1:
/et
c /
home(
tocopy /
etc di
rect
orychanged
cont
ent
sint
o/home)
r
syncopt
ionsar
e,-
a -
--
--
> al
l(copyt
hef
il
ewi
thal
lper
missi
onsexceptSELi
nux
andACLper
missi
ons)
-
aA -
--
--
>sy
nchr
oni
ze ACLper
missi
ons
-
aAx-
--
-> sy
nchr
oni
ze ACLandSELi
nuxper
missi
onsal
so.
7. Whati
scpi
oandhowt
otakeabackupandr
est
oreusi
ngcpi
o?
cpi
omeanscopyi
nputandout
put
.Itsuppor
tsanysi
zeoft
hef
il
esy
stem.I
tski
pst
he
badbl
ocksal
so.
Sy
ntaxofcpi
owi
thf
ullopt
ions:
#l
s<sour
cef
il
ename>|
cpi
o <opt
ions>><dest
inat
ionf
il
ename> (
tot
akeabackup
oft
hesour
ce di
rect
oryand
st
oredt
hebackupi
ntodest
inat
iondi
rect
ory
)
Theopt
ionsar
e,-
t -
--
--
> t
oli
stt
hecpi
ocont
ent
s
-
i -
--
--
> t
orest
oret
hecpi
obackup
-
v -
--
--
> t
odi
spl
ayont
hescr
eeni
e.,
ver
bose
-
o -
--
--
> t
otakeabackup
Exampl
es:
#l
s|cpi
o-ov > /
opt
/root
.cpi
o (
tot
akeabackupofr
oot
di
rect
oryandst
oredi
n/opt)
#cpi
o-i
v </
opt
/root
.cpi
o (
tor
est
oret
hebackup)
#l
s/et
c|cpi
o -
ov > /
opt
/et
c.cpi
o (
tot
akeabackupoft
he/
etc
di
rect
oryandst
oredi
n/opt
)
#cd/
etc (
got
othat/
etc di
rect
ory
)
#r
m -
rf* (
tor
emov
eal
lthecont
ent
sfr
om /
etc)
#cpi
o -
iv </
opt
/et
c.cpi
o (
tor
est
oret
he /
etc cont
ent
sfr
om t
he
cpi
obackup)
8. Whati
sddandhowt
otakeabackupandr
est
oreusi
ng dd?
dd meansdi
sk t
o di
sk backup.Usi
ng dd commandwecant
akeabackupoft
he
dat
afr
om onedi
skt
oanot
herdi
sk.I
tcopi
est
hedat
ainby
tet
oby
te.I
tcant
akea

Rat
nakar
Page106
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

backupoft
hedi
ski
ncl
udi
ngbadbl
ocks.
#dd i
f=<di
sk1> of=<di
sk2> (
tot
akeabackupf
rom di
sk1
andst
oresi
ndi
sk2)
#dd i
f=/
dev
/zer
o of=/
root
/raj
u bs=1M count=2048 (
tocr
eat
ean
empt
yfi
l
ewi
th2GBsi
ze)
#dd i
f=/
dev
/sda of=/
root
/mbr
.bak bs=1 count=512 (
tot
aket
he
backupof/
dev
/sda Mast
er
BootRecor
d)
#dd i
f=/
root
/mbr
.bak of=/
dev
/sdb (
tor
est
oret
heMBR f
rom backupt
o
seconddi
sk/
dev
/sdb)
#dd i
f=/
dev
/sda1 of=/
dev
/sdb1 (
tot
akeabackupoft
heent
ir
e
/
dev
/sda1di
skpar
ti
ti
on)
#dd i
f=/
dev
/sdb1 of=/
dev
/sda1 (
tor
est
oret
he/
dev
/sda1cont
ent
s
f
rom t
heabov
ebackup)
#dd i
f=/
dev
/sda of=/
dev
/sdb (
tot
akeabackupoft
heent
ir
e
/
dev
/sdadi
ski
nto/
dev
/sdb)
#dd i
f=/
dev
/cdr
om of=/
root
/rhel
6.i
so (
tocr
eat
eaI
SOi
magef
il
eoft
he
CD/
DVD)
9. Whati
sdumpandhowt
otakeabackupandr
est
oreusi
ng dumpandr
est
ore?
dumpi
sacommandusedt
otakeabackupoff
il
esy
stemsonl
y.Wecannott
akea
backupoff
il
esanddi
rect
ori
es.Wecannott
akeabackupofdi
skt
odi
skbackup.I
tis
notr
ecommendedt
otakeabackuponmount
edf
il
esy
stems.So,
unmountt
hef
il
e
sy
stem andt
hent
akeabackupi
srecommended.Bydef
aul
tdumpi
snotav
ail
abl
eint
he
sy
stem.so,
fir
sti
nst
all
thedumppackageandt
henexecut
ethedumpcommands.
#y
um i
nst
alldump*-
y (
toi
nst
all
thedumppackage)
Thesy
ntaxf
ordump:
#dump<opt
ions><dest
inat
ionf
il
ename><sour
cef
il
ename>(
tot
akeabackupoft
he
f
il
esy
stems)
Theopt
ionsar
e,-
0--
--
->f
ull
backup
-
(1-9) -
--
--
> i
ncr
ement
albackups
-
u -
--
--
> updat
ethe/
etc/
dumpdat
es f
il
eaf
tersuccessf
uldump
-
v -
--
--
> v
erbose
-
f -
--
--
>maket
hebackupi
naf
il
e
-
e -
--
--
> excl
udei
nodenumberwhi
l
ebacki
ngup
#dump -
0uv
f /
opt
/ful
l
.dump/
coss (
tot
akeaf
ull
backupoft
he/
cossf
il
esy
stem
andcopi
edi
tin/
opt
)
#dump -
1uv
f /
opt
/ful
l
.dump/
coss (
tot
akeabackupmodi
fi
edf
il
esf
rom t
hel
ast
f
ull
backupnot
hing
buti
ncr
ement
albackup)
#dump -
2uv
f /
opt
/ful
l
.dump/
coss (
tot
akeabackupmodi
fi
edf
il
esf
rom t
hel
ast

Rat
nakar
Page107
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

i
ncr
ement
all
evel
-1
backup)
Thesy
ntaxf
orr
est
ore:
#r
est
ore <opt
ions><dumpbackupf
il
e> (
tor
est
oret
hebackupcont
ent
sift
hat
dat
aisl
ost
)
Theopt
ionsar
e,-
f -
--
--
> usedt
ospeci
fyt
hedumporbackupf
il
e
-
C -
--
--
> usedt
ocompar
ethedumpf
il
ewi
thor
igi
nal
fil
e
-
v -
--
--
> v
erbose
-
e -
--
--
> excl
udet
hei
nodenumber
-
i -
--
--
> r
est
orei
nint
eract
ivemode
Thecommandsi
nint
eract
ivemodear
e,
r
est
ore> l
s -
--
--
> l
i
stt
hef
il
esanddi
rect
ori
esi
nthebackupf
il
e
r
est
ore>add-
--
-> addt
hef
il
esf
rom dumpf
il
etocur
rentwor
kingdi
rect
ory
r
est
ore>cd -
--
--
> changet
hedi
rect
ory
r
est
ore>pwd-
--
> di
spl
ayst
hepr
esentwor
kingdi
rect
ory
r
est
ore>ex
tract-
--
-> ext
ractt
hef
il
esf
rom t
hedumpf
il
e
r
est
ore>qui
t--
-> t
oqui
tfr
om t
hei
nter
act
ivemode
#r
est
ore -
tf /
opt
/ful
l
.dump (
tol
i
stt
hedumpf
il
econt
ent
s)
#r
est
ore -
rf/
opt
/ful
l
.dump (
tor
est
oret
hedumpf
il
econt
ent
s)
10.Howmanyt
ypesofbackupav
ail
abl
e?
Ther
ear
emai
nlyt
hreet
ypesofbackupsav
ail
abl
e.
(
i)Ful
lbackup (
Ent
ir
efi
l
esy
stem backup)
(
ii
)Incr
ement
albackup (
backupf
rom t
hel
astf
ull
backupori
ncr
ement
albackup)
(
ii
i) Cumul
ati
veordi
ff
erent
ialbackup (
backupf
rom l
astf
ull
backupor
cumul
ati
vebackup)
11.Whati
sthedi
ff
erencebet
weeni
ncr
ement
alanddi
ff
erent
ialbackup?
I
ncr
ement
albackup:
Taki
ngabackupf
rom t
hel
astf
ull
backuporl
asti
ncr
ement
albackup
Di
ff
erent
ialbackup:
Taki
ngabackupf
rom l
astf
ull
backup orl
astcumul
ati
veordi
ff
erent
ial
backup
12.Whi
chf
il
ewi
l
lupdat
ewhenbacki
ngupwi
thdumpcommand?
/
etc/
dumpdat
es f
il
ewi
l
lbeupdat
edwhenbacki
ngupwi
thdumpcommand.
13.Whatar
ethedumpdev
ices?
(
i)Tapedr
ives
(
ii
)Di
sks(
local
disks)
(
ii
i)Luns(
net
wor
kdi
sks)
14.Whati
ssnapshot
?
(
i)Thepoi
nt-i
n-t
imecopyoft
hef
il
esy
stem i
scal
l
edt
hesnapshot
.
(
ii
)Itpr
ovi
desonl
i
nebackupsol
uti
onoft
hef
il
esy
stem.
(
ii
i) Wecant
akeabackupwhi
l
ethef
il
esy
stem i
smount
edandi
tisi
nmul
ti
-user

Rat
nakar
Page108
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

mode.
(
iv) I
toccupi
edonl
yasmuchdi
skspaceast
hef
il
esy
stem i
e.,
bei
ngcapt
ured.
(
v)Wecanal
socr
eat
ebackup,
del
ete,
quer
ytempor
ary(
read-
onl
y)snapshot
susi
ng
f
ssnap command.
15.Whatar
ethedi
ff
erencesbet
ween t
arand cpi
o commands?
(
i)By t
arwecant
akebackupupt
o80GBsi
zeoff
il
esy
stems,butusi
ngcpi
other
eis
nol
i
mit
.
(
ii
)Int
art
hebackupi
sinar
chi
vef
ormati
e.,
incompr
essedst
ate,buti
ncpi
other
eis
nocompr
essi
on.
(
ii
i) I
nbot
hthet
ypesonl
ythewhol
ebackupi
spossi
ble.
16.Howt
otakeabackuponpr
oduct
ionser
ver
s?
(
i)Nor
mal
l
yinbackupenv
ironmentwehav
e3ser
ver
s.
(
a)Mast
erser
ver(
product
ionser
ver
s--1or2no'
s).
(
b)Medi
aser
ver(
backupser
ver-
-1or2no'
s).
(
c)Cl
i
entser
ver(
Nor
mal
syst
em)
(
ii
)Backupscanbet
akeni
nty
pes.
(
a)Appl
i
cat
ionBackup(
Nor
mal
l
yappl
i
cat
ionuser
swi
l
ltaket
heset
ypesofbackups)
(
b)Fi
l
esy
stem Backup(
O/Sbackup,Sy
stem Admi
nist
rat
orswi
l
ltaket
heset
ypes
ofbackups)
(
c)Dat
abaseBackup(
DBA user
swi
l
ltaket
heset
ypesofbackups)
(
ii
i)Nor
mal
l
ybackupi
saut
omat
edt
hroughsomebackupt
ool
sli
keVer
it
asNetbackup,
I
BM Ti
vol
iandAut
osy
s.
(
iv)Usi
ngcr
ont
ool
alsowecant
akebackup.Butcr
onwi
l
lnoti
nfor
mthef
ail
edbackup.
Theot
hert
ool
swi
l
l i
nfor
m bysendi
ngmessagesl
i
kewhyt
hebackupi
sfai
l
ed,
whenandwher
eiti
sfai
l
ed,
..
etc.
,
(
v)Onpr
oduct
ionser
ver
sthebackupwi
l
lfol
l
owt
hepr
ocedur
e,
(
a)Mast
erser
verdepor
tfr
om pr
oduct
ion.
(
b)I
mpor
tthemast
erser
veronMedi
aser
ver
.
(
c)ThenMast
erser
verwi
l
ljoi
nwi
tht
heMedi
aser
ver
.
(
d)Sy
nct
hedat
awi
tht
heMast
erser
ver
.
(
e)Takeabackupf
rom Mast
erser
verandst
oret
hecopyonMedi
aser
ver
.
(
f)Spl
i
ttheMast
erser
verf
rom Medi
aser
ver
.
(
g)Depor
ttheMast
erser
verf
rom Medi
aser
ver
.
(
h)I
mpor
ttheMast
erser
veronpr
oduct
ion.
(
i)Joi
ntheMast
erser
verwi
thpr
oduct
ion.
17.Whati
syourcompany
'sbackuppol
icy
?
(
i)By dump commandwecant
akebackupsondi
sks,
tapesandt
akesf
ull
,
i
ncr
ement
alanddi
ff
erent
ialorcumul
ati
vebackups.
(
ii
)lev
el0-
-Ful
lbackup (
mont
hlyonce)
l
evel3-
-Per
for
medonev
eryMonday (
Incr
ement
alf
rom l
astf
ull
or

Rat
nakar
Page109
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

l
asti
ncr
ement
albackup)
l
evel4-
-Per
for
medonev
eryTuesday (
Incr
ement
alf
rom l
astl
evel3
backup)
l
evel5-
-Per
for
medonev
eryWednesday (
Incr
ement
alf
rom l
astl
evel4backup)
l
evel6-
-Per
for
medonev
eryThur
sday (
Incr
ement
alf
rom l
astl
evel5backup)
l
evel7-
-Per
for
medonev
eryFr
iday (
Incr
ement
alf
rom l
astl
evel6backup)
l
evel8-
-Per
for
medonev
erySat
urday (
Incr
ement
alf
rom l
astl
evel7
backup)
l
evel2-
-Per
for
medonev
erySunday (
dif
fer
ent
ialorcumul
ati
ve
backupf
rom l
astf
ull
backup,
i
e.,
from Mondayt
oSat
urday
)
18.Whati
sthei
nfor
mat
ioni
sst
oredi
n/et
c/dumpdat
esf
il
e?
/
etc/
dumpdat
es f
il
erecor
dst
hebackupi
nfor
mat
ioni
f-u opt
ioni
susedwi
thdump
commandt
otakeabackup.I
nthi
sfi
l
eeachl
i
net
ell
sthef
il
esy
stem t
hatwasbackedup,
l
astl
evelofbackup,
thedat
e,dayandt
imeoft
hebackup.

12.Managi
ngI
nst
all
edSer
vices

1. Whati
sser
viceordeamon?
Ser
viceordeamoni
spr
ogr
am t
hatst
atsatbackgr
oundandcont
inuousl
yruni
nthe
backgr
ound.Theser
viceordeamoni
sreadyf
ori
nputormoni
tort
hechangesi
nour
comput
erandr
espondt
othem.Forexampl
etheApacheser
verhasadeamoncal
l
ed
ht
tpd t
hatl
i
stensonpor
tno.80onourcomput
erandwheni
trecei
vesar
equestf
ora
pagei
tsendst
heappr
opr
iat
edat
abackt
othecl
i
entmachi
ne.
Exampl
e:apache,
samba,NFS,
FTP,
..
..
etc.
,
2. Whatar
ethecommandsusedt
ocont
rolt
heser
vices?
ser
vice:
Thi
scont
rol
sthest
art
ingandst
oppi
ngt
heser
vicesdur
ingsessi
onandt
heseset
ti
ngs
wi
l
lnotbesav
ed.Wecanst
artt
heApacheser
vicei
nthi
sway
,buti
twi
l
lnotst
arton
boot
ingt
ime.Usi
ngt
hismet
hodt
heser
vicewi
l
lcont
inuet
orunonupt
onextbootbut

Rat
nakar
Page110
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

f
rom nextboott
heser
vicewi
l
lnotbest
art
edaut
omat
ical
l
y.
chkconf
ig:
Thi
scont
rol
swhi
chser
vicesar
esett
ost
artatboott
ime.Theseset
ti
ngswi
l
lbesav
ed
andappl
i
edatnextboot
.Changi
ngt
heseset
ti
ngswi
l
lnotst
artt
heser
vicei
mmedi
atel
y
andi
twi
l
ljustf
lagt
hem t
obest
art
edf
rom t
henextboot
.
3. Whatar
ethedi
ff
erencesbet
weenRHEL-
6andRHEL-
7ser
vices?
RHEL-
6 RHEL-
7
(a)Thepar entprocessi e.,
thestarti
ng (a)Theparentpr
ocessie.,
thestar
ti
ng
processis processi
s
i
nitd andi t
'sprocessid( pi
d)is1. systemd andit'
sprocessi
d(pid)i
s1.
(b)Theret wocommandsf orstar
ti
ngt he
(b)Hereonlyonecommandisusedt
o
servi
ces.
star
tthe
Theyarecal l
ed #ser vice and #
serv
ice.Thati
s #syst
emctl
chkconfi
g
(c)#ser v
icecommandi susedt ostartor
(c)#sy st
emctlist
hecommandto
stopthe
star
torstop
servi
cest empor ari
ly and #chkconf i
gi s
theserv
icestempor
ari
l
y ornext
used
booti
ng
tostartorst opt heservi
cesatnex tbooti
ng
ti
me.
ti
me.
(d)/ usr/l
ib/systemd/syst
em i
sthe
(d)/etc/
ini
t.
dist
hel
ocat
ionf
oral
lthe
l
ocat i
onf or
serv
ices.
allt
heser vices.
(e)#sy st
emct l
(e)#service <serv
icename>
<start/
stop/ r
estart
/rel
oad/
<star
t/st
op/r
estar
t/r
eload/
stat
us>
status><ser vi
cename>

4. Whatar
ethedi
ff
erencesbet
ween i
nit
d and sy
stemd deamons?
I
nit
d sy
stemd
(a)I
tist
hest
art
ingpr
ocessi
nRHEL-4,
5and
(
a)I
tisst
art
ingpr
ocessi
nRHEL-7.
6.
(
b)I
t'
spr
ocessi
d(pi
d)i
s 1. (
b)I
t'
spr
ocessi
d(pi
d) i
s 1.

(
c)I
twil
l t
akemor
eti
met
othesy
stem and (
c)I
twil
l t
akel
essti
metostar
tthesy
stem and
ser
vices. ser
viceswhencompar
edtoRHEL-6.
(d)Itwill
starttheservi
cesparal
l
elnotoneby
(
d)I
twi
l
lst
artt
heser
vicesonebyone.
one.
(e)Allthelinuxserv
icesareendswit
hlett
er
(
e)Al
l t
hel
i
nuxserv
icesar
eendswi t
hlet
terd. d.
service
Exampl
e:sshd,htt
pd,
crond,
..
.et
c., Exampl e:sshd.servi
ce,
htt
pd.servi
ce,...
etc.
,

5. Howt
omaket
hecomput
ert
obootf
ast
erl
y?
Manyser
vicesar
erequi
redt
orunal
lthet
imehowev
ermanycanbet
urnedof
fforbot
h
secur
it
yreasonsasr
unni
ngunnecessar
yser
vicesopensmor
edoor
sint
oourcomput
er

Rat
nakar
Page111
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

butal
sof
orper
for
mancer
easons.I
tmayt
akemuchdi
ff
erencebutourcomput
ershoul
d
bootsl
i
ght
lyf
ast
erwi
thl
essser
vicesi
thast
ost
artonboot
.
So,
oneoft
het
echni
quet
ost
artt
hesy
stem f
astandmai
ntai
ntoi
mpr
ovesecur
it
yis
t
urnof
ftheunneededser
vices.
6. Whatar
emaski
ngandunmaski
ngt
heser
vices?
Maski
ngt
heser
vicesmeanshi
dingt
heser
vicesandunmaski
ngt
heser
vices
meansunhi
dingt
heser
vices.Themaski
ngandunmaski
ngar
ethenewcommandsi
n
RHEL-7.I
fanyt
wosi
mil
arser
vices(
forexampl
ent
pandchr
ony
)ar
ether
eina
sy
stem,
wecannotst
artt
het
woser
vicesatat
ime.I
nthesescenar
ioswegof
ormask
andunmaskcommands.
#sy
stemct
lmasksshd (
tohi
det
hesshdser
vicet
empor
ari
l
yie.
,we
cannotst
artt
heser
vices
whenwemaskanyser
vice)
#sy
stemct
lunmask sshd (
tounhi
det
hesshdser
vicei
e.,
wecan
st
artt
heser
viceagai
n)
*wecanal
souseRHEL-6commandsl
i
keas,#ser
vice and #chkconf
ig,
butt
hese
t
wocommandswi
l
l
i
nter
nal
l
ycal
lthe #sy
stemct
lcommandsonl
y.So,
inRHEL-7#sy
stemct
l
commandi
sther
ecommended
one.
#sy
stemct
l -
-f
ail
ed -
-t
ype=ser
vice (
tocheckal
lthef
ail
edser
vices)
#sy
stemct
l -
-f
ail
ed -
-t
ype=pr
ocess (
tocheckal
lthef
ail
edpr
ocesses)
*I
nRHEL-6ser
vicenamesendswi
th'
d'onl
y,buti
nRHEL-7t
heser
vicenamesends
wi
thd.
ser
viceandt
hese
ar
eal
ltextf
il
esonl
y.So,
inRHEL-7wecanopenandseeal
lthesy
stem ser
vicesandr
ead
t
hei
rcont
ent
s.
#ps (
toseet
heact
ivepr
ocessi
nthesy
stem)
#t
op (
Itwi
l
lshowady
nami
creal
-t
imev
iewofar
unni
ngsy
stem.i
e.,a
summar
yofpr
ocesses or
t
hreadscur
rent
lymanagedbyt
heLi
nuxker
nel
)
#ki
l
l (
Itsendst
hespeci
fi
edsi
gnal
tot
hespeci
fi
edpr
ocessorpr
ocess
gr
oup)
#pki
l
l (
Itwi
l
lsendt
hespeci
fi
edsi
gnal
toeachpr
ocessi
nst
eadofl
i
sti
ng
t
hem onst
andar
dout
put
)
#pst
ree (
toshowal
lther
unni
ngpr
ocessesasat
reest
ruct
ure.Thet
reei
s
r
oot
edei
therpi
d ori
nit
)
#ni
ce (
tor
unapr
ogr
am wi
thmodi
fi
edschedul
i
ngpr
ior
it
yie.
,itr
unst
he
pr
ocesswi
than
adj
ust
abl
eni
ceness)
#r
eni
ce (
toal
tert
heschedul
i
ngpr
ior
it
yofone ormor
erunni
ngpr
ocesses)

Rat
nakar
Page112
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#pgr
ep (
tol
i
stt
hepr
ocessi
d'
swhi
chmat
cheswi
tht
hepgr
epar
gument
)
RHEL-6commands:
#ser
vice <ser
vicename> st
atus (
tocheckt
hest
atusoft
he
ser
vice)
#ser
vice <ser
vicename> st
art (
tost
artt
heser
vice)
#ser
vice <ser
vicename> st
op (
tost
opt
heser
vice)
#ser
vice <ser
vicename> r
eload (
tor
eloadt
heser
vice)
#ser
vice <ser
vicename> r
est
art (
tor
est
artt
heser
vice)
*Theseabov
ecommandswi
l
lchanget
heser
vicest
atusest
empor
ari
l
y.Soi
fwewant
t
ochangest
atusesoft
he
pr
ocessaut
omat
ical
l
yfr
om nextbootonwar
dswehav
etoenabl
ethoseser
vicesasgi
ven
bel
ow.
#chkconf
ig -
-l
ist (
tocheckt
heav
ail
abi
l
ityoft
he
ser
vicesi
ndi
ff
erentr
unl
evel
s)
#chkconf
ig -
-l
ist <ser
vicename> (
tocheckt
heav
ail
abi
l
ityof
t
heser
vicei
ndi
ff
erentr
unl
evel
s)
#chkconf
ig <ser
vicename> on (
tomaket
heser
viceav
ail
abl
eaf
ter
r
est
art
)
#chkconf
ig <ser
vicename> of
f (
tomaket
heser
viceunav
ail
abl
e
af
ternextboot
)
#chkconf
ig -
-l
evel<1-
6><ser
vicename><on/
off
> (
tomaket
heser
viceav
ail
abl
eor
unav
ail
abl
eont
he
par
ti
cul
arr
unl
evel
)
#chkconf
ig-
-l
evel 5 v
sft
pd on (
tomaket
hev
sft
pdser
viceav
ail
abl
eonr
un
l
evel5)
#chkconf
ig-
-l
evel 345 v
sft
pd on (
tomaket
hev
sft
pdser
viceav
ail
abl
eonr
un
l
evel
s3,
4and5)
RHEL-7commands:
#sy
stemct
lst
atus <ser
vicename> (
tocheckt
hest
atusoft
heser
vice)
#sy
stemct
l st
art <ser
vicename> (
tost
artt
heser
vice)
#sy
stemct
lst
op <ser
vicename> (
tost
opt
heser
vice)
#sy
stemct
lrel
oad <ser
vicename> (
tor
eloadt
heser
vice)
#sy
stemct
lrest
art<ser
vicename> (
tor
est
artt
heser
vice)
*Theseabov
ecommandswi
l
lchanget
heser
vicest
atusest
empor
ari
l
y.Soi
fwewant
t
ochangest
atusesoft
he
pr
ocessaut
omat
ical
l
yfr
om nextbootonwar
dswehav
etoenabl
ethoseser
vicesas
gi
venbel
ow.
#sy
stemct
lenabl
e <ser
vicename> (
tomaket
heser
viceav
ail
abl
eatnex
tboot
)
#sy
stemct
ldi
sabl
e <ser
vicename> (
tomaket
heser
viceunav
ail
abl
eatnextboot
)
#gr
ep <st
ri
ngname><f
il
ename> (
todi
spl
ayt
hespeci
fi
edst
ri
ngi
nthatf
il
e)

Rat
nakar
Page113
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#gr
ep -
n <st
ri
ngname><f
il
ename> (
todi
spl
ayt
hest
ri
ngwi
thl
i
neno'
s)
#gr
ep -
e <st
ri
ngname1> -
e <st
ri
ng2><f
il
ename> (
todi
spl
ay2ormul
ti
ple
st
ri
ngsi
nthatf
il
e)
#gr
ep -
o <st
ri
ngname><f
il
ename> (
todi
spl
ayonl
ythatst
ri
ngi
nthatf
il
enotwhol
e
t
het
extoft
hatf
il
e)
#gr
ep -
v <st
ri
ngname><f
il
ename> (
todi
spl
ayal
lthest
ri
ngsexceptt
hespeci
fi
ed
one)
#gr
ep ^t
hiscoss (
todi
spl
ayt
hel
i
newhi
chi
sst
art
ingwi
th
t
hespeci
fi
edst
ri
ng)

13.Managi
ngPr
ocess

1. Whati
spr
ocessandexpl
aini
t?
Apr
ocessi
sasetofi
nst
ruct
ionswhi
chexecut
esi
nthememor
y.I
tiscr
eat
edi
nthe
memor
ywhenapr
ogr
am orcommandi
sexecut
ed.Ev
erypr
ocessi
sident
if
iedbya
uni
queno.i
e.,PI
D(Pr
ocessI
D).Sev
eral
processesar
est
art
edatboott
imeandwhi
ch
ar
erunni
ngatbackgr
oundcal
l
eddeamons.TheLi
nuxker
nel
isusedt
ocommuni
cat
e

Rat
nakar
Page114
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

wi
tht
hepr
ocessesbyt
hei
rpr
ocessI
D's(
PID'
s).Deamoni
sapr
ocessr
unni
ngi
nthe
backgr
ound.Thesear
ehandl
edbyt
hesy
stem andpr
ocessar
ehandl
edbyt
heuser
s.
Thef
ir
stpr
ocessi
nRHEL-6i
sini
tdandi
tst
art
satboott
ime.I
t'
spr
ocessI
Dis1
wher
easi
nRHEL-7t
hef
ir
stpr
ocessi
ssy
stemdandi
tst
art
satboott
ime.To
manageort
oseet
hepr
ocessest
her
ear
etwocommands.
(
i)#ps and (
ii
)#t
op
#ps:
I
tisj
ustasnapshotoft
hecur
rentst
atusoft
hepr
ocesses.I
tgi
vesonl
yonet
ermi
nal
i
nfor
mat
ionnotal
lthet
ermi
nal
sinf
ormat
ion.
#t
op:
Usi
ng t
op commandwecanmoni
tort
hepr
ocessescont
inuousl
y.Bydef
aul
tev
ery3
secondsi
twi
l
lref
resht
hedat
a.
2. Howmanypr
ocessar
erungener
all
yonLi
nuxandexpl
aint
hem?
Ther
ear
egener
all
ythr
eet
ypesofpr
ocessest
hatr
unonLi
nux
.Theyar
e,
(
i)I
nter
act
ivePr
ocesses
(
ii
)Sy
stem Pr
ocess ordeamon
(
ii
i) Aut
omat
ic orbat
ch.
I
nter
act
ivePr
ocesses:
I
nter
act
ivepr
ocessesar
ethosepr
ocessest
hatar
einv
okedbyauserandcani
nter
act
wi
tht
heuser
.Forexampl
e #v
ior#v
im ar
ethei
nter
act
ivepr
ocesses.I
nter
act
ive
pr
ocessesmayber
uni
nfor
egr
oundorbackgr
ound.Thef
oregr
oundpr
ocessi
sthe
pr
ocesst
hatwear
ecur
rent
lyi
nter
act
ingwi
thandi
susi
ngt
het
ermi
nal
asi
tsst
din
(
standar
dinput
)andst
dout(
standar
dout
put
).Thebackgr
oundpr
ocessi
snot
i
nter
act
ingwi
tht
heuserandcanbei
noneoft
wost
ates,i
e.,paused orr
unni
ng.
Sy
stem Pr
ocesses ordeamons:
Deamoni
sref
ert
opr
ocessest
hatar
erunni
ngont
hecomput
erandpr
ovi
desser
vices
butdonoti
nter
actwi
tht
heconsol
e.Mostser
versof
twar
eisi
mpl
ement
edasadeamon.
Forexampl
eApache,
samba,
sshdar
ethedeamons.Anypr
ocesscanbecomea
deamonasl
ongasi
tisr
uni
nthebackgr
oundanddoesnoti
nter
actwi
tht
heuser
.
Aut
omat
icpr
ocesses:
Aut
omat
icpr
ocessesar
enotconnect
edt
oat
ermi
nal
andt
hesear
equeuedi
ntoa
spool
erar
eawher
etheywai
ttobeexecut
edonaFI
FO(
Fir
stI
n-Fi
rstOut
)basi
s.Such
t
askscanbeexecut
edusi
ngoneoft
wocr
it
eri
a.
Atcer
tai
ndat
eandt
ime:
doneusi
ngt
he "
at"command.
Whent
het
otal
syst
em l
oadi
slowenought
oacceptext
raj
obs:
doneusi
ngt
he"cr
on"
command.Bydef
aul
ttasksar
eputi
naqueuewher
etheywai
ttobeexecut
edunt
ilt
he
sy
stem l
oadi
slowert
han0.
8andcr
onj
obpr
ocessi
ngi
sal
sousedf
oropt
imi
zi
ng
sy
stem per
for
mance.
3. Whati
spar
entpr
ocess?
Thepr
ocesswhi
chst
art
s orcr
eat
esanot
herpr
ocessi
scal
l
edt
hepar
entpr
ocess.

Rat
nakar
Page115
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Ev
erypr
ocesswi
l
lbehav
ingapar
entpr
ocessex
cepti
nit
dpr
ocess.Thei
nit
dpr
ocessi
s
t
hepar
entpr
ocesst
oal
lther
emai
ningpr
ocessesi
n
Li
nuxsy
stem becausei
tist
hef
ir
stpr
ocesswhi
chget
sst
art
edbyt
heker
nel
att
het
ime
ofboot
ingandi
t'
sPI
D
i
s1.Onl
yaf
teri
nit
dpr
ocessget
sst
art
ed,
ther
emai
ningpr
ocessesar
ecal
l
edbyi
t,and
hencei
tisr
esponsi
blef
oral
lther
emai
ningpr
ocessesi
nthesy
stem.Thepar
ent
pr
ocessi
sident
if
iedbyPPI
D(par
entpr
ocessI
D).
4. Whati
schi
l
dpr
ocess?
Apr
ocesswhi
chst
art
edorcr
eat
edbyt
hepar
entpr
ocessi
scal
l
edchi
l
dpr
ocessand
i
tisi
dent
if
iedbyPI
D.
Usef
ul #ps commands:
#ps -
a (
itdi
spl
aysal
lthet
ermi
nal
spr
ocessesi
nfor
mat
ion)
#ps -
au (
itdi
spl
aysal
lthet
ermi
nal
spr
ocessesi
nfor
mat
ionwi
th
usernames)
#ps -
aux (
itdi
spl
aysal
lthet
ermi
nal
spr
ocesses
i
nfor
mat
ioni
ncl
udi
ngbackgr
ound
pr
ocesseswi
thusernames)
* ?(
quest
ionmar
k)i
fiti
sappear
edatt
tycol
umn,i
tindi
cat
est
hati
sabackgr
ound
pr
ocess.
#ps -
ef (
itdi
spl
ayst
het
otal
processesi
nfor
mat
ionwi
thpar
ent
pr
ocessI
D(PPI
D))
#ps -
P <pr
ocessi
d> (
itdi
spl
ayst
hepr
ocessnamei
fweknowt
hepr
ocess
I
D(pi
d))
#pi
dof
<pr
ocessname> (
toseet
hepr
ocessI
Doft
hespeci
fi
edpr
ocess)
#pi
dof i
nit
d (
toseet
hepr
ocessI
Doft
hei
nit
dpr
ocess)
#pst
ree (
todi
spl
ayt
hepar
entandchi
l
dpr
ocessesst
ruct
urei
n
t
reef
ormat
)
#ps -
u <username> (
todi
spl
ayal
lthepr
ocessesoft
hespeci
fi
eduser
)
#ps -
u r
aju (
todi
spl
ayal
lthepr
ocessesoft
heuserr
aju)
#ps -
G <gr
oupname> (
todi
spl
ayal
lthepr
ocessest
hatar
erunni
ngbya
par
ti
cul
argr
oup)
#ps -
opi
d,comm,%mem,%cpu (
todi
spl
aypr
ocessi
d,command,%memor
y
and %cpu ut
il
iz
ati
on
not
hingbutf
il
ter
ingt
heout
put
)
#ps -
Aopi
d,comm,%mem,%cpu (
todi
spl
ayt
hesamei
nfor
mat
ionasabov
ebut
i
ncl
udi
ngsomemor
e
i
nfor
mat
ion)
#ps -
opi
d,comm,%mem,%cpu|
sor
t-k<no.
>-r|
head -
n10(
todi
spl
aywhi
ch
pr
ocessi
sut
il
izi
ngmor
e
memor
yorcpu i
nrev
erseor
derwher
e-kmeansf
iel
d,<no.
>meansf
iel
dno.and-
r

Rat
nakar
Page116
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
ever
seor
der
)
#ps -
opi
d,comm,%mem,%cpu|
sor
t-k3-
r|head -
n10(
todi
spl
ayt
hepr
ocess
whi
choccupi
esmor
e
memor
yandcpuut
il
izat
ioni
nrev
erseor
der
)
#ps -
aux|
grep f
ir
efox (
tocheckwhet
hert
hef
ir
efox
i
srunni
ng ornot
)
#pgr
ep -
U <username> (
todi
spl
ayal
lthe
pr
ocessI
D'sonl
yfort
hatuser
)
* Tocommuni
cat
ewi
tht
hepr
ocesses #ki
lland #pki
l
lcommandsar
eused.
#ki
l
l -
--
--
> I
twi
l
lki
l
lthepr
ocessesusi
ng PI
D's.
#pki
l
l--
--
-> I
twi
l
lki
l
lthepr
ocessesusi
ngpr
ocessnames.
* Wecanal
sogi
vesomesi
gnal
swhi
l
eusi
ngt
heabov
ecommandsandwegett
he
si
gnal
sinf
ormat
ionby
#ki
ll-
lcommand.Thi
scommandwi
l
lli
stal
lthesi
gnal
swi
thno'
sandt
her
ear
e64
si
gnal
stopass.
5. Whati
ssi
gnali
nPr
ocessmanagement
?
Si
gnal
sar
eawayofsendi
ngsi
mpl
emessagest
opr
ocesses.Mostoft
hesemessages
ar
eal
readydef
inedandhowev
ersi
gnal
scanonl
ybepr
ocessedwhent
hepr
ocessi
sin
usermode.Ev
erysi
gnal
hasauni
quesi
gnal
name.Eachsi
gnal
namei
samacr
owhi
ch
st
andsf
oraposi
ti
vei
nteger
.Si
gnal
scanbegener
atedbyt
hepr
ocessi
tsel
fort
heycan
besentf
rom onepr
ocesst
oanot
her
.Av
ari
etyofsi
gnal
scanbegener
ated ordel
i
ver
ed
andt
heyhav
emanyusesf
orpr
ogr
ammer
s.
6. Whatar
ethei
mpor
tantsi
gnal
sinpr
ocessmanagement
?
1.SI
GHUP -
--
--
> t
orel
oad(
readt
heconf
igur
ati
onandl
oad)
2.SI
GINT -
--
--
> t
oint
err
uptf
rom t
hekey
boar
d(not
hingbutCt
rl+c)
3.SI
GQUI
T--
--
-> t
oqui
tthepr
ocessf
rom key
boar
d(not
hingbutCt
rl+l
)
9.SI
GKI
LL -
--
--
> t
oki
l
lthepr
ocessf
orcef
ull
y(not
hingbutunbl
ockabl
e)
15. SI
GTERM -
--
--
> wai
tforcompl
eti
ngt
hepr
ocessandt
hent
ermi
nat
e
(
ter
minat
egr
acef
ull
y)
18. SI
GCONT-
--
--
> t
ocont
inueorr
esumet
hepr
ocessi
fiti
sst
opped
19. SI
GSTOP-
--
--
> t
oter
minat
ethepr
ocess(
Ifi
tisnotst
oppedt
hepr
ocesswe
cannotcont
inueorr
esume
t
hatpr
ocessbyCt
rl+c orCt
rl+z
)
20. SI
GHTSTP-
--
-> t
ost
opt
hepr
ocess(
not
hingbutCt
rl+z)
* Butt
hemostcommonl
yusedsi
gnal
sar
e 1, 9, 15 and 20.
* Thedef
aul
tsi
gnal
is15(
gracef
ull
y)whenwenotspeci
fi
edanysi
gnal
.
#ki
l
l -<si
gnal
><pr
ocessI
D> (
toki
l
lthespeci
fi
edpr
ocessusi
ngki
l
l
si
gnal
)
#ki
l
l-9 1291 (
toki
l
lthepr
ocesswhi
chhast
hePI
Das
1291)

Rat
nakar
Page117
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

*I
fwenotspeci
fi
edt
hesi
gnal
no.t
hent
hedef
aul
tsi
gnal15wi
l
lef
fect
.
#ki
l
l 1291 (
toki
l
lthepr
ocess1291wi
thdef
aul
t
si
gnal
)
#pki
l
l-u <username> (
toki
l
lal
lthepr
ocessesoft
he
speci
fi
eduser
)
#pki
l
l-ur
aju (
toki
l
lal
lthepr
ocessesoft
heuserr
aju)
#pki
l
l-9f
ir
efox (
toki
l
lthef
ir
efoxpr
ocess)
7. Howmanypr
ocessst
atesar
ether
e?
Ther
ear
esi
xpr
ocessst
atesandt
heyar
e,
(
i)Runni
ngpr
ocess (
thepr
ocesswhi
chi
sinr
unni
ngst
ateandi
sindi
cat
edby"r")
.
(
ii
)Sl
eepi
ngpr
ocess (
thepr
ocesswhi
chi
sinsl
eepi
ngst
ateandi
sindi
cat
edby"s")
(
ii
i)Wai
ti
ngpr
ocess (
thepr
ocesswhi
chi
sinwai
ti
ngst
ateandi
sindi
cat
edby"w")
.
(
iv)St
oppi
ngpr
ocess (
thepr
ocesswhi
chi
sinst
oppi
ngst
ateandi
sindi
cat
edby"T"
)
.
(
v)Or
phanpr
ocess (
thepr
ocesswhi
chi
srunni
ngwi
thoutpar
entpr
ocessandi
s
i
ndi
cat
edby"o")
.
(
vi)Zombi
epr
ocess (
thepr
ocesswhi
chi
srunni
ngwi
thoutchi
l
dpr
ocessandi
s
i
ndi
cat
edby"Z")
.
8. Whati
sOr
phanpr
ocess?
Thepr
ocesseswhi
char
erunni
ngwi
thoutpar
entpr
ocessesar
ecal
l
edOr
phanpr
ocesses.
Somet
imespar
entpr
ocesscl
osedwi
thoutknowi
ngt
hechi
l
dpr
ocesses.Butt
hechi
l
d
pr
ocessesar
erunni
ngatt
hatt
ime.Thesechi
l
dpr
ocessesar
ecal
l
edOr
phanpr
ocesses.
9. Whati
sZombi
epr
ocess?
Whenwest
artpar
entpr
ocess,
itwi
l
lst
artsomechi
l
dpr
ocesses.Af
tersomet
imet
he
chi
l
dpr
ocesseswi
l
ldi
edbecauseofnotknowi
ngt
hepar
entpr
ocesses.Thesepar
ent
pr
ocesses(
whi
char
erunni
ngwi
thoutchi
l
dpr
ocesses)ar
ecal
l
edZambi
epr
ocesses.
Thesear
eal
socal
l
edasdef
aunctpr
ocesses.
10.Howt
osett
hepr
ior
it
yforapr
ocess?
Pr
ocessespr
ior
it
ymeansmanagi
ngpr
ocessort
ime.Thepr
ocessororCPUwi
l
l
per
for
m mul
ti
plet
asksatt
hesamet
ime.Somet
imeswecanhav
eenoughr
oom t
otake
onmul
ti
plepr
oject
sandsomet
imeswecanonl
yfocusononet
hingatat
ime.Ot
her
t
imessomet
hingi
mpor
tantpopsupandwewantt
odev
oteal
lofourener
gyi
ntosol
vi
ng
t
hatpr
obl
em whi
l
eput
ti
ngl
essi
mpor
tantt
asksont
hebackbur
ner
.
I
nLi
nuxwecansetgui
del
i
nesf
ort
heCPUt
ofol
l
owwheni
tisl
ooki
ngatal
lthet
asksi
t
hast
odo.Thesegui
del
i
nesar
ecal
l
ed ni
ceness orni
cev
alue.TheLi
nuxni
ceness
scal
egoesf
rom -
20t
o19.Thel
owert
henumbert
hemor
epr
ior
it
ythatt
askget
s.I
fthe
ni
cenessv
aluei
shi
ghernumberl
i
ke19t
het
askwi
l
lbesett
othel
owestpr
ior
it
yandt
he
CPUwi
l
lpr
ocessi
twhenev
eri
tget
sachance.Thedef
aul
tni
cev
aluei
s0(
zer
o).
Byusi
ngt
hisscal
ewecanal
l
ocat
eourCPUr
esour
cesmor
eappr
opr
iat
ely
.Lower
pr
ior
it
ypr
ogr
amst
hatar
enoti
mpor
tantcanbesett
oahi
gherni
cev
alue,
whi
l
ethe

Rat
nakar
Page118
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

hi
gherpr
ior
it
ypr
ogr
amsl
i
kedeamonsandser
vicescanbesett
orecei
vemor
eoft
he
CPU'
sfocus.Wecanev
engi
veaspeci
fi
cuseral
owerni
cev
aluef
oral
lhi
s/her
pr
ocessessowecanl
i
mitt
hei
rabi
l
ityt
osl
owdownt
hecomput
er'
scor
eser
vices.
Ther
ear
etwoopt
ionst
oreduce/
incr
easet
hev
alueofapr
ocess.Wecanei
therdoi
t
usi
ngt
heni
ce orr
eni
cecommands.
Exampl
es:
#ni
ce -
n <ni
cev
aluer
angef
rom -
20t
o19><command> (
tosetapr
ior
it
ytoa
pr
ocessbef
orest
art
ingi
t)
#ni
ce -
n 5 cat>r
aju (
tosett
hemedi
um pr
ior
it
y
t
ocatcommand)
#ps -
elf (
tocheckt
heni
cev
aluef
or
t
hatcommand)
* Tor
eschedul
etheni
cev
alueofex
ist
ingpr
ocess,
fir
stcheckt
hePI
Doft
hatpr
ocess
by#ps -
elf command
andt
henchanget
heni
cenessoft
hatcommandby#r
eni
ce<ni
cev
alue(
-20t
o19)
><PI
D>
command.
#r
eni
ce 10 1560 (
tor
eschedul
ethe
PI
D 1560)
11.Whati
stopcommandandwhati
tshows?
t
opi
sacommandt
oseet
hepr
ocessesst
atesandst
atusesi
nfor
mat
ioncont
inuousl
y
unt
ilwequi
tbypr
essi
ng "q"
.Bydef
aul
ttopcommandwi
l
lref
resht
hedat
aforev
ery3
seconds.
Whenweneedt
oseet
her
unni
ngpr
ocessesonourLi
nuxi
nreal
time,
thet
op
commandwi
l
lbev
eryusef
ul.Besi
dest
her
unni
ngpr
ocessest
he t
opcommandal
so
di
spl
aysot
heri
nfor
mat
ionl
i
kef
reememor
ybot
hphy
sical
andswap.
Thef
ir
stl
i
neshowst
hecur
rentt
ime,"
up1day
"showshowl
ongt
hesy
stem hasbeen
upf
or,"
3user
"howmanyuser
slogi
n,"
loadav
erage:0.
01,0.
00,0.
23"t
hel
oad
av
erageoft
hesy
stem 1,5and15mi
nut
es.
Thesecondl
i
neshowst
henoofpr
ocessesandt
hei
rcur
rentst
ates.
Thet
hir
dli
neshowsCPUut
il
izat
iondet
ail
sli
ke%oft
heuser
spr
ocesses,%oft
he
sy
stem pr
ocesses,%ofav
ail
abl
eCPU and %ofCPUwai
ti
ngt
imef
orI
/O(
inputand
out
put
).
Thef
our
th andf
if
thl
i
nesshowst
het
otal
phy
sical
memor
yint
hesy
stem,used
phy
sical
memor
y,f
reephy
sical
memor
y,buf
fer
edphy
sical
memor
y,t
het
otalswap
memor
yint
hesy
stem,usedswapmemor
y,f
reeswapmemor
y and cachedswap
memor
y,.
..et
c.,
Fr
om si
xthl
i
neonwar
dst
hef
iel
dsar
easf
oll
ows.
PI
D Pr
ocessI
D
USER Owneroft
hepr
ocessi
e.,whi
chuserex
ecut
edt
hatpr
ocess

Rat
nakar
Page119
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

PR Dy
nami
cPr
ior
it
y
NI Ni
cev
alue,
alsoknownasbasev
alue
VI
RT Vi
rt
ualsi
zeoft
het
aski
ncl
udest
hesi
zeofpr
ocessesex
ecut
abl
e
bi
nar
y
RES Thesi
zeofRAM cur
rent
lyconsumedbyt
het
askandnoti
ncl
uded
t
heswappor
ti
on
SHR Shar
edmemor
yar
eabyt
woormor
etasks
S TaskSt
atus
%CPU The%ofCPUt
imededi
cat
edt
orunt
het
askandi
tisdy
nami
cal
l
y
changed
%MEM The%ofmemor
ycur
rent
lyconsumedbyt
het
ask
TI
ME+ Thet
otal
CPUt
imet
het
askhasbeenusedsi
ncei
tst
art
ed.+si
gn
meansi
tisdi
spl
ayed wi
thhundr
edt
hofasecond
gr
anul
ari
ty.Bydef
aul
t,TI
ME/
TIME+doesnotaccountt
he
CPUt
imeusedbyt
het
ask'
sdeadchi
l
dren
COMMAND Showi
ngpr
ogr
am name orpr
ocessname.
*Whi
l
erunni
ngt
het
opcommand,
justpr
esst
hef
oll
owi
ngkey
swoksandt
heout
put
wi
l
lbest
oredi
nreal
time.
1 -
--
--
> 2ndCPUi
nfor
mat
ion Shi
ft+> -
--
--
> Pageup
h -
--
--
>Hel
p Shi
ft+< -
--
--
> Pagedown
Ent
er -
--
--
> Ref
reshi
mmedi
atel
y n -
--
--
> Numberoft
asks
k-
--
--
> Ki
l
lthepr
ocess u -
--
--
> userpr
ocesses
M-
--
--
> Sor
tbymemor
yusage P -
--
--
> Sor
tbyCPUusage

T-
--
--
> Sor
tbycumul
ati
vet
ime z -
--
--
> Col
ordi
spl
ay
r-
--
--
> Tor
eschedul
ethepr
ior
it
ybyr
eni
ce d -
--
--
> Changet
hedel
ayt
ime
(
ref
resht
ime)
b-
--
--
> Hi
ghl
i
ghtt
her
unni
ngpr
ocess W -
--
--
> Wr
it
ethei
nfor
mat
ioni
n
/
root
/.t
opr
cfi
l
e
q-
--
--
> qui
tthet
opcommand
Thest
atusoft
hepr
ocesses:
r-
--
--
> Runni
ngpr
ocess s -
--
--
> Sl
eepi
ngpr
ocess
z-
--
--
> Zombi
epr
ocess T -
--
--
> St
oppedpr
ocess
D-
--
--
> Uni
nter
rupt
edsl
eepi
ngpr
ocess R< -
--
--
> Hi
ghpr
ior
it
y
N>-
--
-> Lowpr
ior
it
y o -
--
--
> Or
phanpr
ocess
+-
--
--
> For
egr
oundpr
ocess ? -
--
--
> Backgr
oundpr
ocess
#r
eni
ce -
n 10 5453 (
tochanget
hespeci
fi
edr
unni
ngpr
ocess
pr
ior
it
yonl
i
ne)
#ni
ce -
n-15 f
ir
efox (
tost
artt
hef
ir
efoxpr
ocesswi
thpr
ior
it
y

Rat
nakar
Page120
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

l
evel-
15)
12.Howt
osol
vet
hei
ssuei
ftheCPUut
il
izat
ioni
s99%?
(
i)Fi
rstcheckwhi
chpr
ocessandwhoex
ecut
edt
hatpr
ocessi
sconsumi
ngmor
eCPU
ut
il
izat
ionormemor
y ut
il
izat
ionbyexecut
ing #t
op command.
(
ii
)Theni
nfor
mtot
hoseuser
swhoexecut
edt
hatpr
ocesst
houghmai
l
,messageor
r
aisi
ngt
het
icket
.
(
ii
i) I
fthoseuser
sar
enotav
ail
abl
eornotr
espondi
ngt
oourmai
lthenwehav
eto
changet
hepr
ior
it
yoft
hat pr
ocessusi
ng #r
eni
ce command.
(
iv)Bef
orechangi
ngt
hepr
ocesspr
ior
it
ylev
el,
wehav
etogetort
akeappr
oval
from our
t
eam l
eadorpr
oject manager
.
13.Howt
ocheckt
he wwnno.ofl
un?
(
i)Fi
rsti
nst
allsy
sut
il
spackaget
oexecut
ethecommandst
oknowt
he wwnnumber
byexecut
ingcommand,
#y
um i
nst
allsy
sut
il
s-y
(
ii
)#sy
stool-
cfs_
host -
v|gr
ep "
por
t-
name" (
tocheckt
he wwn
number
)
14.Howt
oremov
ethepagecachesandot
hercaches?
#sy
snc; echo2 >/
proc/
sys/
vm/
drop_
caches (
tor
emov
ethepage
caches)
#sy
snc; echo3 >/
proc/
sys/
vm/
drop_
caches (
tor
emov
eal
lty
pesof
cachesl
i
kedentcache,
pagecaches and ot
her
s)
15.Whati
s"sosr
epor
t"andhowt
ogener
atei
t?
Sosr
epor

is a command i
n l
i
nux (
RHEL / Cent
OS) whi
ch col
l
ect
s sy
stem
conf
igur
ati
on 
anddi
agnost
ici
nfor
mat
ion ofy
ourl
i
nux box l
i
ke r
unni
ng ker
nelv
ersi
on,
l
oadedmodul
es,
andsy
stem andser
viceconf
igur
ati
on f
il
es.Thi
s command al
so r
uns
ext
ernal
progr
amst
ocol
l
ectf
urt
heri
nfor
mat
ion,
andst
orest
hisout
puti
nthe r
esul
ti
ng
ar
chi
ve.
Sosr
epor
tisr
equi
redwheny
ouhav
eopenacasewi
thr
edhatf
ort
echni
calsuppor
t.
Redhatsuppor
tEngi
neer
s wi
l
lrequi
re sosr
epor
tofy
ourser
verf
ort
roubl
eshoot
ing
pur
pose.
Tor
unsosr
epor
t, 
sos 
packageshoul
dbei
nst
all
ed.Sospackagei
spar
tofdef
aul
t
i
nst
all
ati
oni
nmostofl
i
nux.I
f f
oranyr
easont
hispackagei
snoi
nst
all
ed,t
henuse
bel
owy
um commandt
oinst
all
 
sospackage 
:
#y
um i
nst
all
sos-
y
Gener
atet
hesosr
epor
t:
Opent
het
ermi
nalandt
ypesosr
epor
tcommand:
#sosr
epor
t
Thi
s command wi
l
lnor
mal
l
ycompl
ete wi
thi
n a 
few mi
nut
es.Dependi
ng on l
ocal
conf
igur
ati
onandt
heopt
ions speci
fi
edi
nsomecasest
hecommandmayt
akel
onger

Rat
nakar
Page121
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
ofi
nish.Oncecompl
eted,
sosr
epor
twi
l
lgener
atea compr
essed a f
il
e
under
 /t
mp 
fol
der
.Di
ff
erentv
ersi
onsusedi
ff
erentcompr
essi
onschemes(
gz,
 
bz2,or
 xz)
.
Thef
il
eshoul
dbepr
ovi
dedt
oRedhatsuppor
trepr
esent
ati
ve(
nor
mal
l
yasanat
tachmentt
o
anopencase)
.
Not
e: sosr
epor
trequi
res 
root
 per
missi
onst
orun.
Di
ff
erentOpt
ionsusedi
nsosr
epor
tcommand:
Thesosr
epor
tcommandhasa 
modul
arst
ruct
ure 
andal
l
owst
heusert
oenabl
eand
di
sabl
emodul
esandspeci
fymodul
e opt
ions v
iat
he command l
i
ne.To 
li
st av
ail
abl
e
modul
es 
(pl
ug-
ins)uset
hef
oll
owi
ngcommand:
#sosr
epor
t-l
To 
tur
nof

amodul
eincl
udei
tinacomma-
separ
atedl
i
stofmodul
espassedt
othe 
-
n/
–ski
p-pl
ugi
ns 
opt
ion.For i
nst
ancet
odi
sabl
ebot
hthe 
kvmand 
amd 
modul
es:
#sosr
epor
t-nkv
m,amd
I
ndi
vi
dualmodul
esmaypr
ovi
deaddi
ti
onalopt
ionst
hatmaybespeci
fi
ed v
iat
he 
-

opt
ion.
 Forexampl
eonRed HatEnt
erpr
iseLi
nux5i
nst
all
ati
onst
hesos 
rpm 
modul
e
col
l
ect
s"r
pm -
Va"out
putbydef
aul
t.Ast
hismay be 
ti
me-
consumi
ng 
the behav
iour may
bedi
sabl
edv
ia:
#sosr
epor
t-kr
pm.
rpmv
a=of
f
16.Whati
sthecommandt
oseet
hecompl
etei
nfor
mat
iononv
irt
ualmemor
y?
#v
mst
at i
sthecommandt
othecompl
etei
nfor
mat
iononv
irt
ual
memor
yli
kenoof
pr
ocesses,memor
y usage,pagi
ngmemor
y,bl
ockI
/O(
input/
out
put
),t
raps,di
sk
and CPUact
ivi
ty.
#v
mst
at2 10 (
Itwi
l
lgi
vet
her
epor
tforev
ery 2secondsupt
o10
t
imes)
Thef
iel
dsar
e,r -
--
--
> howmanywai
ti
ngpr
ocesses
b -
--
--
> howmanypr
ocessesar
ebusy
swapd-
--
--
> howmuchv
irt
ual
memor
yused
f
ree -
--
--
> howmuchmemor
yisf
reel
yav
ail
abl
e
buf
fer-
--
--
> howmucht
empor
arymemor
yusi
ng
cachi
ng -
--
--
> howmuchcachi
ngst
il
lusi
ng
swapi
n--
--
-> howmuchdat
atr
ansf
err
edf
rom RAM t
oswap
swapout-
--
> howmuchdat
atr
ansf
err
edf
rom swapt
oRAM
bi -
--
--
> howmuchbl
ocki
nput
bo -
--
--
> howmuchbl
ockout
put
sy
stem i
n--
->t
heno.ofi
nter
rupt
s
sy
stem cs-
--
>theno.ofcont
ext
schanged
#v
mst
at -
a (
toseet
heact
iveandi
nact
ivepr
ocesses)
#v
mst
at -
d (
toseet
hest
ati
sti
csoft
hedi
skused)
#cat/
proc/
memi
nfo (
toseet
hepr
esentmemor
yinf
ormat
ion)
17.Whati
sthecommandt
oseet
heI
/O st
ati
sti
cs?

Rat
nakar
Page122
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#i
ost
at (
toseet
heI
nputandOut
putst
ati
sti
csi
ntheLi
nux
sy
stem)
* Thi
scommandi
susedt
omoni
tor
ingt
hesy
stem i
nputandout
putst
ati
sti
csand
pr
ocessest
ransf
err
ate.
*I
tisal
sousedt
omoni
torhowmanyki
l
oby
tesr
eadpersecondandhowmanyki
l
o
by
tesr
eadandwr
it
e, showsCPUl
oadav
eragest
ati
sti
cssi
ncet
hel
astr
ebooti
n
f
ir
stl
i
neandmostcur
rentdat
aisshowni
nthe secondl
i
ne.
18.HowmanyCPUs ar
ether
eint
hesy
stem?
#cat/
proc/
cpui
nfo commandwi
l
lshow no.ofCPUs,no.ofcor
es,
no.oft
hreads,
no.ofsocket
sandt
he CPUar
chi
tect
ure,
..
.et
c.,i
nfor
mat
ion.
#npr
oc commandwi
l
lgi
vet
heno.ofCPUspr
esenti
nthesy
stem.
#l
scpu commandwi
l
lgi
vet
hei
nfor
mat
iont
hear
chi
tect
ureoft
heCPU(
x86_
64or
x86_
32)
,no.ofcor
es,no. oft
hreads,no.ofsocket
s,cachememor
ysi
zes(
L1,L2,L
3,
..
.et
c),CPUspeedandt
hev
endoroft
heCPU.
19.Howt
osendt
hepr
ocessori
ntoof
fl
ine?
#l
s-l/
sys/
dev
ices/
syst
em/
cpu i
sthecommandt
oseet
heno.ofpr
ocessor
s
pr
esenti
nthesy
stem.
#echo 0> /
sys/
dev
ices/
syst
em/
cpu/
cpu4/
onl
ine i
sthecommandt
osendt
he
CPU4i
ntoof
fl
ine.
#gr
ep "
processor
"/pr
oc/
cpui
nfo or #cat/
sys/
dev
ices/
syst
em/
cpu/
off
li
ne ar
e
t
hecommandt
oseet
he pr
ocessorst
atuswhet
herof
fl
ine.
20.Howt
osendt
hepr
ocessori
ntoonl
ine?
#l
s-l/
sys/
dev
ices/
syst
em/
cpu i
sthecommandt
oseet
heno.ofpr
ocessor
s
pr
esenti
nthesy
stem.
#echo 1> /
sys/
dev
ices/
syst
em/
cpu/
cpu4/
onl
ine i
sthecommandt
osendt
he
CPU4i
ntoof
fl
ine.
#gr
ep "
processor
"/pr
oc/
cpui
nfo or #cat/
sys/
dev
ices/
syst
em/
cpu/
onl
ine ar
e
t
hecommandt
oseet
he pr
ocessorst
atuswhet
heronl
i
ne.
21.Howt
ocl
ear/
varand/
tmpdi
rect
ori
es?
(
i)Copyal
ltheent
ri
esoft
hosedi
rect
ori
esi
ntoasepar
atel
ocat
ions.
(
ii
)Redi
rectt
henul
lval
uesi
n/v
arand /
tmpdi
rect
ori
esbyexecut
ingt
hebel
ow
commands.
#cat/
dev
/nul
l >/
var (
tonul
l
ify
ingt
he/
vardi
rect
ory
)
#cat/
dev
/nul
l >/
tmp (
tonul
l
ify
ingt
he/
tmpdi
rect
ory
)
22.Howt
otr
oubl
eshooti
fdf-
kisgi
vi
nger
ror
?
(
i)Fi
rstcheckwhi
chf
il
esy
stem i
sgi
vi
nger
rorby#df -
k commandt
henseewhet
her
anyf
il
esar
eopenedor not
.Ifopenedt
hencl
oset
hosef
il
esbyi
nfor
mingt
hose
t
eamswhi
char
eusi
ngt
hatf
il
esy
stem.
(
ii
)Unmountt
hatf
il
esy
stem byt
aki
ngappr
oval
from hi
gheraut
hor
it
iesandr
unf
sckon
t
hatf
il
esy
stem,
then nor
mal
l
yitwi
l
lbesol
vedi
fwer
unf
sckcommand.

Rat
nakar
Page123
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
ii
i) I
fnotsol
vedev
ent
houghwer
unf
sckt
hendel
eteorr
emov
ethatf
il
esy
stem,
r
ecr
eat
ethatf
il
esy
stem, mountt
hatf
il
esy
stem andr
est
oret
hedat
afr
om r
ecent
backup.
23.Whatar
ethedi
ff
erencesbet
weenadeamon andapr
ocess?
(
i)Deamoni
saser
vicet
opr
ovi
desomeser
vicest
otheuser
s,wher
easapr
ocessi
sto
dosomepar
ti
cul
art
asks.
(
ii
)Wecanenabl
eordi
sabl
ethedeamon,butwecannotdi
sabl
eorenabl
ethe
pr
ocess.
(
ii
i) Wecandost
artorst
opt
hedeamon,butwecannotst
artorst
opt
he
pr
ocess.Weonl
yki
l
lthepr
ocess.
(
iv) Wecanenabl
eordi
sabl
etost
artt
hedeamonsatboott
imeasperour
r
equi
rement
,ie.
,ondemandi
s possi
ble,buti
tisnotpossi
blei
fisa
pr
ocess.
(
v)Deamoni
sabackgr
oundpr
ocesswher
easpr
ocessi
saf
oregr
oundpr
ocess.
24.Whati
scommandt
ocheckt
hel
oadav
erage?
#upt
ime i
sthecommandt
ocheckt
hesy
stem l
oad,pr
esentt
ime,f
rom howmany
hour
sthesy
stem i
s r
unni
ngandl
oadav
erage.
* Thel
oadav
erageshowst
hreef
iel
ds.The1stf
iel
dshowst
hel
oadav
eragef
rom 1
mi
nut
e,2ndf
iel
dshows t
hel
oadav
eragef
rom 5mi
nut
es and 3r
dfi
eld
showst
hel
oadav
eragef
rom 15mi
nut
es.
25.Howt
oassi
gnorshi
ftt
hepr
ocesst
othepar
ti
cul
arCPU?
(
i)Fi
rsti
nst
allut
il
-l
inux packageby#y
um i
nst
allut
il
-l
inux -
y command.
(
ii
)Checkt
hespeci
fi
edpr
ocessi
sassi
gnedt
owhi
chpr
ocessori
e.,
whi
chCPU by#
t
askset -
p <pi
d> command.
(
ii
i)Thenshi
ftt
hepr
ocesst
oanot
herav
ail
abl
eCPUby #t
askset -
cp <cpu-
l
ist
><pi
d> command.
Exampl
es:
#t
askset -
p 2125 (
tocheckwhi
chpr
ocessori
sassi
gnedt
othat
pr
ocessI
D)
#t
askset -
cp 0,
4 2125 (
toshi
ftt
hepr
ocesst
otheCPUs0and
4)
#t
askset 0 f
ir
efox (
toassi
gnt
hef
ir
efoxpr
ocesst
otheCPU 0)
26.Howt
oli
mitt
heCPU usageofal
inuxpr
ocess?
(
a)Fi
rsti
nst
all
thecpul
imi
tpackageby #y
um i
nst
allcpul
i
mit-
y command.
* Thi
spackagei
snotav
ail
abl
einnor
mal
Linuxpackagesandi
tisav
ail
abl
einEPEL
(
Ext
raPackagesf
or Ent
erpr
iseLi
nux)
.So,f
ir
stwehav
etoenabl
ethe
EPELr
eposi
tor
yinoursy
stem byf
oll
owi
ngst
eps.
(
i)#y
um i
nst
allepel
-r
elease-
y (
toi
nst
all
theepel
-r
elease
packagei
nRHEL-7)
(
ii
)#r
pm -
Uvh ht
tp:
//mi
rr
ors.
ker
nel
.or
g/f
edor
a-epel
/6/
i386/
epel
-r
elease-
6-

Rat
nakar
Page124
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

8.
noar
ch.
rpm (
toi
nst
all
the
EPELpackagei
nRHEL-6)
(
ii
)#r
pm -
Uvh ht
tp:
//mi
rr
ors.
ker
nel
.or
g/f
edor
a-epel
/5/
i386/
epel
-r
elease-
5-
4.
noar
ch.
rpm (
toi
nst
all
the
EPELpackagei
nRHEL-5)
(
ii
i)#r
pm -
-i
mpor
t/et
c/pki
/r
pm-
gpg/
RPM-
GPG-
KEY-
EPEL-
5 (
toi
mpor
tthegpg
keyi
fitaskwhen
execut
ingt
heabov
ecommandi
nRHEL-5)
(
iv)#r
pm -
-i
mpor
t/et
c/pki
/r
pm-
gpg/
RPM-
GPG-
KEY-
EPEL-
6 (
toi
mpor
tthegpg
keyi
fitaskwhen
execut
ingt
heabov
ecommandi
nRHEL-6)
(
v)#r
pm -
-i
mpor
t/et
c/pki
/r
pm-
gpg/
RPM-
GPG-
KEY-
EPEL-
7 (
toi
mpor
tthegpg
keyi
fitaskwhen
execut
ingt
heabov
ecommandi
nRHEL-7)
(
vi)#y
um r
epol
i
st (
tocheckEPELr
epol
i
st)
(
b)#cpul
i
mit-
p <PI
D> -
l 10 (
toseet
heCPU usageoft
hatpr
ocess
andl
i
mitt
heCPUusaget
o
10%)
(
c)#cpul
i
mit-
e/usr
/l
ocal
/bi
n/my
prog -
l20 (
tol
i
mitt
heCPUusageoft
his
commandt
o20%)
27.Howt
ocapt
uret
henet
wor
ktr
aff
ic?
#t
cpdump i
sthecommandt
ocapt
ureandanal
yzet
henet
wor
ktr
aff
ic.Byusi
ngt
his
commandwecanal
so t
roubl
eshoott
henet
wor
kpr
obl
ems.
Exampl
es:
#t
cpdump (
tocapt
ureandanal
yzet
henet
wor
k
t
raf
fi
c)
#t
cpdump -
i et
h0 (
tocapt
uret
henet
wor
ktr
aff
icf
rom et
h0cont
inuousl
y
andCt
rl+ct
oexi
t)
#t
cpdump -
c 30 -
i et
h0 (
tocapt
uret
henet
wor
ktr
aff
icf
rom et
h0
upt
o30packet
sonl
y)
#t
cpdump -
w /
root
/tcp.
pcap -
i et
h0 (
tocapt
uret
henet
wor
ktr
aff
ic
f
rom et
h0andwr
it
ethati
n
/
root
/tcp.
pcap f
il
e)
#t
cpdump -
ttt -
r/r
oot
/tcp.
pcap (
tor
eadt
hecont
ent
soft
he
abov
ecapt
uredf
il
e)
#t
cpdump -
i et
h0 por
t22 (
tocapt
uret
henet
wor
ktr
aff
icf
rom
et
h0ofssht
raf
fi
c)
#t
cpdump -
i et
h0 dst 172.
25.
0.11and por
t22 (
tocapt
uret
henet
wor
k
t
raf
fi
cfr
om 172.
25.
0.11
sy
stem ofssht
raf
fi
c)

Rat
nakar
Page125
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

28.Whati
sSARut
il
it
yandhowt
ousei
t?
SAR st
andsf
orSy
stem Act
ivi
tyRepor
t.Usi
ngSARwecancheckt
hei
nfor
mat
ionof
CPUusage,memor
y,swap,I
/O,di
skI
/O,net
wor
kingandpagi
ng.Wecangett
he
i
nfor
mat
ionoft
hepr
esentst
atusandpostst
atus(
hist
oryusi
ngt
hedat
a)upt
olast7day
s
becauseHI
STORY=7 i
sther
eint
heconf
igur
ati
onf
il
e.Thel
og messagesar
est
oredi
n
/
var
/log/
sa/
sa1,/
var
/log/
sa/
sa2,/
var
/log/
sa/
sa3,
..
..
etc.
,(wher
e1,
2,3,
..
..
etc.
,ar
e
dat
es)
.TheSAR conf
igur
ati
oni
sst
oredi
n/et
c/sy
sconf
ig/
sysst
atf
il
e.I
nthi
sfi
l
ethe
HI
STORY=7def
aul
t opt
ionwi
l
l bet
her
e.So,
wecanchanget
hedef
aul
t7day
stoour
r
equi
redv
alue.

Bef
oreusi
ngt
heSAR ut
il
it
yfi
rstweshoul
dinst
all
theSARut
il
it
ypackageby#y
um
i
nst
allsy
sst
at*-
y command.
Exampl
es:
#sar 2 10 (
Itwi
l
lgi
vet
hesy
stem r
epor
tforev
ery2
secondsupt
o10t
imes)
#sar-
p 2 10 (
toseet
heCPUut
il
izat
ionf
orev
ery2
secondsupt
o10t
imes)
#sar-
pALL -
f/v
ar/
log/
sa/
sa25 (
tocheckt
heCPUut
il
izat
ionon25t
h
dayoft
hecur
rentmont
h)
#sar-
pALL -
f/v
ar/
log/
sa/
sa10 -
s 07:
00:
00 -
e 15:
00:
00 (
tocheckt
heCPU
ut
il
izat
ionon10t
hdayof t
hecur
rentmont
hfr
om 7:
00t
o15:
00
hr
s.wher
e-smeansst
artt
ime -
eendt
ime)
#sar-
r2 10 (
toseet
hememor
yut
il
izat
ionf
orev
ery2
secondsupt
o10t
imes)
#sar-
r-f/
var
/l
og/
sa/
sa14 (
tocheckt
hememor
yut
il
iz
ati
onon14t
hdayof
t
hecur
rentmont
h)
#sar-
r-f/
var
/l
og/
sa/
sa10 -
s 07:
00:
00 -
e 15:
00:
00 (
tocheckt
hememor
y
ut
il
izat
ionon10t
hdayof t
hecur
rentmont
hfr
om 7:
00t
o
15:
00hr
s.wher
e-smeansst
artt
ime -
eendt
ime)
#sar-
S 2 10 (
toseet
heswaput
il
izat
ionf
orev
ery2
secondsupt
o10t
imes)
#sar-
S-f/
var
/l
og/
sa/
sa25 (
tocheckt
heswaput
il
iz
ati
onon25t
hdayof
t
hecur
rentmont
h)
#sar-
S-f/
var
/l
og/
sa/
sa10 -
s 07:
00:
00 -
e 15:
00:
00 (
tocheckt
heswap
ut
il
izat
ionon10t
hdayoft
he cur
rentmont
hfr
om 7:
00t
o
15:
00hr
s.wher
e-smeansst
artt
ime -
eendt
ime)
#sar-
q 2 10 (
toseet
hel
oadav
eragef
orev
ery2
secondsupt
o10t
imes)
#sar-
q-f/
var
/l
og/
sa/
sa14 (
tocheckt
hel
oadav
erageon14t
hdayof
t
hecur
rentmont
h)

Rat
nakar
Page126
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#sar-
q-f/
var
/l
og/
sa/
sa10 -
s 07:
00:
00 -
e 15:
00:
00 (
tocheckt
hel
oad
av
erageon10t
hdayoft
he cur
rentmont
hfr
om 7:
00t
o
15:
00hr
s.wher
e-smeansst
artt
ime -
eendt
ime)
#sar-
B 2 10 (
toseet
hepagi
ngi
nfor
mat
ionf
orev
ery2
secondsupt
o10t
imes)
#sar-
d 2 10 (
toseet
hedi
skusagef
orev
ery2
secondsupt
o10t
imes)
#sar-
m 2 10 (
toseet
hepowermanagementf
orev
ery2
secondsupt
o10t
imes)
#sar-
b 2 10 (
toseet
hedi
ski
nputandout
putst
ati
sti
csf
orev
ery2
secondsupt
o10t
imes)
29.Whatar
ethepor
tno.f
ordi
ff
erentser
vices?
ThePor
tno.l
i
st:
FTP (
Fordat
atr
ansf
er) 20 HTTP 80
FTP (
Forconnect
ion) 21 POP3 110
SSH 22 NTP 123
Tel
net 23 LDAP 389
SendMai
l orPost
fi
x 25 LogSer
ver 514
DNS 53 HTTPS 443
DHCP (
ForSer
ver
) 67 LDAPS(
LDAP+SSL) 636
DHCP (
ForCl
i
ent
) 68 NFS 2049
TFTP(Tr iv
ialFi
l
etransf
er) 69 Squi
d 3128
Sambashar edname
137 SambaDat
aTr
ansf
er 138
ver
if
ication
SambaConnect i
on
138 SambaAut
hent
icat
ion 445
Est
ablishment
MySQL 3306 I
SCSI 3260

* Pi
ngi
snotusedanypor
tnumber
.Iti
susedI
CMP (
Int
ernetCont
rolMessage
Pr
otocol
)onl
y.
Ot
herusef
ulcommands:
#upt
ime (
toseef
rom howl
ongt
hesy
stem i
srunni
ngandal
sogi
vest
hel
oad
av
erager
epor
t)
* Thel
oadav
eragei
shav
ing 3f
iel
ds.1-pr
esentst
atus,2-5mi
nut
esbackand3-
15mi
nut
esback.
#i
ost
at 5 2 (
tomoni
tort
hei
nputandout
putst
ati
sti
csf
orev
ery5
secondsupt
o10t
imes)
#npr
oc (
tocheckhowmanypr
ocessor
s(CPUs)
ar
ether
eint
hesy
stem)
#t
op 1 (
toseet
heno.pr
ocessor
s(CPUs)ar
e

Rat
nakar
Page127
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
her
eint
hesy
stem)
#i
ptr
af (
tomoni
tort
heTCP ornet
wor
ktr
aff
icst
ati
sti
csi
n
gr
aphi
cal
mode)
* Bef
oreusi
ngt
hiscommandi
nst
all
thei
ptr
afpackageby#y
um i
nst
alli
ptr
af*-
y
command.
#i
ft
raf -
ng -
f et
h0 (
toseet
heI
Ptr
aff
icst
ati
sti
cs
i
ngr
aphi
cal
mode)
#l
scpu (
toseet
heno.ofCPUspr
esent
i
nthesy
stem)
#l
susb (
toseet
heno.ofUSBdev
icespr
esent
i
nthesy
stem)
#l
sbl
k (
toseeal
lthepar
ti
ti
onsorbl
ock
dev
icesi
nfor
mat
ion)
#cat/
etc/
redhat
-r
elease (
toseet
he
RHELv
ersi
onofsy
stem)
#dmi
decode (
toseet
hecompl
etehar
dwar
e
i
nfor
mat
ionoft
hesy
stem)
#dmi
decode -
t memor
y (
toseet
hememor
y
i
nfor
mat
ionoft
hesy
stem)
#dmi
decode -
t bi
os (
toseet
hesy
stem'
sbi
os
i
nfor
mat
ion)
#dmi
decode -
t sy
stem (
tosee
t
hesy
stem'
sinf
ormat
ion)
#dmi
decode -
t pr
ocessor t
oseet
hepr
ocessor
's(
CPU'
s)
i
nfor
mat
ionoft
hesy
stem)
#dmi
decode -
t1 (
tocheckt
heSy
stem'
s
Ser
ialNo.i
nfor
mat
ion)
#dmi
decode -
t4 (
toseet
hepr
ocessor
's
(
CPU'
s)i
nfor
mat
ion)
#dmi
decode -
t 16 (
tocheckt
heMax.RAM
capaci
tyoft
hesy
stem)
#dmi
decode -
t 17 (
tocheckhowmuchRAM
t
hesy
stem i
susi
ng)
#pi
dst
at (
tomoni
tor
ingt
hei
ndi
vi
dual
taskscur
rent
lybei
ng
managedbyt
heLi
nuxker
nel
)
#nf
siost
at (
tomoni
tort
heNFS
i
nputandout
putst
ati
sti
cs)
#ci
fsi
ost
at (
tomoni
tort
heSamba
i
nputandout
putst
ati
sti
cs)
#st
at <f
il
ename ordi
rect
oryname> (
toseet
hest
ati
sti
csof

Rat
nakar
Page128
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
hef
il
eordi
rect
ory
)
#st
ri
ngs <commandname> (
tor
eadt
hebi
nar
y
l
anguageoft
hecommand)
#f
ind / -
nouser -
o -
nogr
oup (
toseet
hef
il
eswhi
char
enobel
ongs
t
oanyuserandanygr
oup)
#sy
stemct
l -
t hel
p (
toseet
hel
i
stofsy
stemd
obj
ect
sthatar
eav
ail
abl
e)
#sy
stemct
l -
l hel
p (
toseet
he
l
i
stofuni
tnames)
#sy
stemct
lli
st-
dependenci
es <ser
vicename> (
toseet
hedependent
ser
vicesi
nat
reemanner
)
#sl
eep <seconds>& (
tor
unt
hesl
eep
pr
ocessesatbackgr
ound)
#j
obs (
toseet
hebackgr
oundj
obswhi
ch
wer
esentbyt
heuser
)
#f
g %<Job I
D> (
togetbackt
he
backgr
oundj
obt
ofor
egr
oundj
ob)
#Ct
rl+z (
to
st
opt
hepr
ocess)
#bg %<Job I
D> (
tor
est
artt
hepr
ocess
agai
natbackgr
ound)
* Whent
her
ear
est
oppedj
obsandwantt
oexi
tfr
om t
het
ermi
nal
then,
awar
ning
messagewi
l
lbedi
spl
ayed. I
fwet
ryagai
ntoex
itf
rom t
het
ermi
nal
,
thent
he
st
opped orsuspendedj
obswi
l
lbeki
l
ledaut
omat
ical
l
y.

14.FTP(
Fil
eTr
ansf
erPr
otocol
)Ser
ver

1 Whati
sFTP?
FTP st
andsf
orFi
l
eTr
ansf
erPr
otocol
usedt
otr
ansf
erf
il
esf
rom onehostt
oanot
her
hostov
eraTCP-
basednet
wor
k.

Rat
nakar
Page129
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

2. How f
tpwor
ks?
FTPi
sbui
l
toncl
i
ent
-ser
verar
chi
tect
ureandut
il
iz
essepar
atecont
rol
anddat
a
connect
ionbet
weent
hecl
i
entandser
ver
.FTPuser
smayaut
hent
icat
ethemsel
ves
usi
ngacl
ear
-t
extsi
gn-
inpr
otocol
butcanconnectanony
mousl
yift
heser
veri
s
conf
igur
edt
oal
l
owi
t.
Usual
l
y,t
heFTPser
ver
,whi
chst
oresf
il
est
obet
ransf
err
ed,
usest
wopor
tsf
ort
he
t
ransf
err
ingpur
pose.Onepor
tforcommandsandanot
herpor
tforsendi
ngand
r
ecei
vi
ngdat
a.Request
ingf
rom cl
i
entcomput
ersar
erecei
vedatt
hepor
t21ofser
ver
.
i
e.,
iti
sexcl
usi
vel
yreser
vedf
orsendi
ngcommands,
ther
efor
eiti
scal
l
edt
heCommand
Por
t.
Onceani
ncomi
ngr
equesti
srecei
ved,
thedat
arequest
edorupl
oadedbyt
hecl
i
ent
comput
eri
str
ansf
err
edt
hroughasepar
atepor
t22andr
efer
redasDat
aPor
t.Att
his
poi
nt,
dependi
ngont
heAct
iveorPassi
vemodeoft
heFTPconnect
ion,t
hepor
t
numberusedf
ort
heDat
aTr
ansf
erVar
ies.
3. Whati
sAct
iveFTP?
I
nAct
iveFTPconnect
ion,
theconnect
ioni
sini
ti
atedbyt
heCl
i
ent
,andt
hedat
a
connect
ioni
sini
ti
atedbyt
heSer
ver
.Andast
heser
veract
ivel
yest
abl
i
shest
hedat
a
connect
ionwi
tht
hecl
i
ent
,hencei
tiscal
l
edt
heAct
iveFTP.Her
ethecl
i
entopensupa
por
thi
ghert
han1024andi
tconnect
stot
heser
vert
hroughpor
t21.Thent
heser
ver
opensi
tspor
t20t
oest
abl
i
shadat
aconnect
ion.
4. Whati
sPassi
veFTP?
I
nPassi
veFTP connect
ion,
bot
hcommandanddat
aconnect
ionsar
eest
abl
i
shedby
t
hecl
i
ent
.Int
hist
heser
veract
sasent
ir
elypassi
ve,
that
'swhyi
tiscal
l
edt
hePassi
ve
FTP.Her
etheser
verl
i
stensf
ori
ncomi
ngr
equest
edconnect
ionsf
rom cl
i
entt
hrough
por
t21andt
hecl
i
ental
soi
nit
iat
est
hedat
aconnect
ionatpor
t20.
5. Whati
sthemai
ndi
ff
erencebet
weent
heAct
iveFTP andPassi
veFTP?
Themai
ndi
ff
erencebet
weent
heAct
iveFTP andt
hePassi
veFTPi
sbasedonwho
i
nit
iat
est
hedat
aconnect
ionbet
weent
heser
verandt
hecl
i
ent
.Ift
hedat
aconnect
ioni
s
i
nit
iat
edbyt
heser
ver
,thati
scal
l
edAct
iveFTP andi
fthedat
aconnect
ioni
sini
ti
atedby
t
hecl
i
ent
,thati
scal
l
edPassi
veFTP.
6. Whati
sthepr
ofi
lef
orFTPser
ver
?
(
i)I
tisusedf
orupl
oadi
nganddownl
oadi
ngt
hef
il
esanddi
rect
ori
escannotbe
downl
oaded.
(
ii
)TheFTPser
verpackagei
svsf
tpd.
(
ii
i)TheFTPcl
i
entpackagesar
eft
p and l
ft
p.
(
iv) TheFTPser
verdeamoni
svsf
tpd (
Ver
ySecur
eFTPdeamon)
(
v)TheFTPscr
ipt
ingf
il
eis/
etc/
ini
td/
vsf
tpd
(
vi)
Por
tnumber
s 20f
ordat
aconnect
ionand21f
orFTP commandconnect
ion.
(
vii
)Thedocumentr
ootf
orFTPi
s/v
ar/
ftp
(
vii
i
)TheFTPhomedi
rect
oryi
s/v
ar/
ftp

Rat
nakar
Page130
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
ix)TheFTPconf
igur
ati
onf
il
esar
e,
(
a)/
etc/
vsf
tpd/
vsf
tpd.
conf
(
b)/
etc/
vsf
tpd/
user
_li
st
(
c)/
etc/
vsf
tpd/
ftpuser
(
d)/
etc/
pam.
d/v
sft
pd
7. Howt
oconf
igur
etheFTPser
ver
?
(
i)I
nst
all
theFTPpackageby#y
um i
nst
allv
sft
pd* -
y command.
(
ii
)Got
oFTPdocumentr
ootdi
rect
oryandcr
eat
esomef
il
esby#cd /
var
/ft
p/pub
#t
ouchf
(1.
.10}
(
ii
i)Rest
artt
heFTPser
viceordeamonby#ser
vicev
sft
pdr
est
artcommandi
nRHEL
-6.
#sy
stemct
lrest
artv
sft
pd commandi
nRHEL-7.
(
iv)Maket
heFTPser
viceordeamonenabl
eev
enaf
terr
eboott
heser
verby
#chkconf
igv
sft
pdon commandi
nRHEL-6 and #sy
stemct
lenabl
evsf
tpd
commandi
nRHEL-7.
(
v)Addt
heFTPser
vicet
otheI
Ptabl
es(
RHEL-6)and Fi
rewal
l
d(RHEL-7)
.
RHEL-6:
#i
ptabl
es -
A I
NPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t21-
j
ACCEPT
#i
ptabl
es -
A OUTPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t21-
j
ACCEPT
#i
ptabl
es -
A I
NPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t20-
j
ACCEPT
#i
ptabl
es -
A OUTPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t20-
j
ACCEPT
RHEL-7:
#f
ir
ewal
l-
cmd -
-per
manent -
add-
ser
vice=f
tp commandi
nRHEL-7.
#f
ir
ewal
l-
cmd -
-compl
ete-
rel
oad commandi
nRHEL-7.
8. Howt
oconf
igur
etheFTPcl
ientandhowt
oconnectt
hef
tpser
ver
?
(
i)Got
othecl
i
entmachi
neandi
nst
all
theFTP andLf
tp packages.
#y
um i
nst
allf
tp* l
ft
p* -
y
(
ii
)Connectt
heFTPser
verf
rom cl
i
ent
.
#f
tp <FTPser
verI
Paddr
ess orser
verhostname>
Exampl
e:#f
tp 172.
25.
9.11orf
tp:
//ser
ver
.exampl
e.com
User
name:f
tp
Passwor
d:<pr
essent
erkey
>
f
tp>l
s (
toseet
hef
il
esi
ntheFTPdocumentr
ootdi
rect
ory
)
(
ii
i) Wecanal
soconnectt
heFTPser
vert
hroughbr
owser
.
(
i)Opent
hewebbr
owserandt
ypei
naddr
essbaras,
f
tp:
//172.
25.
9.11 orf
tp:
//ser
ver
.exampl
e.com

Rat
nakar
Page131
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

9. Howt
oconf
igur
etheSecur
eFTPser
ver
?
(
i)Opent
heFTP conf
igur
ati
onf
il
eby#v
im /
etc/
vsf
tpd/
vsf
tpd.
conf command.
(
ii
)Got
oli
neno:
12andt
ypeas,anany
mous_
enabl
e=no (
sav
eandex
itt
hef
il
e)
* anany
mous_
enabl
e=y
es (
bydef
aul
t)
I
tmeansany
bodycanl
ogi
ntot
heFTPser
verwi
thoutanyuser
nameandpasswor
d.
I
fanany
mous_
enabl
e=no,t
henwemustpr
ovi
det
heuser
nameandpasswor
ds
wheni
tpr
ompt
s.
(
ii
i)Rest
artt
hef
tpdeamonby #ser
vice v
sft
pd r
est
art commandi
nRHEL-6 or
#sy
stemct
lrest
artv
sft
pd commandi
nRHEL-7.
(
iv)Assi
gnt
heFTPuserpasswor
dby #passwd f
tp(
typeandr
ety
pet
hef
tpuser
passwor
d)
(
v)Got
ocl
i
entsi
deandconnectt
heFTP ser
verby#f
tp 172.
25.
9.11 command.
10.Howt
oconf
igur
etheFTP ser
vert
oupl
oadt
hef
il
esf
eat
ure?
(
i)Opent
heFTP conf
igur
ati
onf
il
eby#v
im/
etc/
vsf
tpd/
vdf
tpd.
conf command.
(
ii
)Got
oli
neno:
19andt
ypeas, wr
it
abl
e_enabl
e=y
es
(
ii
i)Got
oli
neno:
29 and t
ypeas,anon_
upl
oad_
enabl
e=y
es (
sav
eand
exi
tthef
il
e)
(
iv)Maket
heupl
oaddi
rect
oryi
n/v
ar/
ftp/
pub di
rect
oryby #mkdi
r
/
var
/ft
p/pub/
upl
oad
(
v)Changet
hegr
oupoft
heupl
oaddi
rect
oryasf
tpby#chgr
pft
pupl
oad
command.
(
vi) Changet
heper
missi
onsoft
heupl
oaddi
rect
oryby #chmod 775upl
oad
command.
(
vii
)Toper
manent
lyaddt
hef
tpser
vicet
oSELi
nuxpol
i
cyby
#get
sebool -
a|gr
ep f
tp (
tocheckt
heSELi
nuxBool
eans
f
orFTPser
vice)
#set
sebool -
p al
low_
ftpd_
anon_
wri
te on
#chcon -
tpubl
ic_
cont
ent
_rw_
t upl
oad (
toaddr
ead-
wri
tecont
extoft
he
upl
oaddi
rect
ory
)
#set
sebool -
pft
p -
-f
ull
-access=1 command or#set
enf
orce=0 command
t
odi
sabl
etheSELi
nux.
(
vii
i
)Rest
artt
hef
tpdeamonby #ser
vice v
sft
pd r
est
art commandi
nRHEL-6 or
#sy
stemct
lrest
artv
sft
pd commandi
nRHEL-7.
11.Howt
odenyt
hepar
ti
cul
arsy
stem t
ouset
heFTP ser
ver
?
(
i)Opent
he/
etc/
host
s.deny f
il
eandputanent
ryofsy
stem whi
chonet
odenyt
hef
tp
ser
vice.
#v
im /
etc/
host
s.deny (
got
olastl
i
neandt
ypeasbel
ow)
v
sft
pd: 172.
25.
9.10 (
todeny172.
25.
9.10sy
stem)
v
sft
pd: ALL (
todenyal
lthesy
stems)
v
sft
pd: ALL EXCEPT *
.exampl
e.com (
todenyal
lthesy
stemsex
cept

Rat
nakar
Page132
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

exampl
e.com domai
nsy
stems)
(
sav
eandexi
tthef
il
e)
(
ii
)Rest
artt
hef
tpdeamonby #ser
vice v
sft
pd r
est
art commandi
nRHEL-6 or
#sy
stemct
lrest
artv
sft
pd commandi
nRHEL-7.
*Now172.
25.
9.10sy
stem wi
l
lnotaccesst
heFTPser
vices.
*I
fweputanent
ryi
n/et
c/host
s.al
low f
il
eas,ALLOW ALLEXCEPT 172.
25.
5.10
t
hen,except 172.
25.
5.10sy
stem al
lthesy
stemscanav
ail
theFTP ser
vice.
12.Howt
ochanget
heowner
shi
poft
heupl
oadedf
il
einFTP?
I
fweupl
oadordownl
oadanyf
il
est
hef
il
esownerandgr
oupar
eft
ponl
y.Wecan
changet
heowner
shi
poft
heupl
oadedordownl
oadedf
il
esasf
oll
ows.
(
i)Opent
heFTP conf
igur
ati
onf
il
eby #v
im/
etc/
vsf
tpd/
vsf
tpd.
conf command.
(
ii
)Got
oli
neno:
48andt
ypeas, chown_
upl
oad=y
es
(
ii
i)Got
oli
neno:
49andt
ypeas,chown_
user
name=<username>
(
iv)Wecandi
spl
ayt
hebannerwhenweconnectt
heFTPser
verbyuncommentonl
i
ne
no:
86andt
ypeas, f
tp_
banner
="Wel
comet
oHy
der
abad"
(
v)Wecanl
i
mitt
heFTP maxi
mum connect
ionsatat
imet
o5byputanent
ryi
n
conf
igur
ati
onf
il
eas,
max_
cli
ent
s=5 (
sav
eandexi
tthef
il
e)
(
v)Rest
artt
hef
tpdeamonby #ser
vice v
sft
pd r
est
art commandi
nRHEL-6 or
#sy
stemct
lrest
artv
sft
pd commandi
nRHEL-7.
13.Howt
odenyspeci
fi
cuser
stoaccesst
hef
tpser
vices?
(
i)Opent
heFTP user
sfi
l
eby#v
im/
etc/
vsf
tpd/
ftpuser
s command.
(
ii
)Ent
ert
heusernameswhom t
odenyFTP ser
vices.Forexampl
easf
oll
ows,
r
oot
r
aju
j
unnu (
sav
eandex
itt
hef
il
e)
(
ii
i)Rest
artt
hef
tpdeamonby #ser
vice v
sft
pd r
est
art commandi
nRHEL-6 or
#sy
stemct
lrest
artv
sft
pd commandi
nRHEL-7.
14.Whati
sLFTP andhowt
oconf
igur
eLFTP?
LFTP i
sal
sousedt
oupl
oadordownl
oadt
hef
il
es.But
,byusi
ngLFTP wecanl
ogi
n
t
otheFTP ser
verwi
thoutpasswor
dbecauseI
twi
l
lnotaskanypasswor
ds.Touse
LFTPwehav
etoi
nst
all
theLFTPpackageonser
ver
.
(
i)I
nst
allt
heLFTPpackageby#y
um i
nst
alll
ft
p* -
y command.
(
ii
)Rest
artt
hel
ft
pdeamonby #ser
vice l
ft
pd r
est
art commandi
nRHEL-6 or
#sy
stemct
lrest
artl
ft
pd commandi
nRHEL-7.
(
ii
i)Got
ocl
i
entsy
stem andaccesst
heLFTPser
verby
,
#l
ft
p 172.
25.
9.11 (
toconnectt
heLFTP ser
ver
)
l
ft
p>cdpub (
tomov
etot
hepubdi
rect
ory
)
l
ft
p>getf
1 (
todownl
oadt
hef
1fi
l
e)
l
ft
p>mgetf
2f3f
4f5 (
todownl
oadt
hef
2f3f
4andf
5mul
ti
ple

Rat
nakar
Page133
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

f
il
esatat
ime)
l
ft
p>putf
9 (
toupl
oadt
hef
9fi
l
e)
l
ft
p>mputf
10f
11f
12 (
toupl
oadt
hef
10f
11f
12 mul
ti
plef
il
esatat
ime)
l
ft
p>qui
t (
toqui
tthef
tpser
ver
)
*I
nLFTP "Tab"keywor
ksasusualbuti
nFTP "Tab"wi
l
lnotwor
k.
15.Howt
oal
l
owt
her
ootusert
oaccesst
heFTP ser
ver
?
Bydef
aul
trootuseri
sbl
ockedt
oaccesst
heFTP ser
ver
.Toal
l
owt
her
ootusert
o
accesst
heFTPser
verf
oll
owt
hebel
owst
eps.
(
i)Opent
he/
etc/
vsf
tpd/
user
_li
stf
il
eby #v
im /
etc/
vsf
tpd/
user
_li
st command.
(
ii
)Got
orootuserl
i
neandcommentont
hatl
i
ne.Forex
ampl
e #r
oot
(
sav
eandex
itt
hef
il
e)
(
ii
i)Opent
he/
etc/
vsf
tpd/
ftpuser f
il
eby #v
im /
etc/
vsf
tpd/
ftpuser command.
(
iv)Got
orootuserl
i
neandcommentont
hatl
i
ne.Forexampl
e #r
oot
(
sav
eandex
itt
hef
il
e)
(
v)Rest
artt
hef
tpdeamonby #ser
vice v
sft
pd r
est
art commandi
nRHEL-6 or
#sy
stemct
lrest
artv
sft
pd commandi
nRHEL-7.
* Ev
ent
houghwechangedt
heabov
e,t
her
ootusercannotaccesst
heFTP ser
ver
becauset
hehome di
rect
orycont
exti
snotadded.wecansol
vet
hisasf
oll
ows.
(
vi)#get
sebool -
a|gr
ep f
tp (
tocheckt
heSELi
nuxBool
eanoft
he
r
oothomedi
rect
ory
)
(
vii
)#set
sebool -
pft
p_home_
dir on (
tochanget
heBool
eanof
t
her
oothomedi
rect
ory
)
* Nowgot
ocl
i
entsy
stem andt
ryt
ologi
ntheFTP ser
verasr
ootuser
.Her
ewecan
accesst
heFTP ser
ver
.
16.Whatar
ethedi
ff
erencebet
weenFTP andLFTP ser
ver
s?
(
i)
Theusernameandpasswor
dar
erequi
redt
oaccesst
heFTPser
verbutLFTPdoes
notr
equi
respasswor
ds.
(
ii
)Inf
tp>pr
omptt
he"Tab"keywi
l
lnotwor
kbuti
nlf
tp> pr
omptt
he"Tab"key
wi
l
lwor
kasusual
.
Ot
herusef
ulFTP Commands:
#f
tp 172.
25.
9.11 (
toaccesst
heFTP ser
verpr
ovi
deFTP
usernameandpasswor
d)
f
tp>l
s (
toseeal
lthef
il
esanddi
rect
ori
esi
n
FTPr
ootdi
rect
ory
)
f
tp>!
ls (
toseet
hel
ocal
not
hingpr
esentwor
king
di
rect
oryf
il
es)
f
tp>pwd (
toseet
heFTP pr
esentwor
king
di
rect
ory
)
f
tp>!
pwd (
toseet
hel
ocal
fil
esy
stem'
s
pr
esentwor
kingdi
rect
ory
)

Rat
nakar
Page134
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

f
tp>get<f
il
ename> (
todownl
oadt
hespeci
fi
edf
il
e)
f
tp>mget<f
il
e1><f
il
e2><f
il
e3> (
todownl
oadmul
ti
plef
il
esatat
ime)
f
tp>cd/
var
/ft
p/pub/
upl
oad (
tomov
etoupl
oaddi
rect
ory
)
f
tp>put<f
il
ename> (
toupl
oadt
hespeci
fi
edf
il
eint
othe
FTPupl
oaddi
rect
ory
)
f
tp>l
cd /
root
/Downl
oads (
tochanget
othel
ocal/
root
/Downl
oad
di
rect
ory
)
f
tp>hel
p (
togett
hehel
paboutFTP commands)
f
tp>by
eorqui
t (
toqui
torexi
tfr
om t
heFTPser
ver
)
#l
ft
p 172.
25.
9.11 (
toaccesst
heLFTP ser
ver
wi
thoutaski
nganypasswor
ds)

15.NFS(
Net
wor
kFi
leSy
stem)Ser
verandAut
ofs

1. Whati
sNFS?Expl
aini
t.
NFSst
andsf
orNet
wor
kFi
l
esy
stem andi
tiswayt
oshar
ethel
ocal
har
ddr
ivef
il
es
bet
weenmachi
neswhi
char
eNFScompat
ibl
e.Thatmeansweshar
ethef
il
esbet
ween
Li
nuxandUni
xmachi
nesbutnotbet
weenLi
nuxandwi
ndowssy
stems.NFSi
sused
updpr
otocol
.
Nor
mal
l
ytheNFSser
verexpor
tsoneormor
edi
rect
ori
est
othecl
i
entsy
stem andt
he
cl
i
entsy
stem mountoneormor
eoft
heshar
eddi
rect
ori
escal
l
edmountpoi
nts.Af
ter
t
heNFSi
smount
ed,
all
I/Ooper
ati
onsar
ewr
it
tenbackt
otheser
ver
,andal
lthecl
i
ent
s
not
icet
hechange.Amanual
ref
reshi
snotneededbecauset
hecl
i
entaccesst
he
r
emot
efi
l
esy
stemssameasl
ocal
fil
esy
stem becauseaccessdoesnotr
equi
rest
heI
P
addr
ess,usernameandpasswor
d.Howev
erwecanpr
ovi
det
hesecur
it
yusi
ngt
he
ker
ber
ossecur
it
y.
2. Whatar
ethedi
sadv
ant
agesofNFS?
(
i)NFSdoesnotsuppor
tcr
osspl
atf
orms.i
e.,i
twi
l
lnotsuppor
ttheshar
ingt
hef
il
es
bet
weenLi
nuxand Wi
ndowssy
stems.
(
ii
)NFSdoesnotsuppor
tencr
ypt
ionoft
hedat
aandi
tsuppor
tsonl
ypl
aint
extf
ormat
.
(
ii
i) NFSdoesnotsuppor
tTCPWr
apper
s,i
e.,NFSdoesnotsuppor
t
/
etc/
host
s.al
low and/
etc/
host
s.deny
, becauset
her
eisnol
ibwr
ap.
somodul
e
i
snotl
oadedwi
thNFSser
vice.
(
iv)NFSdoesnotsuppor
taut
hent
icat
ion.So,
toov
ercomet
hispr
obl
em ker
ber
os
secur
it
ysy
stem i
sused.
3. Whati
sthepr
ofi
leofNFS?
Package : nf
s*
Ser
vices : nf
s(i
nRHEL-6)
nf
s-ser
ver
,nf
s-secur
e-ser
ver(
nfswi
thker
ber
os)(
bot
h
f
orNFSser
ver
)

Rat
nakar
Page135
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

nf
s-secur
e(f
orNFScl
i
ent
)(t
heset
hreeser
vicesar
e
i
nRHEL-7)
Scr
ipt : /
etc/
ini
t.
d/nf
s
Por
tnumber
s : 2049(
forNFSser
ver
) andbel
ow 1024(
forNFS
cl
i
ent
)
Conf
igur
ati
onFi
l
es : /
etc/
expor
tsand/
etc/
sysconf
ig/
nfs
Ot
herI
mpor
tantFi
l
es : /
var
/l
ib/
nfs/
etab and /
var
/l
ib/
nfs/
rmt
ab
Ver
sions : NFS-3(
def
aul
tinRHEL-5)buti
tsuppor
tsNFS-4
NFS-4(
def
aul
tinRHEL-6)butI
tal
sosuppor
tsNFS
-3
NFS-4(
def
aul
tinRHEL-7)buti
tal
sosuppor
tsNFS
-3
Pr
otocol : udppr
otocol
4. Whatar
ethebackgr
ounddeamonsf
orNFS andexpl
aint
hem?
Ther
ear
e6backgr
ounddeamonsf
orNFS.
(
i)r
pc.mount
d:
Thi
sdeamoni
sresponsi
blef
orex
ecut
ingmountandunmountr
equest
sbyt
he
cl
i
ent
.
(
ii
)rpc.nf
sd:
Thi
sdeamonr
espondst
ocl
i
ent
srequest
sforf
il
eaccess.
(
ii
i)r
pc.r
quot
ad:
Thi
sdeamoni
sresponsi
blef
orenabl
i
ngquot
asonNFSshar
eddev
ices.
(
iv)r
pc.st
atd:
Thi
sdeamoni
susedt
oseet
hest
ati
sti
csaboutNFSser
verf
rom NFScl
i
entwhen
execut
ingt
he commands #net
stat or#nf
sst
at (
toseet
heI
/O st
ati
sti
cs
ofNFS)

(
v)r
pc.l
ockd:
Thi
sdeamonmanagesf
il
elocksandr
eleasesi
ncaseofcl
i
entdi
sconnect
ed.
(
vi)r
pc.i
dmapd:
Thi
sdeamoni
sresponsi
blef
ormappi
nguseri
dandgr
oupi
dtowar
dst
hemsel
ves.
5. Whatar
ethedi
ff
erencebet
weenNFS3 and NFS4?
I
nNFS3t
her
eisnosecur
it
ytopr
otectt
hedat
a,buti
nNFS4t
her
eisaker
ber
os
secur
it
ytopr
otectt
hedat
a.
I
nNFS3t
her
eisnoACLper
missi
onsont
heshar
eddi
rect
ory
,buti
nNFS4t
her
eisan
ACLper
missi
onsont
heshar
eddi
rect
ory
.
6. I
nhowmanyway
swecanmountt
heNFS shar
eddi
rect
ory
?
I
nor
dert
oaccesst
heNFSshar
eddat
a,wehav
etomountt
hatshar
eddi
rect
oryon
l
ocal
mountpoi
nt.Themount
ingcanbedi
rectmount(
manual
mount
) andi
ndi
rect
mount(
aut
omount
).

Rat
nakar
Page136
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Di
rectmount:
Fi
rstcr
eat
ethel
ocal
mountpoi
ntandt
henmountt
hatshar
edNFSdi
rect
oryonour
l
ocal
syst
emsmountpoi
ntby #mount <ser
verhostnameorI
Paddr
ess>:
<shar
eddi
rect
orywi
thf
ullpat
h><mountpoi
nt> command.Butt
hisi
stempor
ary
mountandwecanmounti
tper
manent
lybyputanent
ryi
n/et
c/f
stab f
il
e.
Exampl
e:
#mount 172.
25.
9.11:
/pr
oduct /
mnt
/nf
s (
tomountt
hedi
rect
ory/
producton
/
nfsmountpoi
ntt
empor
ari
l
y)
#v
im/
etc/
fst
ab (
opent
hisf
il
eandputanent
ryofmountpoi
ntt
o
mountper
manent
ly)
172.
25.
9.11:
/pr
oduct /
mnt
/nf
s nf
s def
aul
ts 0 0 (
sav
e and
exi
tthi
sfi
l
e)
I
ndi
rectmount:
Thi
smet
hodi
susedt
omountt
heNFSshar
ebyusi
ngt
heAut
ofsser
vice.Aut
ofsuses
t
heaut
omountdaemont
omanageourmountpoi
ntsbyonl
ymount
ingt
hem
dy
nami
cal
l
ywhent
heyar
eaccessed.
Aut
ofsconsul
tst
hemast
ermapconf
igur
ati
onf
il
e /
etc/
aut
o.mast
er 
todet
ermi
newhi
ch
mountpoi
ntsar
e def
ined.I
tthenst
art
sanaut
omountpr
ocesswi
tht
heappr
opr
iat
e
par
amet
ersf
oreachmountpoi
nt.Eachl
i
nei
n t
hemast
ermapdef
inesamountpoi
nt
andasepar
atemapf
il
ethatdef
inest
hef
il
esy
stemst
obemount
ed undert
hismount
poi
nt.Forexampl
e,t
he 
/et
c/aut
o.mi
sc 
fi
lemi
ghtdef
inemountpoi
ntsi
nthe 
/mntdi
rect
ory
;
t
hisr
elat
ionshi
pwoul
dbedef
inedi
nthe 
/et
c/aut
o.mast
er 
fi
le.
Eachent
ryi
n aut
o.mast
er 
hast
hreef
iel
ds.Thef
ir
stf
iel
dist
hemountpoi
nt.Thesecond
f
iel
dist
hel
ocat
ionof t
hemapf
il
e,andt
het
hir
dfi
eldi
sopt
ional
.Thet
hir
dfi
eldcan
cont
aini
nfor
mat
ionsuchasat
imeoutv
alue.
Forexampl
e,t
omountt
hedi
rect
ory
 /pr
oduct
 ont
her
emot
emachi
ne
ser
ver
9.exampl
e.com att
hemountpoi
nt 
/mnt
/nf
sony
ourmachi
ne,
addt
hef
oll
owi
ngl
i
ne
t
o aut
o.mast
er:
/
mnt /
etc/
aut
o.mi
sc -
-t
imeout60
Next
,addt
hef
oll
owi
ngl
i
net
o /
etc/
aut
o.mi
sc:
nf
s -
rw ser
ver
9.exampl
e.com:
/pr
oduct
Thef
ir
stf
iel
din 
/et
c/aut
o.mi
sc 
i
sthenameoft
he 
/mnt
 subdi
rect
ory
.Thi
ssubdi
rect
ory
i
scr
eat
eddy
nami
cal
l
y byaut
omount
.Itshoul
dnotact
ual
l
yexi
stont
hecl
i
ent
machi
ne.Thesecondf
iel
dcont
ainsmountopt
ionssuch asr
w f
orr
eadandwr
it
eaccess.
Thet
hir
dfi
eldi
sthel
ocat
ionoft
heNFSexpor
tincl
udi
ngt
hehost
nameand di
rect
ory
.
Thedi
rect
ory/
mntmustbeexi
tsont
hel
ocal
fil
esy
stem.Ther
eshoul
dbenosub
di
rect
ori
esont
hel
ocal
fil
e sy
stem.
Tost
artt
heaut
ofsser
vice,
atashel
lpr
ompt
,ty
pet
hef
oll
owi
ngcommand:
#ser
viv
eaut
ofsr
est
art
Tov
iewt
heact
ivemountpoi
nts,
typet
hef
oll
owi
ngcommandatashel
lpr
ompt
:

Rat
nakar
Page137
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
viceaut
ofsst
atus
I
fyoumodi
fyt
he 
/et
c/aut
o.mast
er 
conf
igur
ati
onf
il
ewhi
l
eaut
ofsi
srunni
ng,
youmust
t
ell
theaut
omount daemon(
s)t
orel
oadbyt
ypi
ngt
hef
oll
owi
ngcommandatashel
l
pr
ompt
:
#ser
viceaut
ofsr
eload
7. Howt
oconf
igur
eNFSser
ver
?
(
i)Fi
rsti
nst
all
theNFSpackageby #y
um i
nst
allnf
s* -
y command.
(
ii
)Cr
eat
etheNFSshar
eddi
rect
oryonser
versy
stem by #mkdi
r/publ
ic command.
(
ii
i)Modi
fyt
heper
missi
onsoft
he/
publ
i
c di
rect
oryby #chmod777/
publ
ic
command.(
Theseper
missi
ons
maybechangeddependoni
t'
srequi
rement
)
(
iv)Modi
fyt
heSELi
nuxcont
extoft
he/
publ
i
cdi
rect
oryi
fSELi
nuxi
senabl
edby
execut
ingt
hebel
owcommand.#chcon -
t publ
i
c_cont
ent
_t /
publ
i
c
(
v)cr
eat
esomef
il
esi
nthe/
publ
i
cdi
rect
oryby #t
ouch f
{1.
.10} command.
(
vi)Opent
hef
il
eNFSconf
igur
ati
onf
il
eandputanent
ryoft
heNFSshar
edi
nfor
mat
ion
by#v
im /
etc/
expor
ts commandandt
ypeasanent
ryl
i
ke <shar
eddi
rect
oryname>
<t
owhom t
oexpor
ttheshar
eddi
rect
ory
> (
<per
missi
ons>,sy
nc)
Forex
ampl
e,
#v
im /
etc/
expor
ts
/
publ
i
c *
.exampl
e.com (
ro/
rw,
sync)
(
sav
eandex
itt
hef
il
e)
* Wher
e*.
exampl
e.com meanst
heshar
eddi
rect
orycanbeex
por
tedt
oal
lthe
sy
stemsoft
he exampl
e.com domai
n.
* Per
missi
onsl
i
ker
o(r
eadonl
y)orr
w(r
ead&wr
it
e)andsy
ncmeanst
hedat
a
wi
l
lal
way
sbesy
nced.
/
publ
i
c deskt
op9.
exampl
e.com (
rw,
sync) (
toexpor
tthe/
publ
i
cto
deskt
op5sy
stem onl
y)
/
publ
i
c *
.exampl
e.com (
ro,
sync) (
expor
ttot
heent
ir
eexampl
e.com
domai
nwi
thr
eadonl
y)
/
publ
i
c 172.
25.
0.0/
24(
rw,
sync) (
expor
tto172.
25.
0.0net
wor
konl
y
wi
thr
eadandwr
it
e)
/
publ
i
c ser
ver[0-20]
.exampl
e.com (
rw,sy
nc) (
expor
ttoser
ver
0to
ser
ver
20i
n
exampl
e.com domai
nwi
thr
eadandwr
it
e)
/
publ
i
c 172.
25.
0.10(
rw,
sync) (
expor
tto172.
25.
0.10net
wor
konl
y
wi
thr
eadandwr
it
e)
CommonMountper
missi
onopt
ions:

r
w r
ead/
wri
teper
missi
ons

Rat
nakar
Page138
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
o r
ead-
onl
yper
missi
ons
i
nsecur
e Al
l
owst
heuseofpor
tsov
er1024
Speci
fi
est
hatal
lchangesmustbewr
it
tent
odi
skbef
orea
sy
nc
commandcomplet
es
no_
wdel
ay For
cest
hewr
it
ingofchangesi
mmedi
atel
y
r
oot
_squash Pr
event
srootuser
s

(
vii
)Expor
ttheabov
eshar
eddi
rect
oryt
othedef
inedcl
i
entsy
stemsby #expor
tfs -
rv
command.
(
vii
i
)Rest
artt
heNFSser
vicesbyf
oll
owi
ngt
hecommandsi
nRHEL-6andRHEL-7.
#ser
vicer
pcbi
ndr
est
art (
tor
est
artt
her
pcbi
nd
ser
vicei
nRHEL-6)
#ser
vicenf
srest
art (
tor
est
artt
heNFS
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artnf
s-ser
ver (
tor
est
artt
heNFS
ser
vicei
nRHEL-7)
(
ix) Maket
heNFSser
viceper
manent
lybootatnextboott
imeonwar
dsas
f
oll
ows.
#chkconf
igr
pcbi
ndon (
toont
her
pcbi
nd
ser
vicei
nRHEL-6)
#chkconf
ignf
son (
toont
henf
s
ser
vicei
nRHEL-6)
#sy
stemct
lenabl
enf
s-ser
ver (
toenabl
e
t
henf
s-ser
veri
nRHEL-7)
(
x)Expor
ttheNFSshar
eddi
rect
oryasf
oll
ows.
#expor
tfs -
rv
(
xi)Enabl
etheNFSser
vicet
otheI
Ptabl
esandFi
rewal
linRHEL-6 and RHEL-7
asf
oll
ows.
I
nRHEL-6:
(
i)#set
up
(
a)Sel
ectFi
rewal
lConf
igur
ati
on.
(
b)Sel
ectCust
omi
ze(Makesur
efi
rewal
lopt
ionr
emai
nsel
ect
ed)
.
(
c)Sel
ectNFS4(bypr
essi
ngspacebaronce)
.
(
d)Sel
ectFor
war
dandpr
essEnt
er.
(
e)Sel
ectet
h0andSel
ectCl
osebut
tonandpr
essEnt
er.
(
f)Sel
ectokandpr
essEnt
er.
(
g)Sel
ectYesandpr
essEnt
er.
(
h)Sel
ectQui
tandpr
essEnt
er.
(
ii
)Nowopen/
etc/
sysconf
ig/
ipt
abl
esf
il
eandaddt
hef
oll
owi
ngr
ulesundert
her
ule

Rat
nakar
Page139
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

f
orpor
t2049andsav
e f
il
e.
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t111-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t111-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t32803-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t32769-
jACCEPT
-
AINPUT -
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t892-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t892-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t875-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t875-
jACCEPT
-
AINPUT -
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t662-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t662-
jACCEPT
(
ii
i)Rest
artt
heI
Ptabl
esser
viceby #ser
vicei
ptabl
esr
est
artcommand.
(
iv)Maket
heI
Ptabl
esser
viceasper
manentf
rom nextbootonwar
dsasf
oll
ows.
#chkconf
igi
ptabl
eson
Thef
oll
owi
ngcommandscoul
dbehel
pfulf
ort
roubl
eshoot
ing:

#mount
stat
s Showsi
nfor
mat
ionaboutmount
edNFSshar
es
#nf
sst
at Showsst
ati
sti
csofexpor
tedr
esour
ces
#nf
siost
at Showsst
ati
sti
csofNFSmount
edshar
es

I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
add-
ser
vice=nf
s (
toenabl
ethenf
s
ser
viceatf
ir
ewal
l
)
#f
ir
ewal
l
-cmd -
-per
manent -
add-
ser
vice=mount
d (
toenabl
ethe
mount
dser
viceatf
ir
ewal
l
)
#f
ir
ewal
l
-cmd -
-per
manent -
add-
ser
vice=r
pc-
bind (
toenabl
e
t
her
pc-
bindser
viceatf
ir
ewal
l
)
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad (
tor
eloadt
hef
ir
ewal
l
)
8. Whatar
erequi
rement
sforNFScl
ient
?
(
i)NFSser
verI
Paddr
essorhost
name.
(
ii
)Checkt
heNFSshar
edname.
(
ii
i)Cr
eat
ethel
ocalmountpoi
nt.
(
iv)Mountt
heNFSshar
ednameont
hel
ocal
mountpoi
nt.
(
v)Got
omountpoi
nt(
local
mountpoi
nt)andaccesst
heNFSshar
eddat
a.
9. Howt
oaccesst
heNFSshar
eddi
rect
oryf
rom t
hecl
ient
?
(
i)OnCl
i
entsy
stem,i
nst
all
the nf
s-ut
il
s packageby #y
um i
nst
allnf
s-ut
il
s* -
y
command.
(
ii
)Checkt
heexpor
tedNFSshar
eddi
rect
oryby #showmount -
e <I
Paddr
ess or
host
nameoft
heser
ver
>
Exampl
e:#showmount -
e 172.
25.
9.11 or #showmount -
e

Rat
nakar
Page140
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

ser
ver
9.exampl
e.com
(
ii
i) Cr
eat
eonemountpoi
ntt
omountt
heNFSshar
eddi
rect
oryby#mkdi
r
/
<mountpoi
nt> command.
Exampl
e:#mkdi
r/mnt
/nf
s
(
iv) Mountt
heNFSshar
eddi
rect
oryont
heabov
ecr
eat
edmountpoi
nt.
#mount <I
Paddr
ess or ser
verhost
name>:<NFS shar
eddi
rect
ory
><mount
poi
nt>
Exampl
e:#mount 172.
25.
9.11:
/publ
i
c /
mnt
/nf
s or
#mount ser
ver
9.exampl
e.com:
/publ
i
c /
mnt
/nf
s
* Thesear
etempor
arymountonl
y.i
e.,I
fthesy
stem i
sreboot
edt
hesear
eunmount
ed
aut
omat
ical
l
yandwe hav
etomountagai
naf
tert
hesy
stem i
sreboot
ed.
(
v)So,
ifwewantt
omounti
tper
manent
ly,
thenopen /
etc/
fst
ab f
il
eandputanent
ry
oft
hemountpoi
nt.
#v
im /
etc/
fst
ab (
toopent
hef
il
e)
<I
Paddr
ess or ser
verhost
name>:<shar
edname><mountpoi
nt><f
il
esy
stem>
def
aul
ts 00
Exampl
e:172.
25.
9.11:
/publ
i
c /
mnt
/nf
s nf
s def
aul
ts 0 0 (or)
ser
ver
9.exampl
e.com:
/publ
i
c /
mnt
/nf
s nf
s def
aul
ts 0 0
(
sav
eandex
itt
hef
il
e)
(
vi)Mountal
lthemountpoi
ntsasment
ionedi
ntheabov
e/et
c/f
stab f
il
eby #
mount-
a command.
(
vii
)#df -
hT commandi
susedt
ocheckal
lthemount
edpar
ti
ti
onswi
thf
il
esy
stem
t
ypes.
10.Whyr
ootusercannotcr
eat
ethef
il
esi
ntheNFSshar
eddi
rect
oryandhowt
omake
hi
mtocr
eat
ethef
il
es?
Ther
ootusernor
mal
l
yhasal
ltheper
missi
ons,buti
nNFSr
ootuseri
sal
sobecomes
asanor
maluser
.So,t
her
ootuserhav
ingnoper
missi
onst
ocr
eat
ethef
il
esont
he
NFSshar
eddi
rect
ory
.
Ther
ootuserbecomesasnf
snobody
userandgr
oupal
sonf
snobody duet
o
r
oot
_squash per
missi
oni
sther
ebydef
aul
t.So,
ifwewantt
omaket
her
ootusert
o
cr
eat
efi
l
eont
heNFSshar
eddi
rect
ory
,thengot
oser
versi
deandopent
he
/
etc/
expor
tsf
il
eandt
ypeasbel
ow,
<shar
edname> <domai
nnameorsy
stemsnames>(
per
missi
ons,
sync,
no_
root
_squash)
Exampl
e:/
publ
ic *
.exampl
e.com(
rw,
sync,
no_
root
_squash)
(
sav
eandexi
tthef
il
e)
#expor
tfs -
rv (
toexpor
ttheshar
eddi
rect
ory
)
#ser
vicenf
srest
art (
tor
est
artt
heNFSser
vicei
nRHEL-6)
#sy
stemct
lrest
artnf
s-ser
ver (
tor
est
artt
heNFSser
vicei
nRHEL-7)
11.Whatar
ethedi
sadv
ant
agesoft
hedi
rectormanualmount
ing?

Rat
nakar
Page141
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Manual
mount
ingmeans,
wehav
etomountmanual
l
y,soi
tcr
eat
essomany
pr
obl
ems.Forex
ampl
eifNFS ser
vicei
snotav
ail
abl
ethen,#df -
hT commandwi
l
l
hang.
(
ii
)Ift
heNFSser
veri
sdownwhi
l
eboot
ingt
hecl
i
ent
,thecl
i
entwi
l
lnotbootbecausei
t
sear
chesf
orNFS mountpoi
ntasanent
ryi
n/et
c/f
stab f
il
e.
(
ii
i)Anot
herdi
sadv
ant
ageofmanual
mount
ingi
sitconsumesmor
ememor
yand CPU
r
esour
cesont
hecl
i
ent sy
stem.
So,t
oov
ercomet
heabov
epr
obl
emsnor
mal
l
yindi
rectoraut
omounti
susedusi
ng
Aut
ofst
ool
.
12.Whati
ssecur
eNFS ser
verandexpl
aini
t?
Secur
eNFSser
vermeansNFSser
verwi
thKer
ber
ossecur
it
y.I
tisusedt
opr
otectt
he
NFSexpor
ts.Ker
bebor
sisaaut
hent
icat
iont
ool
topr
otectt
heNFSser
vershar
es.I
t
usest
hekr
b5pmet
hodt
opr
otectbyaut
hent
icat
ionmechani
sm andencr
yptt
hedat
a
whi
l
ecommuni
cat
ion.
Fort
hisonekeyf
il
eisr
equi
redandt
hisshoul
dbest
oredi
neachandev
erycl
i
entwhi
ch
ar
eaccessi
ngt
henf
ssecur
edi
rect
ory
.Thenonl
yKer
ber
ossecur
it
ywi
l
lbeav
ail
abl
e.
Thi
skeyf
il
eshoul
dbest
oredi
n/et
c/kr
b5.
key
tabf
il
e.Forexampl
ethef
oll
owi
ng
commandwi
l
ldownl
oadandst
oret
hekey
tab.
#wgetht
tp:
//cl
assr
oom.
exampl
e.com/
pub/
key
tabs/
ser
ver
9.key
tab -
O
/
etc/
krb5.
key
tab(
wher
eOi
scapi
tal
)
13.Howt
oconf
igur
ethesecur
eNFS ser
ver
?
(
i)I
nst
all
theNFSpackage.
#y
um i
nst
allnf
s* -
y
(
ii
)Cr
eat
eadi
rect
oryt
oshar
ethr
oughNFSser
ver
.
#mkdi
r/secur
enf
s
(
ii
i) Modi
fyt
heper
missi
onsofshar
eddi
rect
ory
.
#chmod 777 /
secur
enf
s
(
iv)
Changet
heSELi
nuxcont
extoft
hedi
rect
oryi
ftheSELi
nuxi
senabl
ed.
#chcon -
tpubl
ic_
cont
ent
_t /
secur
enf
s
(
v)Opent
heNFSconf
igur
ati
onf
il
eandputanent
ryoft
heshar
eddi
rect
ory
.
#v
im /
etc/
expor
ts
/
secur
enf
s *
.ex
ampl
e.com(
rw,
sec=kr
b5p)
(
sav
eandex
itt
hef
il
e)
(
vi)
Downl
oadt
hekey
tabandst
orei
tin/
etc/
krb5.
key
tb f
il
e.
#wgetht
tp:
//cl
assr
oom.
exampl
e.com/
pub/
key
tabs/
ser
ver
9.key
tab -
O
/
etc/
krb5.
key
tab
(
vii
)Expor
ttheshar
edt
hedi
rect
ory
.
#expor
tfs -
rv
(
vii
i
)Rest
artandenabl
etheNFSser
vicesi
nRHEL-6andRHEL-7.
#ser
vicenf
srest
art (
rest
artt
heNFS

Rat
nakar
Page142
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

ser
vicei
nRHEL-6)
#ser
vicenf
s-secur
e-ser
verr
est
art (
rest
artt
hesecur
eNFSser
vice
i
nRHEL-6)
#chkconf
ig nf
son (
enabl
etheNFS
ser
vicei
nRHEL-6)
#sy
stemct
lrest
artnf
s-ser
ver (
rest
artt
he
NFSser
vicei
nRHEL-7)
#sy
stemct
lrest
artnf
s-secur
e-ser
ver (
rest
artt
hesecur
eNFS
ser
vicei
nRHEL-7)
(
ix)Enabl
etheI
Ptabl
esorf
ir
ewal
ltoal
l
ow NFSser
vicei
nRHEL-6 and RHEL-7as
f
oll
ows.
I
nRHEL-6:
(
i)#set
up
(
a)Sel
ectFi
rewal
lConf
igur
ati
on.
(
b)Sel
ectCust
omi
ze(Makesur
efi
rewal
lopt
ionr
emai
nsel
ect
ed)
.
(
c)Sel
ectNFS4(bypr
essi
ngspacebaronce)
.
(
d)Sel
ectFor
war
dandpr
essEnt
er.
(
e)Sel
ectet
h0andSel
ectCl
osebut
tonandpr
essEnt
er.
(
f)Sel
ectokandpr
essEnt
er.
(
g)Sel
ectYesandpr
essEnt
er.
(
h)Sel
ectQui
tandpr
essEnt
er.
(
ii
)Nowopen/
etc/
sysconf
ig/
ipt
abl
esf
il
eandaddt
hef
oll
owi
ngr
ulesundert
her
ule
f
orpor
t2049andsav
e f
il
e.
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t111-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t111-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t32803-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t32769-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t892-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t892-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t875-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t875-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
mtcp-
ptcp-
-dpor
t662-
jACCEPT
-
AINPUT-
m st
ate-
-st
ateNEW -
m udp-
pudp-
-dpor
t662-
jACCEPT
(
ii
i)Rest
artt
heI
Ptabl
esser
viceby #ser
vicei
ptabl
esr
est
artcommand.
(
iv)Maket
heI
Ptabl
esser
viceasper
manentf
rom nextbootonwar
dsasf
oll
ows.
#chkconf
igi
ptabl
eson
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
add-
ser
vice=nf
s (
toenabl
ethenf
s
ser
viceatf
ir
ewal
l
)
#f
ir
ewal
l
-cmd -
-per
manent -
add-
ser
vice=mount
d (
toenabl
ethe

Rat
nakar
Page143
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

mount
dser
viceatf
ir
ewal
l
)
#f
ir
ewal
l
-cmd -
-per
manent -
add-
ser
vice=r
pc-
bind (
toenabl
e
t
her
pc-
bindser
viceatf
ir
ewal
l
)
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad (
tor
eloadt
hef
ir
ewal
l
)
14.Howt
oaccesst
hesecur
eNFS ser
veroncl
ientsi
de?
(
i)I
nst
allt
henf
s-ut
il
spackage.
#y
um i
nst
allnf
s-ut
il
s* -
y
(
ii
)Downl
oadt
hesamekey t
abandst
orei
tin/
etc/
krb5.
key
tab f
il
e.
#wgetht
tp:
//cl
assr
oom.
exampl
e.com/
pub/
key
tabs/
deskt
op9.
key
tab -
O
/
etc/
krb5.
key
tab
(
ii
i)Checkt
heshar
edNFSdi
rect
ory
.
#showmount -
e ser
ver
9.exampl
e.com
(
iv)Rest
artt
hesecur
eNFSser
viceoncl
i
entsi
de.
#ser
vice nf
s-secur
erest
art (
rest
artt
hesecur
eNFS
cl
i
entser
vicei
nRHEL-6)
#sy
stemct
lrest
artnf
s-secur
e (
rest
artt
hesecur
eNFS
cl
i
entser
vicei
nRHEL-7)
(
v)Cr
eat
ethemountpoi
ntoncl
i
entsy
stem.
#mkdi
r/mnt
/nf
ssecur
e
(
vi)Mountt
heNFSshar
eddi
rect
oryont
hel
ocal
mountpoi
ntt
empor
ari
l
y.
#mount ser
ver
9.exampl
e.com:
/secur
enf
s /
mnt
/nf
ssecur
e
(
vii
)Open/
etc/
fst
ab f
il
eandputanent
ryoft
heNFSshar
edmount
ingdet
ail
sto
mounti
tper
manent
ly.
#v
im /
etc/
fst
ab
ser
ver
9.exampl
e.com:
/secur
enf
s /
mnt
/nf
ssecur
e nf
s def
aul
ts,
sec=kr
b5p
0 0
(
sav
eandexi
tthef
il
e)
(
vii
i
)Mountal
lthef
il
esy
stemswhi
char
ehav
ingt
heent
ri
esoft
he/
etc/
fst
ab f
il
e.
#mount -
a
(
ix)Checkal
lthemount
edf
il
esy
stemswi
thf
il
esy
stem t
ypeoncl
i
entsy
stem.
#df -
hT
15.Howt
oment
iont
heNFSv
ersi
onwhi
leconf
igur
ing?
(
i)Open/
etc/
sysconf
ig/
nfs f
il
eby#v
im/
etc/
sysconf
ig/
nfs command.
(
ii
)Got
oli
neno.13andedi
tthel
i
neasbel
ow,
RPCNFSDARGS="-4.
2"
(
ii
i)Sav
eandexi
tthi
sfi
l
e.

16.Howt
oaddt
heLDAPusershar
eddi
rect
oryandhowt
heLDAPuseraccesst
hat
di
rect
oryoncl
ient
?
(
i)Cr
eat
easub-
dir
ect
oryi
n/secur
enf
s di
rect
ory
.

Rat
nakar
Page144
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#mkdi
r/secur
enf
s/secur
e
(
ii
)Changet
heowner
shi
poft
heabov
esubdi
rect
oryt
oLDAPuser
.
#chown l
dapuser
9 /
secur
enf
s/secur
e
(
ii
i)Assi
gnt
hef
ull
per
missi
onsont
hatdi
rect
oryt
oLDAPuser
.
#set
facl -
m u:l
dapuser
9:r
wx /
secur
enf
s/secur
e
(
iv)Changet
heSELi
nuxcont
extoft
hatdi
rect
oryi
fSELi
nuxi
senabl
ed.
#chcon -
t publ
ic_
cont
ent
_t /
secur
enf
s/secur
e
(
v)Re-
expor
tthesecur
eNFSshar
eddi
rect
ory
.
#expor
tfs -
rv
(
vi)Rest
artt
heNFSser
vices.
#ser
vicenf
srest
art (
rest
artt
heNFS
ser
viceI
nRHEL-6)
#ser
vicenf
s-secur
e-ser
verr
est
art (
rest
artt
hesecur
eNFS
ser
viceI
nRHEL-6)
#sy
stemct
lrest
artnf
s (
rest
artt
heNFS
ser
viceI
nRHEL-7)
#sy
stemct
lrest
artnf
s-secur
e (
rest
artt
hesecur
e
NFSser
viceI
nRHEL-7)
OnCl
ientsi
de:
(
i)Logi
nasLDAPuseronl
ocal
syst
em t
hroughssh.
#ssh l
dapuser
9@l
ocal
host (
typey
esandpr
essEnt
eri
f
i
tasks (
yes/
no)
)
(
ii
)Ty
pet
hepasswor
dasker
ber
os i
fitaskst
heLDAPuserpasswor
d.
(
ii
i)Got
othatsecur
eNFSshar
edmountpoi
ntandaccesst
hecont
ent
s.
$cd /
mnt
/nf
ssecur
e (
toaccess
t
hemountpoi
nt)
$l
s (
toseet
he
cont
ent
sint
hat
)
$cd secur
e (
toaccess
t
hesubdi
rect
ory
)
$l
s (
toseet
he
cont
ent
sint
hat
)
$exi
t (
toexi
torl
ogout
f
rom ssh)
17.Whatar
etheadv
ant
agesofNFS?
(
i)NFSal
l
owsmul
ti
plecomput
erscanusesamef
il
es,
becauseal
ltheuser
sont
he
net
wor
kordomai
ncan accesst
hesamedat
a.
(
ii
)NFSr
educest
hest
oragecost
sbyshar
ingappl
i
cat
ionsoncomput
ersi
nst
eadof
al
l
ocat
ingl
ocal
diskspacef
or eachuserappl
i
cat
ion.
(
ii
i)NFSpr
ovi
desdat
aconsi
stencyandr
eli
abi
l
ity
,becauseal
luser
scanr
eadsameset

Rat
nakar
Page145
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

off
il
es.
(
iv)NFSsuppor
tshet
erogeneousenv
ironment
swhi
char
ecompat
ibl
etoNFS.
(
v)NFSr
educesSy
stem Admi
nist
rat
ionov
erhead.
18.Remot
eusercannotmountt
heNFSshar
eddi
rect
ory
.Howt
oresol
vet
his?
(
i)Fi
rstcheckt
heuserbel
ongst
othesamedomai
nast
heNFSshar
edornot
.ie.
,the
user
'ssy
stem domai
n andNFSshar
edsy
stem domai
nshoul
dcommuni
cat
e.
(
ii
)Checkt
heuser
'ssy
stem i
spi
ngi
ngornot
.
(
ii
i)Checkt
heuser
'snamei
spr
esent
,notpr
esentordi
sabl
edt
oaccesst
heNFS
ser
ver
.
(
iv)Checkt
hemount
edf
il
esy
stem i
sshar
edornot
.
(
v)Checkal
ltheNFSser
verandcl
i
entdeamonsar
erunni
ngornot
.
(
vi)Checkal
lthenet
wor
kconnect
ionsar
epr
oper
lyest
abl
i
shedornot
.
(
vii
)Checkwhet
hert
heNFSser
vicei
srunni
ngornoti
nser
ver
'scur
rentr
unl
evel
.
(
vii
i
)Checkwhet
hert
heNFSser
veri
srunni
ngorhungorshut
down.
(
ix)Checkbot
hNFSser
verandNFScl
i
entsy
stemsnet
wor
krout
ers,net
wor
k
connect
ionsandI
Paddr
esses.
(
x)Checkt
hemountpoi
nti
scor
rectornot
,pat
hsar
ecor
rectornotandf
il
esar
e
t
her
eornot
.
(
xi)Checkt
heNFSshar
eddi
rect
oryandmountpoi
ntdet
ail
sar
ecor
rectornoti
n
/
etc/
fst
ab f
il
e.
(
xii
)Checkt
hekey
tabsar
edownl
oadedandst
oredpr
oper
lyi
n/et
c/kr
b5.
key
tabf
il
eon
bot
hNFSser
verand cl
i
ent
.
(
xii
)Fi
nal
l
ycheckwhet
hert
heNFSpor
tno.2049i
srunni
ngornotandmakesur
e
t
hatt
heI
Ptabl
esor f
ir
ewal
lshoul
dnotbl
ockt
heNFSser
vice.
19.NFSser
verandNFScl
ientconf
igur
ati
onsar
eOK,butatcl
i
enti
tisnotshowi
ng
any
thi
ng.Howt
oresol
ve?
(
i)Ther
pcbi
ndmaybef
ail
ed.
(
ii
)Theser
veri
snotr
espondi
ng.
(
ii
i)NFScl
i
entmaybef
ail
edatr
eboot
.
(
iv)TheNFSser
vicei
snotr
espondi
ng.
(
v)Thedeamonsonbot
hsy
stemsmaynotber
unni
ng.
(
vi)Net
wor
kmaybef
ail
edonbot
hser
verandcl
i
entoranyonesy
stem.
(
vii
)Maybeser
verandcl
i
entar
enoti
nthesamedomai
nornotpi
ngi
ng.
(
vii
i
)Theser
vermaybei
nhungorshut
downst
ate.
20.Whati
sAut
ofs?
Aut
ofsi
sser
vicet
hatcanaut
omat
ical
l
ymountt
heshar
eddi
rect
oryondemandandwi
l
l
aut
omat
ical
l
yunmountt
heshar
eddi
rect
oryi
fiti
snotaccessedwi
thi
nthespeci
fi
ed
t
imeoutper
iod.Thedef
aul
tti
meoutper
iodi
s5mi
nut
esorwecanspeci
fyt
het
imeout
per
iodi
n/et
c/aut
o.mast
erf
il
e.
21.Whatar
etheadv
ant
agesoft
heAut
ofs?

Rat
nakar
Page146
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Shar
esar
eaccessed 
aut
omat
ical
l
yandt
ranspar
ent
lywhenausert
ri
est
oaccessany
f
il
esordi
rect
ori
es undert
hedesi
gnat
edmountpoi
ntoft
her
emot
efi
l
esy
stem t
o
bemount
ed.
(
ii
)Boot
ingt
imei
ssi
gni
fi
cant
lyr
educedbecausenomount
ingi
sdoneatboott
ime.
(
ii
i)Net
wor
kaccessandef
fi
ciencyar
eimpr
ovedbyr
educi
ngt
henumberofper
manent
ly
act
ivemountpoi
nts.
(
iv)Fai
l
edmountr
equest
scanber
educedbydesi
gnat
ingal
ter
nat
eser
ver
sas 
the
sour
ceofaf
il
esy
stem.
(
v)User
sdonotneedt
ohav
erootpr
ivi
l
egest
omountorunmountt
hemountpoi
nt.
(
vi)Wecanr
educet
heCPUandmemor
yut
il
izat
ionsbecauseaut
ofswi
l
lnotmount
per
manent
ly.
(
vii
)Wecanal
sor
educehar
ddi
skut
il
izat
ionbecauseper
manentmountpoi
nts
occupi
est
hehar
ddi
skspace.
22.Whatar
ethemi
nimum r
equi
rement
sforAut
ofs?
(
i)aut
ofs package.
(
ii
)aut
ofsdeamon.
(
ii
i)Oneshar
eddi
rect
ory
.
(
iv)Onemountpoi
nt.
(
v)Twoconf
igur
ati
onf
il
esar
e,
(
a)/
etc/
aut
o.mast
er
(
b)/
etc/
aut
o.mi
sc
23.Howt
oconf
igur
eAut
ofs?
(
i)I
nst
allt
heaut
ofspackageby #y
um i
nst
allaut
ofs* -
y command.
(
ii
)Open /
etc/
aut
o.mast
erf
il
eby #v
im /
etc/
aut
o.mast
erandatl
astt
ypeasbel
ow.
<Cl
ient
'sl
ocalmountpoi
nt> /
etc/
aut
o.mi
sc -
-t
imeout
=60
Exampl
e:
/
mnt /
etc/
aut
o.mi
sc
(
sav
eand exi
tthi
sfi
l
e)
(*Wher
eti
meout
=60means,i
fthedi
rect
oryi
snotusedf
or60secondst
hent
he
shar
eddi
rect
oryi
s unmount
edaut
omat
ical
l
y.Andt
hedef
aul
tis5
mi
nut
es.
)
(
ii
i)Open/
etc/
aut
o.mi
scf
il
eby#v
im/
etc/
aut
o.mi
scandt
ypesasbel
ow.
<Cl
ientt
empor
arymountpoi
nt>-
<per
missi
ons><I
Paddr
essorhost
nameoft
he
ser
ver
>:<shar
ed
name>
Exampl
e:
nf
s -
ro(
or)-
rw cl
assr
oom.
exampl
e.com:
/publ
ic (
sav
eand
exi
tthi
sfi
l
e)
(*wher
e-r
omeansr
ead-
onl
y and -
rw meansr
ead-
wri
te)
(
iv)Rest
artt
heaut
ofsser
vicei
nRHEL-
6andRHEL-7.

Rat
nakar
Page147
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
viceaut
ofsr
est
art (
rest
artt
heaut
ofs
ser
vicei
nRHEL-6)
#chkconf
ig aut
ofson (
enabl
etheaut
ofsser
viceat
nextbooti
nRHEL-6)
#sy
stemct
lrest
artaut
ofs (
rest
artt
heaut
ofs
ser
vicei
nRHEL-7)
#sy
stemct
lenabl
eaut
ofs (
enabl
etheaut
ofsser
viceatnext
booti
nRHEL-7)
(
iv)Got
otheCl
i
entl
ocal
mountpoi
ntwhi
chi
sent
eredi
n/et
/aut
o.mast
er f
il
eby #cd
<mountpoi
nt>command.
Exampl
e:
#cd /
mnt
(
v)Got
otheCl
i
entt
empor
arymountpoi
ntwhi
chi
sent
eredi
n/et
c/aut
o.mi
sc f
il
eas
bel
ow.
#cd /
mnt
/<t
empor
arymountpoi
nt>
Exampl
e:
#cd nf
s
#pwd (
the
out
puti
s/mnt
/nf
s)
24.Whati
sLDAPser
ver
?
LDAP(
Light
wei
ghtDi
rect
oryAccessPr
otocol
)isasof
twar
epr
otocol
forenabl
i
ng
any
onet
olocat
eor
gani
zat
ions,
indi
vi
dual
s,andot
herr
esour
cessuchasf
il
esand
dev
icesi
nanet
wor
k,whet
heront
hepubl
i
cInt
ernetoronacor
por
atei
ntr
anet
.LDAPi
s
l
i
ght
erbecausei
nit
sini
ti
alv
ersi
oni
tdi
dnoti
ncl
udesecur
it
yfeat
ures.
25.Whati
sLDAPcl
ient
?
LDAPCl
i
enti
sanet
wor
kusercr
eat
ionandact
ivi
ty.LDAPusermeansnet
wor
kuser
.
Net
wor
kusermeansl
ogi
ntheusert
hroughnet
wor
k.I
fauserwant
stol
ogi
ntot
he
r
emot
esy
stem,
theLDAPusershoul
dbecr
eat
edandl
ogi
ntot
her
emot
esy
stem
t
hroughLDAPaccount
.
Upt
oRHEL-
5fort
hisNI
S(Net
wor
kInf
ormat
ionSy
stem)i
sused.Fr
om RHEL-6
onwar
dsLDAPi
susi
ng.Themai
nfeat
ureoft
heLDAPi
stoshar
etheuser
sinf
ormat
ion
i
nnet
wor
k.
26.Whatar
ether
equi
rement
sofLDAP andexpl
aini
t?
(
i)Packages.
(
a)aut
hconf
ig-
gtk(
toconf
igur
etheLDAPcl
i
ent
)
(
b)sssd(
syst
em secur
it
yser
vicedeamon)
(
ii
)LDAP cl
i
entconf
igur
ati
onf
il
eis/
etc/
ldap.
conf
(
ii
i)LDAPker
ber
osconf
igur
ati
onf
il
eis/
etc/
krb5.
conf
(
iv)sssd(
syst
emssecur
it
yser
vicedeamon)deamon.
(
v)LDAP por
tno.i
s389.

Rat
nakar
Page148
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
vi)sssddeamonr
esponsi
bil
i
tyi
sret
ri
evi
ngandcachi
ngt
heaut
hent
icat
ioni
nfor
mat
ion.
(
vii
)Theconf
igur
ati
onf
il
eofsssdi
s/et
c/sssd/
sssd.
conf
(
vii
i
)Thr
oughNI
Sthedat
aist
ransf
err
edi
npl
aint
extf
ormat
.So,
ther
eisnosecur
it
y.
ButLDAPwi
l
ltr
ansf
ert
he dat
ainencr
ypt
edf
ormat
.So,
thedat
awi
l
lbei
n
secur
edway
.
(
ix)LDAPi
susedbydef
aul
tsssdi
e.,ker
ber
os.
27.Whatar
ether
equi
rement
sforLDAPcl
ient
?
(
i)dc(
domai
ncont
rol
l
er)
Exampl
e:I
fthedomai
nisexampl
e.com t
hendc=ex
ampl
e,dc=com
(
ii
)ldapser
ver
Exampl
e:l
dap:
//cl
assr
oom.
exampl
e.com
(
ii
i)Aut
hent
icat
ioncer
ti
fi
cat
e(exampl
e-ca.
crt
)isl
ocat
edi
n
ht
tp:
//cl
assr
oom.
exampl
e.com/
pub di
rect
ory
.
28.Howt
oconf
igur
etheLDAPcl
ient
?
(
i)Cr
eat
etheLDAPuser
.
(
ii
)Conf
igur
etheker
ber
os.
(
ii
i)conf
igur
etheNFSaut
omountt
oshar
etheLDAP user
'shomedi
rect
ory
.
So,LDAP+NFS+sssd i
stheLDAP sy
stem.
* LDAP i
susedshar
etheusernameandpasswor
dtor
emot
esy
stem.
* sssd i
susedt
oaut
hent
icat
einsecur
edcommuni
cat
ion.
* NFSi
susedt
oshar
etheuser
'shomedi
rect
oryt
oremot
esy
stem.
St
eps:
(
i)I
nst
all
theLDAP+ker
ber
ospackagesbyt
hef
oll
owi
ngcommands.
#y
um gr
oupi
nst
alldi
rect
ory
*-y
(
inst
all
ati
oni
nRHEL-6)
#y
um i
nst
allaut
hconf
ig-
gtk* sssd* -
y
(
inst
all
ati
oni
nRHEL-7)
* TheLDAPpackagesar
edi
ff
erenti
nRHEL-6andRHEL-7but
,theconf
igur
ati
on
ofLDAP i
ssamei
n bot
hthev
ersi
ons.
(
ii
)Cr
eat
etheLDAP user
sandpasswor
dsi
ntheLDAP ser
ver
.
(
ii
i)Conf
igur
etheLDAP user
'saut
hent
icat
ionby #sy
stem_
conf
ig_
aut
hent
icat
ion
commandi
ngr
aphi
cal useri
nter
face.
(
iv)Theabov
ecommandwi
l
ldi
spl
ayt
heconf
igur
ati
onwi
ndowandi
nthatsel
ectand
t
ypet
heopt
ionasbel
ow.
UserAccountDat
abase = LDAP
LDAP sear
chbaseon = dc=ex
ampl
e,dc=com
LDAP ser
ver =l
dap:
//cl
assr
oom.
exampl
e.com/
Enabl
eTLSt
oencr
ypt = Cl
i
ckonDownl
oadCA Cer
ti
fi
cat
ebut
ton
andt
henent
ert
heur
las,
ht
tp:
//cl
assr
oom.
exampl
e.com:
/pub/
exampl
e-ca.
crt

Rat
nakar
Page149
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Aut
hent
icat
ionMet
hod = LDAP Passwor
d (
thencl
i
ck
onAppl
ybut
ton)
(
v)Checkwhet
hert
heLDAP useri
sconf
igur
edornotby#get
entpasswor
d
l
dapuser
9 command.
29.Howt
omountt
heLDAP user
'shomedi
rect
oryaut
omat
ical
lywhendemandusi
ng
Aut
ofst
ool
?
(
i)I
nst
all
theaut
ofspackageby #y
um i
nst
allaut
ofs* -
y command.
(
ii
)Opent
he/
etc/
aut
o.mast
erf
il
eby#v
im/
etc/
aut
o.mast
er commandandt
ype
asbel
ow.
/
home/
guest
s /
etc/
aut
o.mi
sc
(
sav
eandex
itt
hisf
il
e)
(
ii
i)Opent
he/
etc/
aut
o.mi
sc f
il
eby#v
im/
etc/
aut
o.mi
sc commandandt
ypeas
bel
ow.
l
dapuesr
9 -
rw cl
assr
rom.
exampl
e.com:
/home/
guest
s/l
dapuser
9(sav
eand
exi
tthi
sfi
l
e)
(
iv) Rest
artt
heaut
ofsser
vices.
#ser
viceaut
ofsr
est
art (
rest
artt
heaut
ofsser
vicei
n
RHEL-6)
#chkconf
ig aut
ofson (
enabl
etheaut
ofsser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artaut
ofs (
rest
artt
heaut
ofsser
vicei
n
RHEL-7)
#sy
stemct
lenabl
eaut
ofs (
enabl
etheaut
ofsser
viceatnex
t
booti
nRHEL-7)

(
v)Checkwhet
hert
heLDAPuseri
sabl
etol
ogi
nornot
.
#su -l
dapuser
9 (
to
swi
tcht
oldapuser
9)
$pwd (
toseet
hepr
esent
wor
kingdi
rect
ory
)
*Theout
putoft
heabov
ecommandi
s/home/
guest
s/l
dapuser
9
$l
s (
toseet
hef
il
esi
nLDAP
user
's homedi
rect
ory
)
$exi
t (
toex
itorl
ogout
oft
heLDAP user
)

Rat
nakar
Page150
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

16.SambaSer
ver

1. Whati
sSambaandexpl
aini
t?
(
i)An 
opensour
ce 
i
mpl
ement
ati
onoft
he 
SMB 
fi
leshar
ing 
prot
ocol
thatpr
ovi
desf
il
eand
pr
intser
vicest
o SMB/
CIFS 
cli
ent
s.Sambaal
l
owsanon-
Windowsser
ver
t
ocommuni
cat
ewi
tht
hesamenet
wor
kingpr
otocol ast
heWi
ndowspr
oduct
s.
(
ii
)Sambaal
l
owsLi
nuxcomput
erst
oshar
efi
l
esandpr
int
ersacr
ossanet
wor
k

Rat
nakar
Page151
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

connect
ionbyusi
ngSMB pr
otocol
.Sambawi
l
lsuppor
tDFS,
NFS,
uf
sfi
l
esy
stemst
oshar
efi
l
esanddi
rect
ori
es.That
'swhySambai
s usedt
o
shar
efi
l
esanddi
rect
ori
esbet
weendi
ff
erentpl
atf
orms.
(
ii
i)Sambawi
l
lsuppor
tpr
int
ershar
ingandi
trequi
resaut
hent
icat
ion.
2. Whatar
ethedi
ff
erencesbet
weenSamba andNFS?
(
i)Sambasuppor
tst
oal
lO/
Spl
atf
orms,wher
easNFSwi
l
lsuppor
tthesamepl
atf
orms
onl
y.
(
ii
)Ther
eisasecur
it
yinSambabecauseSambar
equi
resaut
hent
icat
ion,wher
easi
n
NFSt
her
eisnosecur
it
yif t
her
eisnoker
ber
osbecauseNFSdoesnot
r
equi
resaut
hent
icat
ion.
(
ii
i) Sambawi
l
lsuppor
tpr
int
ershar
ing,wher
easNFSwi
l
lnotsuppor
tpr
int
er
shar
ing.
3. Whatar
ethedi
ff
erentf
il
esy
stemsf
orshar
ingdi
ff
erentO/
S?
(
i)Wi
ndows -
--Wi
ndows -
--
--
> Di
str
ibut
edFi
l
esy
stem (
DFS)
(
ii
)Li
nux -
--Li
nux -
--
--
> Net
wor
kFi
l
esy
stem (
NFS)
(
ii
i) Uni
x -
--Uni
x--
--
-> Net
wor
kFi
l
esy
stem (
NFS)
(
iv) Appl
eMAC -
--Appl
eMACs -
--
--
>Appl
eFi
l
eshar
ingPr
otocol(
AFP)
(
v)Wi
ndows -
--Li
nux -
--
--
> CommonI
nter
netFi
l
esy
stem (
CIFS)
4. Whatar
ether
equi
rement
sorwhati
sthepr
ofi
l
eofSamba?
(
i)Packages : samba*f
orsambaser
verandsamba-
cli
ent
*forsamba
cl
i
ent
(
ii
)Deamons : smbdandnmbd f
orRHEL-6wher
eassmbdi
sforSamba
ser
verdeamonand
nmbdi
sforNet
biosser
vicedeamon.
smbandnmbf
orRHEL-7wher
eassmbi
sforSamba
ser
verdeamonandnmb
i
sforNet
biosser
vicedeamon.
(
ii
i) Scr
ipt
ingf
il
es: /
etc/
ini
t.
d/smb and /
etc/
ini
t.
d/nmb
(
iv)Por
tnumber: 137-
--
>tov
eri
fyt
heshar
ename,138-
--
>todat
atr
ansf
er,
139-
--
>toconnect
ionest
abl
i
shand 445-
--
>for
aut
hent
icat
ion
(
v)Logf
il
e : /
var
/l
og/
samba
(
vi)Conf
igur
ati
on : /
etc/
samba/
smb.
conf
(
vii
)Fi
l
esy
stems: CI
FS(
CommonI
nter
netFi
l
esy
stem)
5. Howt
oconf
igur
etheSambaser
ver
?
(
i)I
nst
allt
hesambapackageby #y
um i
nst
allsamba* -
y command.
(
ii
)Cr
eat
easambashar
eddi
rect
oryby #mkdi
r/samba command.
(
ii
i)Modi
fyt
heper
missi
onsoft
heabov
esambashar
eddi
rect
ory
.
#chmod 777 /
samba
(
iv)Modi
fyt
heSELi
nuxcont
extoft
hesambadi
rect
oryi
fSELi
nuxi
senabl
ed.

Rat
nakar
Page152
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#chcon -
t samba_
shar
e_t/
samba
(
v)Cr
eat
ethesambauserandassi
gnt
hepasswor
dfort
hesambauser
.
#user
add r
aju (
tocr
eat
e
t
hesambauser
)
#smbpasswd -
a r
aju (
toassi
gnt
hesamba
passwor
dfort
heuserr
aju)
(
vi) Assi
gnt
heACLper
missi
ons(
li
ker
ead,wr
it
eandex
ecut
e)t
otheabov
e
shar
eddi
rect
oryi
fiti
snecessar
y.
#set
facl -
m u:
<username>:
rwx <sambashar
edname>
Exampl
e:#set
facl -
m u:
raj
u:r
wx /
samba
(
vii
)Opent
hesambaconf
igur
ati
onf
il
eandputanent
ri
esoft
heSambaconf
igur
ati
on.
#v
im /
etc/
samba/
smb.
conf
Got
olastl
i
neandcopyt
hel
ast7l
i
nesandpast
ethem atl
ast
.Andt
henmodi
fyas
bel
ow.
[
samba] (
thi
sist
hesamba
shar
edname)
comment=publ
i
cst
uff (
thi
sisa
commentf
orsamba)
pat
h=/
samba (
shar
edi
rect
ory
namewi
thf
ull
pat
h) publ
i
c=y
es
(
meansnoaut
hent
icat
ion)
=no (
meansr
equi
res
aut
hent
icat
ion)
wr
it
abl
e=y
es (
inr
ead-
wri
te
mode)
=no (
inr
eadonl
ymode)
pr
int
abl
e=no (
pri
nti
ngi
snot
av
ail
abl
e)
=y
es (
pri
nti
ngi
s
av
ail
abl
e)
wr
it
eli
st=r
aju (
togi
vet
hewr
it
e
per
missi
ont
ouserr
aju)
=+<gr
oupname> (
togi
vet
hewr
it
e
per
missi
ont
othegr
oup)
v
ali
duser
s=r
aju,
u2or@gr
oup1,
@gr
oup2 (
togi
vet
he
aut
hent
icat
iont
otheuser
sorgr
oups)
host
sal
l
ow=I
P1orI
P2orhost1orhost
2or<hostnet
wor
kID>or<host
net
wor
kID> (
toshar
e
t
hedi
rect
oryt
oIP1orI
P2orhost1orhost
2)
wor
kgr
oup=<wi
ndowswor
kgr
oupname> (
toshar
ethedi
rect
oryt
othe

Rat
nakar
Page153
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

wi
ndowswor
kgr
oup)
cr
eat
emask=644 (
thef
il
escr
eat
edbysambauser
s
wi
th644per
missi
on)
di
rect
orymask=744or755 (
thedi
rect
ori
escr
eat
edbysambauser
swi
th744
or755per
missi
ons)
(
sav
eandexi
ttheconf
igur
ati
onf
il
e)
(
vii
i
)Ver
if
ytheconf
igur
ati
onf
il
eforsy
ntaxer
ror
sby #t
est
par
m command.
(
ix)Rest
artt
hesambadeamonsi
nRHEL-6andRHEL-7.
#ser
vicesmbdnmbdr
est
art (
tor
est
artt
he
sambaser
vicesi
nRHEL-6)
#chkconf
igsmbdnmbdon (
toenabl
ethesambaser
vices
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artsmbnmb (
tor
est
artt
he
sambaser
vicesi
nRHEL-7)
#sy
stemct
lenabl
esmbnmb (
toenabl
ethesambaser
vices
atnextbooti
nRHEL-7)
(
x)Addt
hesambaser
vicet
oIPt
abl
esandFi
rewal
l
.
#set
up (
thensel
ectFi
rewal
lconf
igur
ati
onopt
iont
oaddt
heser
vicet
o
I
Ptabl
esi
nRHEL-6)
#ser
vicei
ptabl
esr
est
art (
tor
est
artt
heI
P
t
abl
esi
nRHEL-6)
#f
ir
ewal
l-
cmd -
-per
manent-
-add-
ser
vice=samba(
toaddt
hesambaser
vicet
o
f
ir
ewal
linRHEL-7) #f
ir
ewal
l-
cmd -
-compl
ete-
rel
oad
(
tor
eloadt
hef
ir
ewal
linRHEL-7)
6. Howt
oaccesst
hesambashar
edi
rect
oryatcl
ientsi
de?
(
i)I
nst
allcl
i
entsi
desambapackagesby #y
um i
nst
allsamba-
cli
ent
* ci
fs-
uti
ls -
y
command.
(
ii
)Checkt
hesambashar
eddi
rect
orynamesf
rom cl
i
entsi
de.
#smbcl
ient -
L//
<hostnameorI
Paddr
essoft
heser
ver
> (
theni
twi
l
lask
passwor
d,her
edon'
tent
er
anypasswor
dbecausei
tdoesnotr
equi
reanypasswor
d)
Exampl
e:#smbcl
i
ent -
L//
ser
ver
9.ex
ampl
e.com or172.
25.
9.11
(
ii
i)connectt
hesambaser
verwi
thusercr
edent
ial
sandaccesst
hesambashar
ed
di
rect
ory
.
#smbcl
ient /
/<hostnameorI
Paddr
essoft
heser
ver
>/<shar
eddi
rect
oryname>
-
U <sambauser name>(
Wher
eU i
sCapi
talLet
terand
wehav
etoent
ert
heuser
'ssambapasswor
d)
Exampl
e: #smbcl
i
ent /
/ser
ver
9.exampl
e.com/
samba -
U r
aju (
then smb:
/>
pr
omptappear
s)
smb:
/>l
s (
toseet
hecont
ent
soft
he

Rat
nakar
Page154
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

sambashar
eddi
rect
ory
)
smb:
/>pwd (
toseet
hepr
esentwor
king
di
rect
ory
)
smb:
/>!l
s (
toseet
hecl
i
ent
'
slocal
dir
ect
ory
cont
ent
s)
smb:
/>get<f
il
ename> (
todownl
oadt
he
speci
fi
edf
il
efr
om sambaser
ver
)
smb:
/>mget<f
il
e1><f
il
e2><f
il
e3><f
il
e4>.
.. (
todownl
oadmul
ti
plef
il
esf
rom
sambaser
ver
)
smb:
/>put<f
il
ename> (
toupl
oadt
hespeci
fi
edf
il
eto
t
hesambaser
ver
)
smb:
/>put<f
il
e1><f
il
e2><f
il
e3><f
il
e4>.
..(
toupl
oadmul
ti
plef
il
est
othesamba
ser
ver
)
smb:
/>ex
it (
toexi
tfr
om t
hesambaser
ver
)
7. Howt
omountt
hesambashar
eddi
rect
oryper
manent
ly?
(
i)Cr
eat
ethemountpoi
ntf
ort
hesambashar
eddi
rect
ory
.
#mkdi
r/mnt
/samba
(
ii
)Putanent
ryoft
hemountpoi
ntdet
ail
sin/
etc/
fst
ab f
il
e.
#v
im /
etc/
fst
ab
/
/<sambaser
verhostnameorI
Paddr
ess>/
<shar
eddi
rect
oryname><mount
poi
nt> ci
fs def
aul
ts, user
name=<sambauser
name>,
passwor
d=<user
'ssambapasswor
d> 0 0
Exampl
e:/
/ser
ver
9.exampl
e.com/
samba /
mnt
/samba ci
fs def
aul
ts,
user
name=r
aju,
passwor
d=<sambapasswor
d> 0 0 (
sav
eandexi
tthi
sfi
l
e)
(
ii
i)Mountal
lthemountpoi
ntswhi
char
ehav
ingent
ri
esi
n/et
c/f
stab f
il
e.
#mount -
a
(
iv)Checkal
lthemountpoi
ntsby #df -
hT command.
8. Howt
omountt
hesambashar
eddi
rect
oryusi
ngcr
edent
ialf
il
e?
(
i)Cr
eat
eonef
il
eandputanent
ri
esoft
heusernameandpasswor
ddet
ail
s.
#v
im /
root
/smbuser
user
name=r
aju
passwor
d=<user
'ssambapasswor
d>
(
sav
eandexi
tthef
il
e)
(
ii
)Open/
etc/
fst
ab f
il
eandputanent
ri
esoft
heabov
ecr
edent
ial
det
ail
sofuser
.
#v
im/
etc/
fst
ab
/
/ser
ver
9.exampl
e.com/
samba /
mnt
/samba ci
fs cr
edent
ial
s=/
root
/smbuser
,
mul
ti
user
,sec=nt
lmssp
0 0
(
sav
eandexi
tthi
sfi
l
e)

Rat
nakar
Page155
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

9. Howt
oaccesst
hesambashar
edi
rect
oryi
fital
readymount
ed?
(
i)Got
oCl
i
entsy
stem andswi
tcht
osambauser
.
#su -r
aju
$cd /
mnt
/samba
$l
s (
per
missi
ondeni
edmessagewi
l
l
bedi
spl
ayed)
$ci
fscr
eds add <hostnameorI
Paddr
essoft
hesambaser
ver
>(t
oaddci
fs
cr
edent
ial
stot
heser
ver
)
$l
s (
toseet
hecont
ent
soft
he
sambashar
eddi
rect
ory
)
10.Howt
oaccesst
hesambaser
verf
rom wi
ndowssy
stem?
(
i)Got
oWi
ndowssy
stem,cl
i
ckonSTARTbut
ton,cl
i
ckonRunandt
ypeas
\
\172.
25.
9.11\
sambacommand.
(
ii
)Thenpr
ovi
desambausernameandpasswor
difi
tpr
ompt
sus.
(
ii
i)Thenseet
hecont
ent
soft
hesambashar
eddi
rect
ory
.
Ot
herusef
ulcommands:
#smbpasswd -
a <username> (
toaddt
hesamba
passwor
dtot
hesambauser
)
#smbpasswd -
d <username> (
todi
sabl
ethe
sambauser
'spasswor
d)
#smbpasswd -
e <username> (
toenabl
ethe
sambauser
'spasswor
d)
#smbpasswd -
r <username> (
tor
emov
ethe
sambauser
'spasswor
d)
#smbpasswd -
x <username> (
todel
etet
he
sambauser
'spasswor
d)
#smbpasswd -
n <username> (
tosett
hesamba
user
'spasswor
dasnul
l
)
#f
indsmb (
tocheckhowmanysambaser
ver
sar
e
r
unni
ngi
nournet
wor
k)
#pdbedi
t (
tocheckt
heav
ail
abl
esambauser
swhoar
e
accessi
ngcur
rent
ly)
#smbst
atus (
tocheckhowmanysmbcl
i
ent
sar
econnect
ed
t
othesambaser
ver
)
#mount-
tci
fs/
/<hostnameorI
Paddr
essoft
hesambaser
ver
>/<shar
ed
di
recot
ory
><mountpoi
nt> -
o
user
=<username> (
tomountt
hesambashar
edi
rect
oryonl
ocal
mountpoi
ntt
empor
ari
l
y)
Exampl
e:#mount-
tci
fs/
/172.
25.
9.11/
samba /
mnt
/samba -
o user
=raj
u

Rat
nakar
Page156
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

17.NTP(
Net
wor
kTi
mePr
otocol
)orChr
ony

1. Whati
sNTP andChr
ony
?
NTPst
andsf
orNet
wor
kTi
mePr
otocol
inRHEL-6andChr
onyi
sal
soaNet
wor
kTi
me
Pr
otocol
inRHEL-7.Thesear
eusedt
osy
nchr
oni
zet
het
imeony
ourLi
nuxsy
stem wi
tha
cent
ral
i
zedNTP orChr
onyser
ver
.Al
ocal NTP orChr
onyser
veront
henet
wor
kcanbe
sy
nchr
oni
zedwi
thanex
ter
nal
timi
ngsour
cet
okeepal
lthe ser
ver
siny
our
or
gani
zat
ioni
n-sy
ncwi
thanaccur
atet
ime.
2. Whatar
ethedi
ff
erencesbet
weenNTP andChr
ony
?

Rat
nakar
Page157
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

NTP Chr
ony
Thi
sisusedi
nRHEL-6. Thi
sisusedi
nRHEL-7.
Packagei
snt
porsy
stem-
conf
ig-
dat
e. Packageischrony.
It
'sdeamoni schrony
dandPor tnumberi
s
I
t'
sdeamoni
snt
pdandPor
tnumberi
s123.
123.
Wehav etoinst
allt
hepackagemanuall
y. Bydef aul
tthi
spackageisinstal
l
ed.
#ntpq -p ( t
ocheckntpi sconfi
gur
edor #chrony csour
ces -v( t
ocheckchr onyi
s
not
). confi
guredornot )
.
Confi
gurat
ionf i
l
ei s/et
c/ntp.
conf Confi
gurati
onfil
ei s/et
c/chrony.
conf
Logf
il
eis/
var
/log/
ntpst
at Logf
il
eis/
var
/log/
chr
ony

3. Howt
oconf
igur
etheNTP andChr
onycl
ient
?
NTP:
(
i)I
nst
all
thent
ppackageby#y
um i
nst
allnt
p*-
y or#y
um i
nst
allsy
stem-
conf
ig-
dat
e* -
y command.
(
ii
)opent
heconf
igur
ati
onf
il
eby #sy
stem-
conf
ig-
dat
e or#v
im /
etc/
ntp.
conf
command.
(
#sy
stem-
conf
ig-
dat
e commandi
susedt
oconf
igur
etheNTP i
ngr
aphi
cal
mode)
* Makeacommentonl
i
nenumber
s21,22and23.Thengot
oli
nenumber24
andt
ypeasbel
ow.
ser
ver<nt
pser
verhostname> (
sav
eand
exi
tthi
sfi
l
e)
Exampl
e: ser
ver cl
assr
oom.
exampl
e.com
(
ii
i) Rest
artt
hent
pdser
viceby #ser
vicent
pdr
est
art command.
(
iv)Enabl
ethent
pser
viceatnex
tbootby #chkconf
ignt
pdon command.
(
v)Checkwhet
hert
heNTP i
sconf
igur
edornotby #nt
pq -
p command.
Chr
ony:
(
i)Chr
onypackagei
snoti
nst
all
edbecausebydef
aul
titi
sinst
all
ed.I
fitnoti
nst
all
ed
t
heni
nst
all
thepackage by #y
um i
nst
allchr
ony
*-y command.
(
ii
)Opent
hechr
onyconf
igur
ati
onf
il
eby #v
im /
etc/
chr
ony
.conf command.
* Makeacommentonl
i
nenumber
s 3,
4and5.Thengot
oli
nenumber6and
t
ypeasbel
ow.
ser
ver <nt
pser
verhostname> i
bur
st (
sav
eand
exi
tthi
sfi
l
e)
Exampl
e:ser
ver cl
assr
oom.
exampl
e.com i
bur
st
(
ii
i) Rest
artt
he chr
ony ser
viceby #sy
stemct
lrest
artchr
ony
d command.
(
iv)Enabl
ethe chr
ony ser
viceatnex
tbootby #sy
stemct
lenabl
echr
ony
d
command.
(
v)Checkwhet
hert
heChr
onyi
sconf
igur
edornotby #chr
ony
csour
ces -
v
command.

Rat
nakar
Page158
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#t
imedat
ect
l (
tocheckwhet
hert
hecl
i
ent
'st
imei
ssy
nchr
oni
zedt
o
t
heser
ver
'st
ime)
#t
imedat
ect
lli
st-
ti
mezones (
tol
i
stt
hedi
ff
erentt
imez
ones)
#t
imedat
ect
l set
-t
ime <hh:mm :
ss> (
tosett
het
ime)
#t
imedat
ect
l set
-t
imezone Asi
a/Kol
kat
a (
tosett
het
imezonei
nRHEL-7)
#t
zsel
ect Asi
a/Kol
kat
a (
tosett
het
imez
onei
nRHEL-6)
18.DNS(
Domai
nNami
ngSy
stem)

1. Whati
sDNS?
DNSst
andsf
orDomai
nNami
ngSy
stem.The 
DNSt
ransl
atesI
nter
netdomai
nandhost
namest
o I
Paddr
esses. DNSaut
omat
ical
l
yconv
ert
sthenameswet
ypei
nourWeb
br
owseraddr
essbart
otheI
Paddr
essesofWeb ser
ver
shost
ingt
hosesi
tes.
DNSi
mpl
ement
sadi
str
ibut
eddat
abaset
ost
oret
hisnameandaddr
essi
nfor
mat
ionf
or
al
lpubl
i
chost
sont
he I
nter
net
.DNSassumesI
Paddr
essesdonotchange(
are
st
ati
cal
l
yassi
gnedr
athert
handy
nami
cal
l
yassi
gned)
.
2. Whati
sDNSser
verandhowi
twor
ks?
I
nanynet
wor
k,t
hehost
spr
imar
il
ycommuni
cat
ebet
weeneachot
hert
hroughI
P
addr
esses.Forexampl
e,i
fmy comput
eri
sdoi
ngagoogl
esear
ch,
mycomput
eri
s
act
ual
l
ycommuni
cat
ingwi
tht
heI
Paddr
essofoneoft
he webser
ver
sofgoogl
e.com.
Howev
er,
eveni
fthecomput
eri
sef
fi
cientwi
thnumber
s,humansont
heot
herhand
wor
kbet
terwi
thnames.Fort
hisr
eason,
theTCP/
IPpr
otocol
incl
udest
he 
Domai
nName
Sy
stem (
DNS)
  
tol
i
nkbet
weenI
Psandcomput
ernamesi
.e.host
names.TheDNSi
sa
di
str
ibut
eddat
abaseofcomput
erst
hati
s r
esponsi
blef
orr
esol
vi
nghost
namesagai
nstI
P
addr
essesandv
ice-
ver
sa.
AnyDNSquer
yinv
olv
est
wopar
ts.
(
i)TheResol
ver

Ther
esol
verf
ormsupori
nit
iat
est
hequer
y.Ther
esol
veri
tsel
fdoes
notr
unasapr
ogr
am.  
/et
c/r
esol
ve.
conf
 i
sanex
ampl
eofar
esol
ver
.
(
ii
)NameSer
ver

TheNameSer
veri
stheser
vicer
unni
ngi
ntheser
vert
hatr
espondst
o
t
heDNSquer
y gener
atedbyt
her
esol
veri
.e.answer
sto
t
hequest
ionoft
her
esol
ver
.
Thewor
kingDNS:
(
i)Thecl
i
enti
nit
iat
esaquer
ytof
indadomai
nexampl
e.com.
 Thecl
i
entsendst
hequer
y
t
otheDNSser
verof t
heI
SP.(
TheDNSSer
verI
Pint
hecl
i
entcomput
eri
ssetast
he
I
Paddr
essoft
heDNSSer
veroft
heI
SP)
(
ii
)TheDNSSer
veroft
heI
SPf
ir
stchecksi
t'
sowncachet
ocheckwhet
heri
tal
ready
knowst
heanswer
.Butas t
heansweri
snotpr
esent
,itgener
atesanot
herquer
y.
Ast
heTopLev
elDomai
nofexampl
e.com i
s .
com, sot
heDNSser
verquer
ies
t
heI
nter
netRegi
str
ati
onAut
hor
it
ytof
indwhoi
sresponsi
blef
orex
ampl
e.com.
(
ii
i) TheI
nter
netRegi
str
ati
onAut
hor
it
yrespondst
otheI
SPbyanswer
ingt
he
quer
y.

Rat
nakar
Page159
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
iv)Oncet
heI
SPDNSSer
verknowst
heaut
hor
it
ati
venameser
ver
s,i
tcont
act
sthe
aut
hor
it
ati
venameser
ver
sto f
indoutt
heI
Paddr
essf
or 
www.
exampl
e.com
i
.e.t
heI
Paddr
essofhost
 www 
int domai
he  nexampl
e.com. (
v) exampl
e.com
r
espondst
otheI
SPDNSSer
verbyanswer
ingt
hequer
yandpr
ovi
dingt
heI
Paddr
essoft
he
webser
veri
.e.
 www
(
vi)TheI
SPDNSSer
verst
orest
heansweri
nit
'scachef
orf
utur
euseandanswer
stot
he
cl
i
entbysendi
ngt
heI
P addr
essoft www 
he  ser
ver
.
(
vii
)Thecl
i
entmayst
oret
heanswert
otheDNSquer
yini
t'
sowncachef
orf
utur
euse.
Thent
hecl
i
ent communi
cat
esdi
rect
lywi
tht www 
he  ser
verof
domai
n exampl
e.com 
usi
ngt
heI
Paddr
ess.
(
vii
i www 
)The  ser
verr
espondsbysendi
ngt
hei
ndex
.ht
mlpage.
3. Whati
sthef
ormatoft
hedomai
nname?
Li
keaphy
sical
addr
ess,i
nter
netdomai
nnamesar
ehi
erar
chi
cal
way
.Ift
heFul
l
y
Qual
i
fiedDomai
nNamei
s www.
googl
e.co.
in,t
hewww i
stheHost
name,googl
eist
he
Domai
n,coi
stheSecondLev
elDomai
nand i
nist
heTopLev
elDomai
n.
4. Whatar
ethef
il
eswehav
etoedi
ttoconf
igur
etheDNS?
Ther
ear
efourf
il
est
oedi
ttoconf
igur
etheDNS.Theyar
e/et
c/named.
conf
,
/
etc/
named.
rf
c1912.
zones,For
war
dLookupZoneandRev
erseLookupZone.DNS
pr
ovi
desacent
ral
i
seddat
abasef
orr
esol
uti
on.Zone
i
sst
oragedat
abasewhi
chcont
ainsal
lther
ecor
ds.
For
war
dLookupZonei
susedt
oresol
veHost
namest
oIPaddr
esses.
Rev
erseLookupZonei
susedt
oresol
veI
Paddr
essest
oHost
names.
5. Whatar
etheDNSr
ecor
dandexpl
aint
hem?
(
i)SOA Recor
d:(
Star
tofAut
hor
it
y)
SOA cont
ainst
hegener
aladmi
nist
rat
ionandcont
roli
nfor
mat
ionaboutt
he
domai
n.
(
ii
)HostA Recor
d:
(
a)I
tisnot
hingbutaFor
war
dLookupZone.
(
b)I
tmapsHost
namet
oIPaddr
ess.
(
ii
i) PTR:(
Poi
nterRecor
d)
(
a)I
tisnot
hingbutaRev
erseLookupZone.
(
b)I
tmapsI
Paddr
esst
oHost
name.
(
iv) NS Recor
d:(
NameSer
verRecor
d)
I
tst
orest
heDNSser
verI
Paddr
esses.
(
v)MX Recor
d:(
Mai
lExchangeRecor
d)
I
tst
orest
her
ecor
dsoft
heMai
lSer
verI
Paddr
ess.
(
vi)CNMERecor
d:
I
tisnot
hingbutHost
'
sCanoni
calnameal
l
owsaddi
ti
onalnamesoral
i
asest
obe
usedl
ocat
easy
stem.
6. Whati
sthepr
ofi
leoft
heDNS?

Rat
nakar
Page160
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Package : bi
ndandcachi
ng-
name
Scr
ipt : /
etc/
ini
t.
d/named
Conf
igur
ati
onf
il
e : /
etc/
named.
conf and
/
etc/
named.
rf
c1912.
zones
Cl
i
ent
'sconf
igur
ati
onf
il
e : /
etc/
resol
ve.
conf
Documentr
oot : /
var
/named/
Logf
il
e : /
var
/log/
messages
Deamon : named
Por
tnumber : 53
7. Howt
oconf
igur
etheDNS ser
ver
?
(
i)I
nst
all
thepackagesbi
nd,cachi
ng-
namef
orRHEL-6&bi
nd,cashi
ng-
nameand
unboundf
orRHEL-7.
#y
um i
nst
allbi
nd* cachi
ng-
name* -
y (
toi
nst
all
theDNS
packagesf
orRHEL-6)
#y
um i
nst
allbi
nd* cachi
ng-
name* unbound* -
y (
toi
nst
all
theDNS
packagesf
orRHEL-7)
(
ii
)Changet
hehost
namebyaddi
ngf
ull
yqual
i
fieddomai
nnameandmakei
tper
manent
.
#host
name <f
ull
yqual
i
fieddomai
nname> (
tochanget
he
host
namei
nRHEL-6)
#host
name ser
ver
9.exampl
e.com (
exampl
eforset
ti
nghost
name
t
empor
ari
l
yinRHEL-6)
#host
namect
lset<f
ull
yqual
if
ieddomai
nname> (
tochanget
hehost
name
i
nRHEL-7)
#host
namect
lsetser
ver
9.exampl
e.com (
exampl
eforset
ti
nghost
name
t
empor
ari
l
yinRHEL-7)
#v
im /
etc/
host
s (
opent
hisf
il
eandgot
olastl
i
neandt
ypeasbel
ow i
n
RHEL-6onl
y)
<I
Paddr
ess> <f
ull
yqual
if
ieddomai
nname> <host
name>
172.
25.
9.11 ser
ver
9.exampl
e.com ser
ver
9 (
forexampl
eof
t
heabov
esy
ntax)
#v
im /
etc/
sysconf
ig/
net
wor
k (
opent
hisf
il
eandgot
olastl
i
neandt
ype
asbel
ow i
nRHEL-6onl
y)
HOSTNAME=<f
ull
yqual
if
ieddomai
nname>
HOSTNAME=ser
ver
9.exampl
e.com (
forexampl
eoft
heabov
e
sy
ntax)
(
ii
)Opent
heDNSmai
nconf
igur
ati
onf
il
eby#v
im /
etc/
named.
conf command.
* Got
oli
nenumber11andedi
tthi
sli
neasbel
ow.
l
i
sten-
onpor
t53{127.
0.0.
1;<ser
verI
Paddr
ess>;}
;
Exampl
e:l
i
sten-
onpor
t53{
127.
0.0.
1;172.
25.
9.11;}
;
* Got
oli
nenumber17andedi
tthi
sli
neasbel
ow.

Rat
nakar
Page161
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

al
l
ow-
quer
y {l
ocal
host
;<Net
wor
kID>/
<net
mask>;}
;
Exampl
e:al
l
ow-
quer
y {
local
host
;172.
25.
9.0/
24;}
;
(
sav
eandexi
tthi
sfi
l
e)
(
ii
i) Opent
heDNSzoner
efer
encef
il
eby#v
im /
etc/
named.
rf
c1912.
zones
command
* Got
oli
nenumber19andcopy5l
i
nesandpast
ethem atl
astoft
hef
il
e.
zone "
<domai
nname>" I
N {
t
ype-
mast
er;
f
il
e "
<for
war
dlookupz
onef
il
ename>"
;
al
l
ow-
updat
e {none;}
;
}
;
Exampl
e:zone "
exampl
e.com" I
N {
t
ype-
mast
er;
f
il
e "
named.
for
war
d";
al
l
ow-
updat
e {none;}
;
}
;
* Got
oli
nenumber31andcopy5l
i
nesandpast
ethem atl
astoft
hef
il
e.
zone "
<Thr
eeoct
etsoft
heDNSser
verI
Paddr
ess>.i
n.addr.ar
pa" I
N {
t
ype-
mast
er;
f
il
e "
<rev
ersel
ookupzonef
il
ename>"
;
al
l
ow-
updat
e {none;}
;
}
;
Exampl
e:zone "
9.25.
172.i
n.addr.ar
pa" I
N {
t
ype-
mast
er;
f
il
e "
named.
rev
erse"
;
al
l
ow-
updat
e {none;}
;
}
; (
sav
eand
exi
tthi
sfi
l
e)
(
iv)Copy/
var
/named/
named.
local
host f
il
eto/
var
/named/
named.
for
war
dandedi
t
asf
oll
ows.
#cp -
p /
var
/named/
named.
local
host /
var
/named/
named.
for
war
d
#v
im /
var
/named/
named.
for
war
d
* Got
oli
nenumber2andedi
tasf
oll
ows.
@ I
N SOA <DNSser
verf
ull
yqual
i
fieddomai
nname>.com r
oot.
<domai
nname>. {
* Got
oli
nenumber8andedi
tasf
oll
ows.
NS <DNSser
verf
ull
yqual
i
fieddomai
nname>.
A <DNSser
verI
Paddr
ess>
<DNSser
verf
ull
yqual
i
fieddomai
nname> I
N A<DNSser
verI
Paddr
ess>
<Cl
i
ent1f
ull
yqual
i
fieddomai
nname> I
N A<Cl
i
ent1I
Paddr
ess>

Rat
nakar
Page162
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

<Cl
i
ent2f
ull
yqual
i
fieddomai
nname> I
N A<Cl
i
ent2I
Paddr
ess>
<Cl
i
ent3f
ull
yqual
i
fieddomai
nname> I
N A<Cl
i
ent3I
Paddr
ess>
www I
N CNAME <DNSser
verf
ull
yqual
i
fieddomai
nname>
Exampl
e:Thel
i
nenumber2shoul
dbeedi
tedasf
oll
ows.
@ I
N SOA ser
ver
9.exampl
e.com. r
oot
.exampl
e.com. {
Thel
i
nenumber8shoul
dbeedi
tedasf
oll
ows.
NS ser
ver
9.ex
ampl
e.com.
A 172.
25.
9.11
ser
ver
9.ex
ampl
e.com. I
N A 172.
25.
9.11
cl
i
ent
9.ex
ampl
e.com. I
N A 172.
25.
9.10
cl
i
ent
10.
exampl
e.com. I
N A 172.
25.
9.12
cl
i
ent
11.
exampl
e.com. I
N A 172.
25.
9.13
www I
N CNAME ser
ver
9.exampl
e.com.
(
sav
eandexi
tthi
sfi
l
e)
(
v)Copy/
var
/named/
named.
empt
y f
il
eto/
var
/named/
named.
rev
erseandedi
tas
f
oll
ows.
#cp -
p /
var
/named/
named.
empt
y /
var
/named/
named.
rev
erse
#v
im /
var
/named/
named.
rev
erse
* Got
oli
nenumber2andedi
tasf
oll
ows.
@ I
N SOA <DNSser
verf
ull
yqual
i
fieddomai
nname>.com r
oot.
<domai
nname>. {
* Got
oli
nenumber8andedi
tasf
oll
ows.
NS <DNSser
verf
ull
yqual
i
fieddomai
nname>.
<Lastoct
etoft
heDNSser
verI
Paddr
ess> I
N PTR <DNSser
verf
ull
y
qual
i
fieddomai
nname>
<Lastoct
etoft
heCl
i
ent1I
Paddr
ess> I
N PTR <Cl
i
ent1f
ull
yqual
i
fied
domai
nname>
<Lastoct
etoft
heCl
i
ent2I
Paddr
ess> I
N PTR <Cl
i
ent2f
ull
yqual
i
fied
domai
nname>
<Lastoct
etoft
heCl
i
ent3I
Paddr
ess> I
N PTR <Cl
i
ent3f
ull
yqual
i
fied
domai
nname>
<DNSser
verf
ull
yqual
i
fieddomai
nname> I
N A<DNSser
verI
Paddr
ess>
www I
N CNAME <DNSser
verf
ull
yqual
i
fieddomai
nname>
Exampl
e:Thel
i
nenumber2shoul
dbeedi
tedasf
oll
ows.
@ I
N SOA ser
ver
9.exampl
e.com. r
oot
.exampl
e.com. {
Thel
i
nenumber8shoul
dbeedi
tedasf
oll
ows.
NS ser
ver
9.exampl
e.com.
11 I
N PTR ser
ver
9.exampl
e.com.
10 I
N PTR cl
i
ent
9.exampl
e.com.
12 I
N PTR cl
i
ent
10.
exampl
e.com.

Rat
nakar
Page163
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

13 I
N PTR cl
i
ent
11.
exampl
e.com.
ser
ver
9.ex
ampl
e.com. I
N A 172.
25.
9.11
www I
N CNAME ser
ver
9.exampl
e.com.
(
sav
eandexi
tthi
sfi
l
e)
(
vi)Checkt
heDNS conf
igur
ati
onf
il
esf
orsy
ntaxer
ror
s.
#named-
checkconf /
etc/
named.
conf
#named-
checkconf /
etc/
named.
rf
c1912.
zones
#name-
checkzone <domai
nname><f
orwar
dlookupzone>
Exampl
e:#named-
checkzone exampl
e.com /
var
/named/
named.
for
war
d
#named-
checkz
one <domai
nname><r
ever
sel
ookupzone>
Exampl
e:#named-
checkzone exampl
e.com /
var
/named/
named.
rev
erse
(
vii
)Gi
vef
ull
per
missi
onst
othef
orwar
dandr
ever
sel
ookupzones.
#chmod 777 /
var
/named/
named.
for
war
d
#chmod 777 /
var
/named/
named.
rev
erse
(
vii
i
)Open /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h0 andent
ert
heDNSdomai
n
det
ail
sifnotpr
esent
.
#v
im /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h0 (
got
olastl
i
neand
t
ypeasf
oll
ows)
DNS1=ex
ampl
e.com
(
sav
eandexi
tthi
sfi
l
e)

(
ix)Addt
heDNSser
verI
Paddr
essi
n/et
c/r
esol
ve.
conf
#v
im /
etc/
resol
ve.
conf
sear
ch <domai
nname>
namesev
er <I
Paddr
essoft
heDNSser
ver
>
Exampl
e:
sear
ch exampl
e.com
nameser
ver 172.
25.
9.11 (
sav
eand
exi
tthi
sfi
l
e)
(
x)Rest
artt
heDNSser
verdeamons.
#ser
vicenamedr
est
art (
tor
est
artt
hedeamoni
nRHEL-6)
#chkconf
ignamedon (
toenabl
ethedeamonat
nextboott
imei
nRHEL-6)
#sy
stemct
lrest
artnamed unbound (
tor
est
artt
hedeamonsi
n
RHEL-7)
#sy
stemct
lenabl
enamed unbound (
toenabl
ethedeamonsat
nextboott
imei
nRHEL-
7)
(
xi)Addt
heDNSser
vicet
otheI
Ptabl
es andFi
rewal
l
.
#set
up (
thensel
ectt
heFi
rewal
lconf
igur
ati
onopt
ion
andaddDNSi
nRHEL-6)

Rat
nakar
Page164
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
vicei
ptabl
esr
est
art (
tor
est
artt
heI
Ptabl
esi
nRHEL
-6)
#ser
vicei
ptabl
essav
e (
tosav
etheI
Ptabl
esi
n
RHEL-6)
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=dns (
toaddt
heDNSser
vicet
o
f
ir
ewal
linRHEL-7)
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad (
tor
eloadt
hef
ir
ewal
linRHEL-
7)
(
xi) Checkwhet
hert
heDNSi
sresol
vi
ngornot
.
#di
g <DNSser
verf
ull
yqual
i
fiedname> (
tocheckt
her
esol
vi
ngf
rom
host
namet
oIPaddr
ess)
#di
g -
x <DNSser
verI
Paddr
ess> (
tocheckt
her
esol
vi
ngf
rom
I
Paddr
esst
ohost
name)
Exampl
e:#di
g ser
ver
9.exampl
e.com
#di
g -
x 172.
25.
9.11
(
xii
)Checkt
her
esol
uti
onwi
thpi
ngt
est
.
#pi
ng -
c3 <DNSser
verf
ull
yqual
i
fieddomai
nname> (
tocheckt
he
pi
ngt
estwi
thhost
name)
#pi
ng -
c3 <I
Paddr
essoft
heDNSser
ver
> (
tocheckt
he
pi
ngt
estwi
thI
Paddr
ess)
Exampl
e:
#pi
ng -
c3 ser
ver
9.exampl
e.com
#pi
ng -
c3 172.
25.
9.11
(
xii
i
)Checkt
her
esol
uti
onwi
thhostcommand.
#host <host
name> (
tocheckt
he
r
esol
uti
onwi
thhost
name)
#host <I
Paddr
ess> (
tocheckt
he
r
esol
uti
onwi
thI
Paddr
ess)
Exampl
e:
#host ser
ver
9.exampl
e.com
#host 172.
25.
9.11
(
xiv
)Checkt
her
esol
uti
onwi
thnsl
ookupcommand.
#nsl
ookup <host
name> (
tocheckt
he
r
esol
uti
onwi
thhost
name)
#nsl
ookup <I
Paddr
ess> (
tocheckt
he
r
esol
uti
onwi
thI
Paddr
ess)
Exampl
e:
#nsl
ookup ser
ver
9.exampl
e.com
#nsl
ookup 172.
25.
9.11
8. Howt
oconf
igur
etheDNS cl
ient
?

Rat
nakar
Page165
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Fi
rstassi
gnt
hest
ati
cIPaddr
esst
othecl
i
ent
.
(
ii
)Sett
hehost
namet
othecl
i
ent
.
(
ii
i)Rest
artt
henet
wor
kser
viceby #ser
vicenet
wor
krest
artcommand.
(
iv) Open /
etc/
resol
ve.
conff
il
eandedi
tasbel
ow.
#v
im /
etc/
resol
ve.
conf
sear
ch <domai
nname>
nameser
ver <DNSser
verI
Paddr
ess>
Exampl
e:
sear
ch ex
ampl
e.com
nameser
ver 172.
25.
9.11 (
sav
eand
exi
tthi
sfi
l
e)
(
v)Checkwhet
hert
heDNSi
sresol
vi
ngornot
.
#di
g <DNSser
verf
ull
yqual
i
fiedname> (
tocheckt
her
esol
vi
ngf
rom
host
namet
oIPaddr
ess)
#di
g -
x <DNSser
verI
Paddr
ess> (
tocheckt
her
esol
vi
ngf
rom
I
Paddr
esst
ohost
name)
Exampl
e:#di
g ser
ver
9.exampl
e.com
#di
g -
x 172.
25.
9.11
#di
g cl
i
ent
9.exampl
e.com
#di
g -
x 172.
25.
9.10
(
vi)Checkt
her
esol
uti
onwi
thpi
ngt
est
.
#pi
ng -
c3 <DNScl
i
entf
ull
yqual
i
fieddomai
nname> (
tocheckt
hepi
ng
t
estwi
thhost
name)
#pi
ng -
c3 <I
Paddr
essoft
heDNSser
ver
> (
tocheckt
he
pi
ngt
estwi
thI
Paddr
ess)
Exampl
e:
#pi
ng -
c3 cl
i
ent
9.exampl
e.com
#pi
ng -
c3 172.
25.
9.10
#pi
ng -
c3 ser
ver
9.exampl
e.com
#pi
ng -
c3 172.
25.
9.11
(
vii
)Checkt
her
esol
uti
onwi
thhostcommand.
#host <host
name> (
tocheckt
he
r
esol
uti
onwi
thhost
name)
#host <I
Paddr
ess> (
tocheckt
he
r
esol
uti
onwi
thI
Paddr
ess)
Exampl
e:
#host ser
ver
9.exampl
e.com
#host 172.
25.
9.11
#host cl
i
ent
9.ex
ampl
e.com
#host 172.
25.
9.10

Rat
nakar
Page166
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
vii
i
)Checkt
her
esol
uti
onwi
thnsl
ookupcommand.
#nsl
ookup <host
name> (
tocheckt
he
r
esol
uti
onwi
thhost
name)
#nsl
ookup <I
Paddr
ess> (
tocheckt
he
r
esol
uti
onwi
thI
Paddr
ess)
Exampl
e:
#nsl
ookup ser
ver
9.exampl
e.com
#nsl
ookup 172.
25.
9.11
#nsl
ookup cl
i
ent
9.exampl
e.com
#nsl
ookup 172.
25.
9.10
9. Howt
oconf
igur
etheSecondar
yDNSser
ver
?
(
i)I
nst
all
thepackagesbi
nd,cachi
ng-
namef
orRHEL-6&bi
nd,cashi
ng-
nameand
unboundf
orRHEL-7.
#y
um i
nst
allbi
nd* cachi
ng-
name* -
y (
toi
nst
all
theDNS
packagesf
orRHEL-6)
#y
um i
nst
allbi
nd* cachi
ng-
name* unbound* -
y (
toi
nst
all
theDNS
packagesf
orRHEL-7)
(
ii
)Changet
hehost
namebyaddi
ngf
ull
yqual
i
fieddomai
nnameandmakei
tper
manent
.
#host
name <f
ull
yqual
i
fieddomai
nname> (
tochanget
he
host
namei
nRHEL-6)
#host
name ser
ver
6.exampl
e.com (
exampl
eforset
ti
nghost
name
t
empor
ari
l
yinRHEL-6)
#host
namect
lset<f
ull
yqual
if
ieddomai
nname> (
tochanget
hehost
name
i
nRHEL-7)
#host
namect
lsetser
ver
6.exampl
e.com (
exampl
eforset
ti
nghost
name
t
empor
ari
l
yinRHEL-7)
#v
im /
etc/
host
s (
opent
hisf
il
eandgot
olastl
i
neandt
ypeasbel
ow
i
nRHEL-6onl
y)
<I
Paddr
ess> <f
ull
yqual
if
ieddomai
nname> <host
name>
172.
25.
6.11 ser
ver
6.exampl
e.com ser
ver
6 (
forexampl
eof
t
heabov
esy
ntax)
#v
im /
etc/
sysconf
ig/
net
wor
k (
opent
hisf
il
eandgot
olastl
i
neandt
ype
asbel
ow i
nRHEL-6onl
y)
HOSTNAME=<f
ull
yqual
if
ieddomai
nname>
HOSTNAME=ser
ver
6.exampl
e.com (
forexampl
eoft
heabov
e
sy
ntax)
(
ii
)Opent
heDNSmai
nconf
igur
ati
onf
il
eby#v
im /
etc/
named.
conf command.
* Got
oli
nenumber11andedi
tthi
sli
neasbel
ow.
l
i
sten-
onpor
t53{127.
0.0.
1;<ser
verI
Paddr
ess>;}
;
Exampl
e:l
i
sten-
onpor
t53{
127.
0.0.
1;172.
25.
6.11;}
;

Rat
nakar
Page167
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

* Got
oli
nenumber17andedi
tthi
sli
neasbel
ow.
al
l
ow-
quer
y {l
ocal
host
;<Net
wor
kID>/
<net
mask>;}
;
Exampl
e:al
l
ow-
quer
y {
local
host
;172.
25.
6.0/
24;}
;
(
sav
eandexi
tthi
sfi
l
e)
(
ii
i) Opent
heDNSzoner
efer
encef
il
eby#v
im /
etc/
named.
rf
c1912.
zones
command
* Got
oli
nenumber19andcopy5l
i
nesandpast
ethem atl
astoft
hef
il
e.
zone "
<domai
nname>" I
N {
t
ype-
slav
e;
f
il
e "
slav
es/
<for
war
dlookupzonef
il
ename>"
;
mast
er{<Pr
imar
yDNSser
verI
Paddr
ess;}
;
}
;
Exampl
e:zone "
exampl
e.com" I
N {
t
ype-
slav
e;
f
il
e "
slav
es/
named.
for
war
d";
mast
er{172.
25.
9.11;}
;
}
;
* Got
oli
nenumber31andcopy5l
i
nesandpast
ethem atl
astoft
hef
il
e.
zone "
<Thr
eeoct
etsoft
heDNSser
verI
Paddr
ess>.i
n.addr.ar
pa" I
N {
t
ype-
slav
e;
f
il
e "
slav
es/
<rev
ersel
ookupzonef
il
ename>"
;
mast
er{<Pr
imar
yDNSser
verI
Paddr
ess;}
;
}
;
Exampl
e:zone "
9.25.
172.i
n.addr.ar
pa" I
N {
t
ype-
slav
e;
f
il
e "
slav
es/
named.
rev
erse"
;
mast
er{172.
25.
9.11;}
;
}
; (
sav
eand
exi
tthi
sfi
l
e)
(
iv)Copy/
var
/named/
slav
es/
named.
local
hostt
o/v
ar/
named/
slav
es/
named.
for
war
d
andedi
tasf
oll
ows.
#mkdi
r/v
ar/
named/
slav
es
#cp -
p /
var
/named/
slav
es/
named.
local
host
/
var
/named/
slav
es/
named.
for
war
d
#v
im /
var
/named/
slav
es/
named.
for
war
d
* Got
oli
nenumber2andedi
tasf
oll
ows.
@ I
N SOA <secondar
yDNSser
verf
ull
yqual
i
fieddomai
nname>.com
r
oot.<domai
nname>. {
* Got
oli
nenumber8andedi
tasf
oll
ows.
NS <DNSser
verf
ull
yqual
i
fieddomai
nname>.

Rat
nakar
Page168
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

A <DNSser
verI
Paddr
ess>
<secondar
yDNSser
verf
ull
yqual
i
fieddomai
nname> I
N A <secondar
y
DNSser
verI
Paddr
ess>
<DNSser
verf
ull
yqual
i
fieddomai
nname> I
N A<DNSser
verI
Paddr
ess>
<Cl
i
ent1f
ull
yqual
i
fieddomai
nname> I
N A<Cl
i
ent1I
Paddr
ess>
<Cl
i
ent2f
ull
yqual
i
fieddomai
nname> I
N A<Cl
i
ent2I
Paddr
ess>
<Cl
i
ent3f
ull
yqual
i
fieddomai
nname> I
N A<Cl
i
ent3I
Paddr
ess>
www I
N CNAME <DNSser
verf
ull
yqual
i
fieddomai
nname>
Exampl
e:Thel
i
nenumber2shoul
dbeedi
tedasf
oll
ows.
@ I
N SOA ser
ver
6.exampl
e.com. r
oot
.exampl
e.com. {
Thel
i
nenumber8shoul
dbeedi
tedasf
oll
ows.
NS ser
ver
6.ex
ampl
e.com.
A 172.
25.
6.11
ser
ver
6.ex
ampl
e.com. I
N A 172.
25.
6.11
ser
ver
9.ex
ampl
e.com. I
N A 172.
25.
9.11
cl
i
ent
9.ex
ampl
e.com. I
N A 172.
25.
9.10
cl
i
ent
10.
exampl
e.com. I
N A 172.
25.
9.12
cl
i
ent
11.
exampl
e.com. I
N A 172.
25.
9.13
www I
N CNAME ser
ver
6.exampl
e.com.
(
sav
eandexi
tthi
sfi
l
e)
(
v)Copy/
var
/named/
slav
es/
named.
empt
y f
il
eto
/
var
/named/
slav
es/
named.
rev
erseandedi
tasf
oll
ows.
#cp -
p /
var
/named/
slav
es/
named.
empt
y /
var
/named/
slav
es/
named.
rev
erse
#v
im /
var
/named/
slav
es/
named.
rev
erse
* Got
oli
nenumber2andedi
tasf
oll
ows.
@ I
N SOA <secondar
yDNSser
verf
ull
yqual
i
fieddomai
nname>.com
r
oot.<domai
nname>. {
* Got
oli
nenumber8andedi
tasf
oll
ows.
NS <secondar
yDNSser
verf
ull
yqual
i
fieddomai
nname>.
<Lastoct
etoft
hesecondar
yDNSser
verI
Paddr
ess> I
N PTR <secondar
y
DNSser
verf
ull
yqual
i
fied
domai
nname>
<Lastoct
etoft
heDNSser
verI
Paddr
ess> I
N PTR <DNSser
verf
ull
y
qual
i
fieddomai
nname>
<Lastoct
etoft
heCl
i
ent1I
Paddr
ess> I
N PTR <Cl
i
ent1f
ull
yqual
i
fied
domai
nname>
<Lastoct
etoft
heCl
i
ent2I
Paddr
ess> I
N PTR <Cl
i
ent2f
ull
yqual
i
fied
domai
nname>
<Lastoct
etoft
heCl
i
ent3I
Paddr
ess> I
N PTR <Cl
i
ent3f
ull
yqual
i
fied
domai
nname>

Rat
nakar
Page169
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

<secondar
yDNSser
verf
ull
yqual
i
fieddomai
nname> I
N A <secondar
y
DNSser
verI
Paddr
ess>
www I
N CNAME <secondar
yDNSser
verf
ull
yqual
i
fieddomai
n
name>
Exampl
e:Thel
i
nenumber2shoul
dbeedi
tedasf
oll
ows.
@ I
N SOA ser
ver
6.exampl
e.com. r
oot
.exampl
e.com. {
Thel
i
nenumber8shoul
dbeedi
tedasf
oll
ows.
NS ser
ver
6.exampl
e.com.
11 I
N PTR ser
ver
6.exampl
e.com.
11 I
N PTR ser
ver
9.exampl
e.com.
10 I
N PTR cl
i
ent
9.exampl
e.com.
12 I
N PTR cl
i
ent
10.
exampl
e.com.
13 I
N PTR cl
i
ent
11.
exampl
e.com.
ser
ver
6.ex
ampl
e.com. I
N A 172.
25.
6.11
www I
N CNAME ser
ver
6.exampl
e.com.
(
sav
eandexi
tthi
sfi
l
e)
(
vi)Checkt
heDNS conf
igur
ati
onf
il
esf
orsy
ntaxer
ror
s.
#named-
checkconf /
etc/
named.
conf
#named-
checkconf /
etc/
named.
rf
c1912.
zones
#name-
checkzone <domai
nname><f
orwar
dlookupzone>
Exampl
e:#named-
checkzone exampl
e.com
/
var
/named/
slav
es/
named.
for
war
d
#named-
checkz
one <domai
nname><r
ever
sel
ookupzone>
Exampl
e:#named-
checkzone exampl
e.com /
var
/named/
slav
es/
named.
rev
erse
(
vii
)Gi
vef
ull
per
missi
onst
othef
orwar
dandr
ever
sel
ookupzones.
#chmod 777 /
var
/named/
slav
es/
named.
for
war
d
#chmod 777 /
var
/named/
slav
es/
named.
rev
erse
(
vii
i
)Open /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h0 andent
ert
heDNSdomai
n
det
ail
sifnotpr
esent
.
#v
im /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h0 (
got
olastl
i
neand
t
ypeasf
oll
ows)
DNS1=ex
ampl
e.com
(
sav
eandexi
tthi
sfi
l
e)
(
ix)Addt
heDNSser
verI
Paddr
essi
n/et
c/r
esol
ve.
conf
#v
im /
etc/
resol
ve.
conf
sear
ch <domai
nname>
namesev
er <I
Paddr
essoft
heDNSser
ver
>
namesev
er <I
Paddr
essoft
hesecondar
yDNSser
ver
>
Exampl
e:
sear
ch exampl
e.com

Rat
nakar
Page170
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

nameser
ver 172.
25.
9.11
nameser
ver 172.
25.
6.11 (
sav
eand
exi
tthi
sfi
l
e)
(
x)Rest
artt
heDNSser
verdeamons.
#ser
vicenamedr
est
art (
tor
est
artt
hedeamoni
nRHEL-6)
#chkconf
ignamedon (
toenabl
ethedeamonat
nextboott
imei
nRHEL-6)
#sy
stemct
lrest
artnamed unbound (
tor
est
artt
hedeamonsi
n
RHEL-7)
#sy
stemct
lenabl
enamed unbound (
toenabl
ethedeamonsat
nextboott
imei
nRHEL-
7)
(
xi)Addt
heDNSser
vicet
otheI
Ptabl
es andFi
rewal
l
.
#set
up (
thensel
ectt
heFi
rewal
lconf
igur
ati
onopt
ion
andaddDNSi
nRHEL-6)
#ser
vicei
ptabl
esr
est
art (
tor
est
artt
heI
Ptabl
esi
nRHEL
-6)
#ser
vicei
ptabl
essav
e (
tosav
etheI
Ptabl
esi
n
RHEL-6)
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=dns (
toaddt
heDNSser
vicet
o
f
ir
ewal
linRHEL-7)
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad (
tor
eloadt
hef
ir
ewal
linRHEL-
7)
(
xi) Checkwhet
hert
heDNSi
sresol
vi
ngornot
.
#di
g <DNSser
verf
ull
yqual
i
fiedname> (
tocheckt
her
esol
vi
ngf
rom
host
namet
oIPaddr
ess)
#di
g -
x <DNSser
verI
Paddr
ess> (
tocheckt
her
esol
vi
ngf
rom
I
Paddr
esst
ohost
name)
Exampl
e:#di
g ser
ver
6.exampl
e.com
#di
g -
x 172.
25.
6.11
(
xii
)Checkt
her
esol
uti
onwi
thpi
ngt
est
.
#pi
ng-
c3<secondar
yDNSser
verf
ull
yqual
i
fieddomai
nname>(
tocheckt
he
pi
ngt
estwi
thhost
name)
#pi
ng -
c3 <I
Paddr
essoft
hesecondar
yDNSser
ver
>(t
ocheckt
hepi
ngt
est
wi
thI
Paddr
ess)
Exampl
e:
#pi
ng -
c3 ser
ver
6.exampl
e.com
#pi
ng -
c3 172.
25.
6.11
(
xii
i
)Checkt
her
esol
uti
onwi
thhostcommand.
#host <host
name> (
tocheckt
he
r
esol
uti
onwi
thhost
name)

Rat
nakar
Page171
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#host <I
Paddr
ess> (
tocheckt
he
r
esol
uti
onwi
thI
Paddr
ess)
Exampl
e:
#host ser
ver
6.exampl
e.com
#host 172.
25.
6.11
(
xiv
)Checkt
her
esol
uti
onwi
thnsl
ookupcommand.
#nsl
ookup <host
name> (
tocheckt
he
r
esol
uti
onwi
thhost
name)
#nsl
ookup <I
Paddr
ess> (
tocheckt
he
r
esol
uti
onwi
thI
Paddr
ess)
Exampl
e:
#nsl
ookup ser
ver
6.exampl
e.com
#nsl
ookup 172.
25.
6.11

Rat
nakar
Page172
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

19.DHCP(
Dynami
cHostConf
igur
ati
onPr
otocol
)

1. Whati
sDHCP andexpl
aini
t?
DHCP st
andsf
orDy
nami
cHostConf
igur
ati
onPr
otocol
.DHCPi
sanet
wor
kpr
otocol
t
hatenabl
est
heser
vert
oassi
gnanI
Paddr
essest
othecl
i
ent
sint
henet
wor
k
aut
omat
ical
l
yfr
om adef
inedr
angeofI
Paddr
essesi
e.,
scopeconf
igur
edf
oragi
ven
net
wor
k.
DHCP al
l
owsacomput
ert
ojoi
ninanI
P-basednet
wor
kwi
thouthav
ingapr
e-conf
igur
ed
I
Paddr
ess.DHCP i
sapr
otocol
thatassi
gnuni
queI
Paddr
essest
odev
ices,t
hen
r
eleasesandr
enewst
hoseaddr
essesasdev
icesl
eav
eandr
ejoi
nint
henet
wor
k.
I
nter
netSer
vicePr
ovi
der
s(I
SPs)usual
l
yuseDHCP t
ohel
pcust
omer
sjoi
nthei
r
net
wor
kswi
thmi
nimum set
upef
for
trequi
red.Li
kewi
se,homenet
wor
kequi
pmentl
i
ke
br
oadbandr
out
ersof
fer
sDHCP suppor
ttoj
oini
nghomecomput
erst
oLocalAr
ea
Net
wor
ks(
LANs)
.
I
nsi
mpl
eter
msDHCPi
susedt
oassi
gnt
heI
Paddr
essest
other
emot
ehost
s
aut
omat
ical
l
y.Fi
rstcl
i
entr
equest
stot
heDHCP ser
ver
,thenDHCP ser
veraccept
sthe
cl
i
ent
'sr
equestandassi
gnt
henextav
ail
abl
eIPaddr
esst
other
equest
edDHCP cl
i
ent
.
2. How t
heDHCP wor
ks?
Thepr
ocessofr
equest
ingt
heI
Paddr
essf
rom t
heDHCP cl
i
ent
sandassi
gnt
heI
P
addr
essbyt
heDHCP ser
veri
scal
l
ed"
DORA"
.
(
i)Whenweswi
tchont
hesy
stem wi
thDHCP cl
i
ent
,thecl
i
entsy
stem sendst
he
br
oadcastr
equestl
ooki
ng f
oraDHCP ser
vert
oanswer
.Thi
spr
ocessi
scal
l
ed
DI
SCOVER orDHCPDI
SCOVER.
(
ii
)Ther
out
erdi
rect
stheDI
SCOVER packett
othecor
rectDHCP ser
ver
.
(
ii
i)Theser
verr
ecei
vest
heDI
SCOVER packet
.Basedonav
ail
abi
l
ityandusage
pol
i
ciessetont
heser
ver
,the ser
verdet
ermi
nesanappr
opr
iat
eaddr
ess(
ifany
)to
gi
vet
othecl
i
ent
.Theser
vert
hent
empor
ari
l
yreser
ves t
hataddr
essf
ort
hecl
i
ent
andsendsbackt
othecl
i
entanOFFER or
DHCPOFFER packetwi
tht
hataddr
ess
i
nfor
mat
ion.Theser
veral
soconf
igur
est
hecl
i
ent
'sDNSser
ver
s,WI
NSser
ver
s,NTP
ser
vesand somet
imesot
herser
vicesal
so.
(
iv) Thent
heCl
i
entsendsaREQUEST orDHCPREQUEST packet
,let
ti
ngt
he
ser
verknowt
hati
tint
endst
o uset
headdr
ess.
(
v)Thent
heser
versendsanACK orDHCPACK packet
,conf
ormi
ngt
hatt
hecl
i
ent
hasbeengi
venal
ease ont
headdr
essf
oraser
verspeci
fi
edper
iodoft
ime.
3. Whati
sthedi
sadv
ant
aget
oassi
gnt
heSt
ati
cIPaddr
ess?
Whenasy
stem usesast
ati
cIPaddr
ess,I
tmeanst
hatt
hesy
stem i
smanual
l
y
conf
igur
edt
ouseaspeci
fi
cIPaddr
ess.Onepr
obl
em wi
thst
ati
cassi
gnment
,whi
ch
canr
esul
tfr
om userer
rorori
nat
tent
iont
odet
ail
,occur
swhent
wosy
stemsar
e
conf
igur
edwi
tht
hesameI
Paddr
ess.Thi
scr
eat
esaconf
li
ctt
hatr
esul
tsi
nlossof

Rat
nakar
Page173
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

ser
vice.Usi
ngDHCP t
ody
nami
cal
l
yassi
gnI
Paddr
essest
oav
oidt
heseconf
li
cts.
4. Whati
sthepr
ofi
leofDHCP?
Package : dhcp*
Scr
iptf
il
e : /
etc/
ini
t.
d/dhcpd
Conf
igur
ati
onf
il
e : /
etc/
dhcp/
dhcpd.
conf
Deamon : dhcpd
Por
tnumber
s : 67(
dhcpser
ver
)and68(
dhcpcl
ient
)
Logmessages : /
var
/log/
messages

5. Howt
oconf
igur
etheDHCP ser
ver
?
(
i)Assi
gnast
ati
cIPaddr
esst
otheDHCPser
ver
.
(
ii
)Inst
all
theDHCP packageby#y
um i
nst
alldhcp* -
y command.
(
ii
i)Opent
heDHCP conf
igur
ati
onf
il
eby#v
im /
etc/
dhcp/
dhcpd.
conf command.
Thi
sfi
l
eisempt
yandwe hav
etocopyt
hesampl
efi
l
efr
om
/
usr
/shar
e/doc/
dhcp-
4.25/
dhcpd.
conf
.exampl
etot
heabov
elocat
ion by#cp -
p/
usr
/shar
e/doc/
dhcp-
4.25/
dhcpd.
conf
.exampl
e /
etc/
dhcp/
dhcpd.
conf
command.
(
iv)Now opent
heabov
eDHCP conf
igur
ati
onf
il
eby#v
im /
etc/
dhcp/
dhcpd.
conf
command.
* Got
oli
nenumber47andedi
tthatl
i
neasbel
ow.
subnet <DHCP ser
verNet
wor
kID> net
mask <subnet
maskoft
het
his
net
wor
k> {
r
ange <st
art
ingI
Paddr
ess><endi
ngI
Paddr
ess>;
def
aul
t-
lease-
ti
me 600; (
themi
nimum l
easet
imet
othe
cl
i
enti
nseconds)
max-
lease-
ti
me 7200; (
hemaxi
mum l
easet
ime
t
othecl
i
enti
nseconds)
}
Exampl
e:
subnet 172.
25.
0.0 net
mask 255.
255.
255.
0{
r
ange 172.
25.
9.50 172.
25.
9.100;
def
aul
t-
lease-
ti
me 600;
max-
lease-
ti
me 7200;
}
*Got
oli
nenumber51andedi
tthatasbel
ow.
opt
ionr
out
es <DHCP ser
verI
Paddr
ess>;
opt
ionbr
oadcast
-addr
ess <DHCP ser
verbr
oadcastaddr
ess>;
Exampl
e:
opt
ionr
out
es 172.
25.
9.11;
opt
ionbr
oadcast
-addr
ess 172.
25.
9.255; (
sav
eand

Rat
nakar
Page174
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

exi
tthi
sfi
l
e)
(
v)Rest
artt
heDHCPser
vicesi
nRHEL-6and RHEL-7.
#ser
vicedhcpdr
est
art (
tor
est
artt
heDHCP
ser
vicei
nRHEL-6)
#chkconf
igdhcpdon (
toenabl
etheDHCPser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artdhcpd (
tor
est
artt
heDHCP
ser
vicei
nRHEL-7)
#sy
stemct
lenabl
edhcpd (
toenabl
etheDHCPser
viceatnext
booti
nRHEL-7)
(
vi) Addt
heDHCP ser
vicet
otheI
Ptabl
esandFi
rewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
p udp -
iet
h0 -
-depor
t 67 -
j ACCEPT
#i
ptabl
es -
A I
NPUT -
ptcp -
iet
h0 -
-depor
t 67 -
j ACCEPT
#i
ptabl
es -
A I
NPUT -
p udp -
iet
h0 -
-depor
t 68 -
j ACCEPT
#i
ptabl
es -
A I
NPUT -
ptcp -
iet
h0 -
-depor
t 68 -
j ACCEPT
#i
ptabl
es -
A OUTPUT -
p udp -
iet
h0 -
-depor
t 67 -
j ACCEPT
#i
ptabl
es -
A OUTPUT -
ptcp -
iet
h0 -
-depor
t 67 -
j ACCEPT
#i
ptabl
es -
A OUTPUT -
p udp -
iet
h0 -
-depor
t 68 -
j ACCEPT
#i
ptabl
es -
A OUTPUT -
ptcp -
iet
h0 -
-depor
t 68 -
j ACCEPT
I
nRHEL-7:
#f
ir
ewal
l-
cmd -
-per
manent -
-add-
ser
vice=dhcp
#f
ir
ewal
l-
cmd -
-compl
ete-
rel
oad
(
vii
)#cat/
var
/li
b/dhcpd/
dhcpd.
lease (
toseet
heDHCP l
easemessage
dat
abaseonDHCP ser
ver
)
6. Howt
oconf
igur
etheDHCP cl
ient
?
(
i)Changet
heI
Paddr
essi
ngf
rom st
ati
ctody
nami
cifi
tisconf
igur
edasst
ati
c.
I
nRHEL-6:
#set
up
Net
wor
kConf
igur
ati
on -
--
--
> Pr
essEnt
er-
--
--
> Dev
iceConf
igur
ati
on -
--
--
>
Sel
ectet
h0 -
--
--
>
Pr
essEnt
er-
--
--
> Sel
ectUseDHCP -
--
--
> Pr
essSpacebar-
--
--
> OK -
--
--
>
Sav
e--
--
->Sav
e&Qui
t
-
--
--
> Qui
t
#ser
viceNet
wor
kManagerr
est
art
#ser
vicenet
wor
krest
art
I
nRHEL-7:
#nmcl
iconnect
ionmodi
fy"
Syst
em et
h0"i
pv4.
met
hod aut
oordy
nami
c
#nmcl
iconnect
iondown"
Syst
em et
h0"
#nmcl
iconnect
ionup"
Syst
em et
h0"

Rat
nakar
Page175
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#sy
stemct
lrest
artnet
wor
k
(
ii
)Open /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h0 f
il
eandedi
ttheBOOTPROTO
l
i
ne.
#v
im /
etc/
sysconf
ig/
net
wor
k-scr
ipt
s/i
fcf
g-et
h0
* Got
oBOOTPROTO l
i
neandedi
tthatl
i
neasbel
ow.
BOOTPROTO=dhcp (
sav
eand
exi
tthi
sfi
l
e)
(
ii
i)Gett
heI
Paddr
essf
rom t
heDHCP ser
ver
.
#dhcl
i
ent
#i
fdownet
h0
#i
fupet
h0
7. Howt
ofi
xtheI
Paddr
esst
othecl
ientev
eryt
imei
trequest
sorhowt
oconf
igur
ethe
MAC bi
ndi
ng?
Thepr
ocessofassi
gni
ngt
hesameI
Paddr
ess(
fi
xedI
P addr
ess)t
otheDHCP
cl
i
entev
eryt
imei
tboot
edi
scal
l
ed"
MAC bi
ndi
ng"
.
(
i)Opent
hef
il
e/et
c/dhcp/
dhcpd.
confby #v
im /
etc/
dhcp/
dhcpd.
conf command.
* Got
oli
nenumber76and77andedi
tthosel
i
nesasbel
ow.
host<dhcpcl
i
enthost
name> {
har
dwar
eet
her
net <MAC addr
essoft
heCl
i
ent
'
sNI
C car
d>;
f
ixedaddr
esses <I
P addr
ess>;
}
Exampl
e:
host cl
i
ent1 {
har
dwar
e et
her
net 2015:
ac18:
:
55;
f
ixedaddr
esses 172.
25.
9.150;
} (
sav
eand
exi
tthi
sfi
l
e)
(
ii
)Rest
artt
heDHCPser
vicesi
nRHEL-6and RHEL-7.
#ser
vicedhcpdr
est
art (
tor
est
artt
heDHCP
ser
vicei
nRHEL-6)
#chkconf
igdhcpdon (
toenabl
etheDHCPser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artdhcpd (
tor
est
artt
heDHCP
ser
vicei
nRHEL-7)
#sy
stemct
lenabl
edhcpd (
toenabl
etheDHCPser
viceatnext
booti
nRHEL-7)
* Thent
heabov
eMAC addr
essoft
hesy
stem wi
l
lgett
hesameI
P addr
essev
ery
t
imei
tboot
ed.

Rat
nakar
Page176
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

20.WebSer
ver(
Apache)

1. Whati
sWebser
verandexpl
aini
t?
AWebser
veri
sasy
stem t
hatdel
i
ver
scont
entorser
vicest
oenduser
sov
ert
heI
nter
net
.
AWebser
verconsi
sts ofaphy
sical
ser
ver
,ser
veroper
ati
ngsy
stem (
OS)and
sof
twar
eusedt
ofaci
l
itat
eHTTPcommuni
cat
ion.
Acomput
ert
hatr
unsaWebsi
te.Usi
ngt
heHTTPpr
otocol
,theWebser
verdel
i
ver
sWeb
pagest
obr
owser
saswel
lasot
herdat
afi
l
est
oWeb-
basedappl
i
cat
ions.TheWebser
ver
i
ncl
udest
hehar
dwar
e,oper
ati
ngsy
stem, Webser
versof
twar
e,TCP/
IPpr
otocol
sandsi
te
cont
ent(
Webpages,
imagesandot
herf
il
es)
.Ift
heWebser
veri
s usedi
nter
nal
l
yandi
snot
exposedt
othepubl
i
c,i
tisan"
int
ranetser
ver
"andi
ftheWebser
veri
susedi
nthe
i
nter
netandi
sexposedt
othepubl
i
c,i
tisanI
nter
netser
ver
.
2. Whati
sPr
otocol
?
Auni
for
m setofr
ulest
hatenabl
etwodev
icest
oconnectandt
ransmi
tthedat
atoone
anot
her
.Pr
otocol
s det
ermi
nehowdat
aar
etr
ansmi
tt
edbet
weencomput
ingdev
icesand
ov
ernet
wor
ks.Theydef
inei
ssuessuch aser
rorcont
rolanddat
acompr
essi
on
met
hods.Thepr
otocol
det
ermi
nest
hef
oll
owi
ngt
ypeofer
rorchecki
ng t
obeused,dat
a
compr
essi
onmet
hod(
ifany
),howt
hesendi
ngdev
icewi
l
lindi
cat
ethati
thasf
ini
sheda
messageandhowt
her
ecei
vi
ngdev
icewi
l
lindi
cat
ethati
thasr
ecei
vedt
hemessage.
I
nter
netpr
otocol
sincl
ude TCP/
IP(
Transmi
ssi
onCont
rolPr
otocol
/Int
ernetPr
otocol
),
HTTP(
HyperTextTr
ansf
erPr
otocol
),FTP(
Fil
e Tr
ansf
erPr
otocol
)andSMTP(
Simpl
e
Mai
lTr
ansf
erPr
otocol
).
3. How aWebser
verwor
ks?
(
i)I
ftheusert
ypesanURLi
nhi
sbr
owser
saddr
essbar
,thebr
owserwi
l
lspl
i
tst
hat
URLi
ntoanumberof separ
atepar
tsi
ncl
udi
ngaddr
ess,pat
hname
andpr
otocol
.
(
ii
)A DNS(
Domai
nNami
ngSer
ver
)tr
ansl
atest
hedomai
nnamet
heuserhasent
ered
i
ntoi
tsI
Paddr
ess,a numer
iccombi
nat
iont
hatr
epr
esent
sthesi
te'
str
ue
addr
essont
hei
nter
net
.
(
ii
i)Thebr
owsernowdet
ermi
neswhi
chpr
otocol(
rul
esandr
egul
ati
onwhi
cht
hecl
i
ent
machi
neusedt
o communi
cat
ewi
thser
ver
s)shoul
dbeused.For
exampl
eFTP(
Fil
eTr
ansf
erPr
otocol
)andHTTP(
Hyper TextTr
ansf
erPr
otocol
).
(
iv)Theser
versendsaGET r
equestt
otheWebSer
vert
oret
ri
evet
headdr
essi
thas
beengi
ven.Forexampl
e whenausert
ypes
ht
tp:
//www.
exampl
e.com/
Myphot
o.j
pg,t
hebr
owsersendsaGETMy
phot
o.j
pg
commandt
oexampl
e.com ser
verandwai
tsf
orar
esponse.Theser
vernow
r
espondst
othebr
owser
's r
equest
s.I
tver
if
iest
hatt
hegi
venaddr
essex
ist
,fi
nds
t
henecessar
yfi
l
es,r
unst
heappr
opr
iat
escr
ipt
s, exchangescooki
esi
f
necessar
yandr
etur
nst
her
esul
tsbackt
othebr
owser
.Ifi
tcannotl
ocat
ethef
il
e,
t
heser
versendsaner
rormessaget
othecl
i
ent
.

Rat
nakar
Page177
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
v)Thent
hebr
owsert
ransl
atest
hedat
aithasbeengi
veni
ntoHTMLanddi
spl
ayst
he
r
esul
tst
otheuser
.
4. I
nhowmanyway
scanwehostt
hewebsi
tes?
I
PbasedWebHost
ing:
I
Pbasedwebhost
ingi
susedI
Paddr
essorhost
namewebhost
ing.
NamebasedWebHost
ing:
Host
ingt
hemul
ti
plewebsi
tesusi
ngsi
ngl
eIPaddr
ess.
Por
tbasedWebHost
ing:
Webhost
ingusi
nganot
herpor
tnumberi
e.,
othert
hant
hedef
aul
tpor
tnumber
.
UserbasedWebHost
ing:
Wecanhostt
heWebsi
tesusi
ngt
heusernameandpasswor
d.

5. Whati
sApacheWebSer
ver
?
Apachei
saopensour
cewebser
ver
.Iti
smost
lyusedwebser
veri
nthei
nter
net
.ht
tpd
i
sthedeamont
hatspeakst
heht
tporht
tpspr
otocol
s.I
tisat
extbasedpr
otocol
for
sendi
ngandr
ecei
vi
ngt
heobj
ect
sov
eranet
wor
kconnect
ion.Theht
tppr
otocoli
ssent
ov
ert
hewi
rednet
wor
kincl
eart
extusi
ngdef
aul
tpor
tnumber80/
tcp.Topr
otectt
he
websi
tewecanuseht
tpswebser
verf
ordat
aencr
ypt
ion.
6. Whati
sthepr
ofi
lef
orWebser
ver
?
Package : ht
tpd
scr
ipt : /
etc/
ini
t.
d/ht
tpd
Deamon : ht
tpd
Conf
igur
ati
onf
il
e: /
etc/
htt
pd/
conf
/ht
tpd.
conf (
forht
tp)
/
etc/
htt
pd/
conf
.d/
ssl
.conf (
forht
tps)
DocumentRoot: /
var
/www/
html
Logf
il
es : /
var
/log/
htt
pd/
access_
log
/
var
/log/
htt
pd/
err
or_
log
Por
tNumber : 80/
htt
pand443/
htt
ps
*I
fwewantt
oconf
igur
etheht
tpdser
ver
,wehav
etof
oll
owt
heI
SET r
ules.wher
eI-
I
nst
all
, S-St
art
,
E-Enabl
e and T-Test
.
* Toaccesst
hewebsi
tesusi
ngt
heCLImodee-
li
nks,cur
ltool
s ar
eusedandt
o
accesst
hewebsi
tesusi
ng
t
hebr
owseri
nLi
nuxFi
ref
oxi
sused.
7. Howt
omaket
heht
tpwebser
verav
ail
abl
etot
hecl
eint
?
(
a)Fi
rstassi
gnt
hest
ati
cIPaddr
essandhost
namet
otheser
ver
.
(
b)Checkwhet
hert
heser
verpackageby #r
pm -
qa ht
tpd* command.
(
c)I
fnoti
nst
all
ed,i
nst
all
thewebser
verpackageby #y
um i
nst
allht
tpd* -
y
command.
(
d)St
artt
hewebser
verandenabl
ewebser
verser
viceatnextboot
.

Rat
nakar
Page178
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
viceht
tpdst
art (
tost
artt
hewebser
verdeamon
i
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
e)Opent
hebr
owserandaccesst
hewebser
verdocument
.
#f
ir
efox (
toopent
he
f
ir
efoxbr
owser
)
* Theni
naddr
essbart
ypeasht
tp:
//l
ocal
host
/manualandpr
essEnt
erkey
.
8. Howt
oconf
igur
etheI
Pbasedv
irt
ual
hostWebser
ver
?
(
a)Fi
rstassi
gnt
hest
ati
cIPaddr
essandhost
namet
otheser
ver
.
(
b)Checkwhet
hert
heser
verpackageby #r
pm -
qa ht
tpd* command.
(
c)I
fnoti
nst
all
ed,i
nst
all
thewebser
verpackageby #y
um i
nst
allht
tpd* -
y
command.
(
d)Checkt
heconf
igur
ati
onf
il
etoconf
igur
etheht
tpwebser
verby #r
pm -
qac ht
tpd
command.
(
e)I
frequi
redopent
hewebser
verdocumentby #r
pm -
qad ht
tpd command.
(
f)Got
otheconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d
(
g)Cr
eat
etheconf
igur
ati
onf
orI
Pbasedhost
ing.
#v
im /
etc/
htt
pd/
conf
.d/
ip.
conf
<Vi
rt
ual
Host <I
Paddr
essoft
hewebser
ver
>:80>
Ser
ver
Admi
nroot
@<host
nameoft
hewebser
ver
>
Ser
ver
Name <host
nameoft
hewebser
ver
>
Document
Root /
var
/www/
html
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
html
">
All
owOver
ri
de none
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
> (
sav
eand
exi
tthi
sfi
l
e)
Exampl
e:
#v
im /
etc/
htt
pd/
conf
.d/
ip.
conf (
creat
ethe
conf
igur
ati
onf
il
e)
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
n r
oot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com

Rat
nakar
Page179
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Document
Root /
var
/www/
html
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
html
">
All
owOver
ri
denone
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
>
(
h)Got
odocumentr
ootdi
rect
oryandcr
eat
ethei
ndex.
htmlf
il
e.
#cd /
var
/www/
html
#v
im i
ndex.
html
<ht
ml>
<H1>
Thi
sisI
PbasedWebHost
ing
</H1>
</ht
ml>
(
saveandexi tthi
sfi
le)
(
i)Restar
tthewebser
v erdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
j)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
k)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//ser
ver
9.exampl
e.com i
naddr
essbar andcheckt
hei
ndexpagei
sdi
spl
ayed
ornot
.
(
l)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump ser
ver
9.exampl
e.com (
access
t
hei
ndexpage)

Rat
nakar
Page180
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

9. Howt
oconf
igur
ethenamebasedwebhost
ing?
(
a)Makeadi
rect
oryf
orv
irt
ualornamedbasedhost
ing.
#mkdi
r/v
ar/
www/
vir
tual
(
b)Got
otheconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d
(
c)Cr
eat
etheconf
igur
ati
onf
ornamebasedhost
ing.
#v
im /
etc/
htt
pd/
conf
.d/
vir
tual
.conf
<Vi
rt
ual
Host <I
Paddr
essoft
hewebser
ver
>:80>
Ser
ver
Admi
nroot
@<host
nameoft
hewebser
ver
>
Ser
ver
Name <v
irt
ual
host
nameoft
hewebser
ver
>
Document
Root /
var
/www/
vir
tual
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
vir
tual
">
All
owOver
ri
de none
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
> (
sav
eand
exi
tthi
sfi
l
e)
Exampl
e:
#v
im /
etc/
htt
pd/
conf
.d/
vir
tual
.conf (
creat
e
t
heconf
igur
ati
onf
il
e)
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
n r
oot
@ser
ver
9.exampl
e.com
Ser
ver
Name www9.
exampl
e.com
Document
Root /
var
/www/
vir
tual
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
vir
tual
">
All
owOver
ri
denone
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
>
(
d)Got
onamedbasedv
irt
ual
dir
ect
oryandcr
eat
ethei
ndex.
htmlf
il
e.
#cd /
var
/www/
vir
tual
#v
im i
ndex.
html
<ht
ml>
<H1>
Thi
sisNamebasedWebHost
ing
</H1>
</ht
ml>
(
saveandexi tthisfi
le)
(
e)Restar
tthewebserv erdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)

Rat
nakar
Page181
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
f)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
g) Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//www9.
exampl
e.com i
naddr
essbar andcheckt
hei
ndexpagei
sdi
spl
ayed
ornot
.
(
h)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump www9.
exampl
e.com (
access
t
hei
ndexpage)
10.Howt
oconf
igur
ethepor
tbasedwebhost
ing?
(
a)Makeadi
rect
oryf
orpor
tbasedhost
ing.
#mkdi
r/v
ar/
www/
por
t
(
b)Got
otheconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d
(
c)Cr
eat
etheconf
igur
ati
onf
orpor
tbasedhost
ing.
#v
im /
etc/
htt
pd/
conf
.d/
por
t.
conf
<Vi
rt
ual
Host <I
Paddr
essoft
hewebser
ver
>:8999>
Ser
ver
Admi
nroot
@<host
nameoft
hewebser
ver
>
Ser
ver
Name <por
tbasedhost
nameoft
hewebser
ver
>
Document
Root /
var
/www/
por
t
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
por
t"
>
All
owOver
ri
de none
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
> (
sav
eand
exi
tthi
sfi
l
e)

Rat
nakar
Page182
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Exampl
e:
#v
im /
etc/
htt
pd/
conf
.d/
vir
tual
.conf (
creat
e
t
heconf
igur
ati
onf
il
e)
<Vi
rt
ual
Host 172.
25.
9.11:
8999>
Ser
ver
Admi
n r
oot
@ser
ver
9.exampl
e.com
Ser
ver
Name por
t9.
exampl
e.com
Document
Root /
var
/www/
por
t
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
por
t"
>
All
owOver
ri
denone
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
>
(
d)Got
opor
tbasedv
irt
ual
dir
ect
oryandcr
eat
ethei
ndex.
htmlf
il
e.
#cd /
var
/www/
por
t
#v
im i
ndex.
html
<ht
ml>
<H1>
Thi
sisPor
tbasedWebHost
ing
</H1>
</
html>
(
saveandexitthisfi
le)
(
e)Gener
all
ypor
tbasedwebhost
ingr
equi
resDNSser
ver
.So,
wecansol
vet
his
pr
obl
em byt
hef
oll
owi
ngway
.
Fort
hatopent
he /
etc/
host
sfi
l
eent
ert
heser
vernameandI
Paddr
essesonbot
h
ser
verandcl
i
ent
.
#v
im /
etc/
host
s
172.
25.
9.11 por
t5.
exampl
e.com (
sav
eand
exi
tthi
sfi
l
e)
(
f)Bydef
aul
tthewebser
verr
unsonpor
tnumber80.I
fwewantt
oconf
igur
eon
def
erentpor
tnumber
,we hav
etoaddt
hepor
tnumberi
nthemai
n
conf
igur
ati
onf
il
e.
#v
im /
etc/
htt
pd/
conf
/ht
tpd.
conf
* Got
oLi
sten:80l
i
neandopennewl
i
nebel
owt
hisl
i
neandt
ypeas,
Li
sten:8999 (
sav
eand
exi
tthi
sfi
l
e)
(
g)Bydef
aul
tSELi
nuxwi
l
lal
l
ow80and8080por
tnumber
sonl
yforwebser
ver
.Ifwe
usedi
ff
erentpor
t number
sot
hert
han80or8080t
henexecut
ethe
f
oll
owi
ngcommand.
#semanage por
t-a-
tht
tp_
por
t_t-
ptcp 8999
(
h)Rest
artt
hewebser
verdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver

Rat
nakar
Page183
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
i)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 8999-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 8999-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-per
manent -
add-
por
t=8999/
tcp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
j)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//por
t9.
exampl
e.com i
naddr
essbar and checkt
hei
ndexpagei
sdi
spl
ayed
ornot
.
(
k)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump por
t9.
exampl
e.com (
access
t
hei
ndexpage)
11.Howt
oconf
igur
euseraut
hent
icat
ionbasedwebhost
ing?
I
twi
l
laskusernameandpasswor
dtoaccesst
hiswebsi
te.So,
wehav
etopr
ovi
de
ht
tppasswor
d.
(
f)Got
otheconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d
(
g)Cr
eat
etheconf
igur
ati
onf
oruseraut
hent
icat
ionbasedhost
ing.
#v
im /
etc/
htt
pd/
conf
.d/
user
base.
conf
<Vi
rt
ual
Host <I
Paddr
essoft
hewebser
ver
>:80>
Ser
ver
Admi
nroot
@<host
nameoft
hewebser
ver
>
Ser
ver
Name <host
nameoft
hewebser
ver
>
Document
Root /
var
/www/
html
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
html
">
All
owOver
ri
de none
Requi
reAl
lGr
ant
ed

Rat
nakar
Page184
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Aut
hTy
pe Basi
c
Aut
hName "
Thi
ssi
tei
spr
otect
ed"
Aut
hUser
Fil
e /
etc/
htt
pd/
pass
Requi
reUser <username>
</
Dir
ect
ory
> (
sav
eand
exi
tthi
sfi
l
e)
Exampl
e:
#v
im /
etc/
htt
pd/
conf
.d/
user
base.
conf (
creat
ethe
conf
igur
ati
onf
il
e)
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
n r
oot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com
Document
Root /
var
/www/
html
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
html
">
All
owOver
ri
denone
Requi
reAl
lGr
ant
ed
Aut
hTy
pe Basi
c
Aut
hName "
Thi
ssi
tei
spr
otect
ed"
Aut
hUser
Fil
e /
etc/
htt
pd/
pass
Requi
reUser r
aju
</
Dir
ect
ory
>
(
h)Got
odocumentr
ootdi
rect
oryandcr
eat
ethei
ndex.
htmlf
il
e.
#cd /
var
/www/
html
#v
im i
ndex.
html
<ht
ml>
<H1>
Thi
sisUserAut hent
icat
ionbasedWebHost
ing
</H1>
</ht
ml>
(
saveandexi tthisfi
le)
(
i)Restar
tthewebserv erdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
j)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.

Rat
nakar
Page185
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
k)Cr
eat
etheuserandassi
gnt
heht
tppasswor
d.
#user
addr
aju
* Don'
tgi
vet
henor
mal
passwor
dbecauset
hisuserr
equi
rest
heht
tppasswor
d.
#ht
passwd -
cm /
etc/
htt
pd/
pass <username>
Exampl
e:#ht
passwd -
cm /
etc/
htt
pd/
pass r
aju
(
l)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//ser
ver
9.exampl
e.com i
naddr
essbar andcheckt
hei
ndexpagei
sdi
spl
ayed
ornot
.Theni
taskspasswor
d,sowehav
etopr
ovi
deht
tppasswor
d.
(
m)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump ser
ver
9.exampl
e.com (
access
t
hei
ndexpage)
* Theni
taskspasswor
d,sowehav
etopr
ovi
deht
tppasswor
d.
12.Howt
orest
ri
ctt
hewebsi
tesaccessf
rom host
sordomai
nsornet
wor
ks?
(
a)Got
otheconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d
(
b)Cr
eat
etheconf
igur
ati
onf
orI
Pbasedhost
ing.
#v
im /
etc/
htt
pd/
conf
.d/
rest
ri
ct.
conf
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
nroot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com
Document
Root /
var
/www/
html
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
html
">
All
owOver
ri
de none
Requi
reAl
lGr
ant
ed
Or
derAl
l
ow,Deny
Al
l
ow f
rom 172.
25.
9.0or172.
25.
0(al
l
ows172.
25.
9net
wor
kor172.
25net
wor
k
t
oaccesst
hewebsi
tes)
Denyf
rom .
my133t
.or
g (
denyal
lthesy
stemsof *
.my
133t
.or
gdomai
nto
accesst
hewebsi
tes)

Rat
nakar
Page186
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

</
Dir
ect
ory
>
13.Howt
oRedi
rectt
hewebsi
te?
* Redi
rect
ingmeanswhenev
erweaccesst
hewebsi
te,i
tredi
rect
stoanot
herwebsi
te.

(
a)Got
otheconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d
(
b)Cr
eat
etheconf
igur
ati
onf
orr
edi
rectbasedhost
ing.
#v
im /
etc/
htt
pd/
conf
.d/
redi
ect
.conf
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
nroot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com
Document
Root /
var
/www/
html
Redi
rect/ "
htt
p:/
/www.
googl
e.com"
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
html
">
All
owOver
ri
de none
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
> (
sav
eand
exi
tthi
sfi
l
e)
(
c)Got
odocumentr
ootdi
rect
oryandcr
eat
ethei
ndex.
htmlf
il
e.
#cd /
var
/www/
html

#v
im i
ndex.
html
<ht
ml>
<H1>
Thi
sisRedi r
ectbasedWebHost
ing
</H1>
</ht
ml>
(
saveandexi tthisfi
le)
(
d)Restar
tthewebserv erdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
e)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT

Rat
nakar
Page187
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
f)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//ser
ver
9.exampl
e.com i
naddr
essbar andcheckt
her
edi
rect
iongoogl
eweb
pagei
sdi
spl
ayedornot
.
(
g)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump ser
ver
9.exampl
e.com (
access
t
hei
ndexpage)
* Thi
swebsi
ter
edi
rect
stot
hegoogl
ewebsi
te.
14.Howt
oconf
igur
ethewebsi
tewi
thal
i
asname?
(
a)Got
otheconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d
(
b)Cr
eat
etheconf
igur
ati
onf
oral
i
asbasedhost
ing.
#v
im /
etc/
htt
pd/
conf
.d/
ali
as.
conf
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
nroot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com
Document
Root /
var
/www/
html
Al
i
as /
pri
vat
e /
var
/www/
html
/pr
ivat
e
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
html
/pr
ivat
e">
All
owOver
ri
de none
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
> (
sav
eand
exi
tthi
sfi
l
e)
(
c)Cr
eat
epr
ivat
edi
rect
oryi
n/v
ar/
www/
html
.
#mkdi
r/v
ar/
www/
html
/pr
ivat
e
(
c)Got
odocumentr
ootpr
ivat
edi
rect
oryandcr
eat
ethei
ndex.
htmlf
il
e.
#cd /
var
/www/
html
/pr
ivat
e
#v
im i
ndex.
html
<ht
ml>
<H1>
Thi
sisAl
i
asbasedWebHost
ing
</H1>
</ht
ml>
(
saveandexi tthi
sfi
le)
(
d)Restar
tthewebser
v erdeamon.

Rat
nakar
Page188
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
e)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
f)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//ser
ver
9.exampl
e.com/
pri
vaei
naddr
ess barandcheckt
hepr
ivat
eor
al
i
asbasedwebpagei
sdi
spl
ayedornot
.
(
g)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump ser
ver
9.exampl
e.com/
pri
vat
e (
access
t
hei
ndexpage)
15.Howt
oconf
igur
ethedi
rect
orybasedwebhost
ing?
(
a)Got
otheconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d
(
b)Cr
eat
etheconf
igur
ati
onf
ordi
rectbasedhost
ing.
#v
im /
etc/
htt
pd/
conf
.d/
conf
ident
ial
.conf
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
nroot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com
Document
Root /
var
/www/
html
</
Vir
tual
Host
>

<Dir
ect
ory "/
var
/www/
html
/conf
ident
ial
">
All
owOver
ri
de none
Requi
reAl
lGr
ant
ed
</
Dir
ect
ory
> (
sav
eand
exi
tthi
sfi
l
e)

Rat
nakar
Page189
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
c)Cr
eat
econf
ident
ial
dir
ect
oryi
n/v
ar/
www/
html
.
#mkdi
r/v
ar/
www/
html
/conf
ident
ial
(
c)Got
oconf
ident
ial
dir
ect
oryandcr
eat
ethei
ndex.
htmlf
il
e.
#cd /
var
/www/
html
/conf
ident
ial
#v
im i
ndex.
html
<ht
ml>
<H1>
Thi
sisAl i
asbasedWebHost
ing
</H1>
</ht
ml>
(
saveandexi tthisfi
le)
(
d)Restar
tthewebserv erdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
e)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
f)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//ser
ver
9.exampl
e.com/
conf
ident
iali
n addr
essbarandcheckt
hedi
rect
ory
basedwebpagei
sdi
spl
ayedornot
.
(
g)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump ser
ver
9.exampl
e.com/
conf
ident
ial
(
accesst
hei
ndexpage)
16.Howt
oconf
igur
ethewebser
vert
odi
spl
ayt
heuserdef
inedhomepagenott
he
i
ndex.
htmlpage?
Nor
mal
l
yApachewi
l
llookt
hei
ndex.
htmlast
hehomepagebydef
aul
t.I
fthename
changedi
twi
l
ldi
spl
ayt
hehomepagewi
thoutconf
igur
ethatone.Fort
hatwecandot
he

Rat
nakar
Page190
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

abov
easf
oll
ows.
(
i)Got
oconf
igur
ati
onf
il
edi
rect
oryby #cd /
etc/
htt
pd/
conf
.d command.
(
ii
)Cr
eat
eauser
pageconf
igur
ati
onf
il
e.
#v
im user
page.
conf
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
n r
oot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com
Document
Root /
var
/www/
html
Di
rect
ory
Index user
page.
html
</
Vir
tual
Host
>

<Di
rect
ory "
/var
/www/
html
">
Al
l
owOv
err
idenone
Requi
re Al
lGr
ant
ed
</
Dir
ect
ory
> (
sav
e
andexi
tthi
sfi
l
e)
(
ii
i) Got
odocumentr
ootdi
rect
oryby #cd /
var
/www/
html command.
(
iv)#v
im user
page.
html
<ht
ml>
<H1>
Thi
sisuser
pageashomepagewebhost
ing
</H1>
</ht
ml>
(
saveandexi tthi
sfi
le)
(
d)Restar
tthewebser
v erdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
e)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad

Rat
nakar
Page191
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
f)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//ser
ver
9.exampl
e.com i
naddr
essbar andcheckt
heuserdef
inedwebpage
i
sdi
spl
ayedornot
.
(
g)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump ser
ver
9.exampl
e.com (
access
t
hei
ndexpage)
17.Howt
oconf
igur
eCGIbasedwebhost
ing?
CGIcont
entwi
l
lchangedy
nami
cal
l
yev
eryt
imet
hecl
i
entaccessedi
t.Nor
mal
web
ser
verwi
l
lnotbeusedt
osuppor
tthi
sty
peofwebhost
ing.Toaccesst
hesedy
nami
c
pages,wehav
etoconf
igur
ethewebser
veras"
.wsgi
"ser
ver
.Thef
oll
owi
ngst
epswi
l
l
conf
igur
etheCGIwebser
ver
.
(
a)I
nst
all
theCGIpackageby #y
um i
nst
allmod_
wsgi
* -
y command.
(
b)Downl
oadorcr
eat
etheCGIscr
iptf
il
einwebser
ver
'sdocumentr
ootdi
rect
ory
.
Exampl
e:#cp webapp.
wsgi /
var
/www/
html
(
c)Cr
eat
etheconf
igur
ati
onf
il
eforCGIbasedwebhost
ing.
<Vi
rt
ual
Host 172.
25.
9.11:
80>
Ser
ver
Admi
n r
oot
@ser
ver
9.exampl
e.com
Ser
ver
Name webapp9.
exampl
e.com
Document
Root /
var
/www/
html
WSGI
Scr
ipt
Ali
as / /
var
/www/
html
/webapp.
wsgi
</
Vir
tual
Host
>
(
d)Rest
artt
hewebser
verdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
e)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 80-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp

Rat
nakar
Page192
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
f)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tp:
//webapp9.
exampl
e.com i
n addr
essbar andcheckt
heCGIbasedweb
pagei
sdi
spl
ayedornot
.
(
g)Wecanal
soaccesst
hewebsi
teusi
ngel
inksCLIt
ool
.
#y
um i
nst
allel
i
nks* -
y (
inst
all
the
el
i
nkspackage)
#el
inks -
-dump webapp9.
exampl
e.com (
access
t
hei
ndexpage)
18.Whati
ssecur
edwebser
ver
?
Secur
edwebser
vermeansnor
malApachewebser
verwi
thSSLsuppor
t.I
nnor
mal
webser
vert
hedat
acommuni
cat
ioni
sdonei
npl
aint
extf
ormat
.So,t
her
eisnosecur
it
y
f
ordat
abecauseev
ery
onecanaccesst
hedat
a.I
fwewantt
opr
ovi
desecur
it
ytot
he
dat
a,t
henwehav
etoconf
igur
ethewebser
verwi
thSSLsuppor
t.
19.Whati
sthepr
ofi
leofsecur
edwebser
ver
?
Package : mod_
ssl
Conf
igur
ati
onf
il
e : /
etc/
htt
pd/
conf
.d/
ssl
.conf
Pr
ivat
ekeyl
ocat
ion : /
etc/
pki
/tl
s/pr
ivat
e
Publ
i
ckeyl
ocat
ion : /
etc/
pki
/tl
s/cer
ts
Aut
hent
icat
ioncer
ti
fi
cat
e : /
etc/
pki
/tl
s/cer
ts
Por
tnumber : 443
* Pr
ivat
ekeyext
ent
ioni
s ".key" and publ
i
ckeyext
ent
ioni
s ".cr
t"
20.Howt
oconf
igur
ethesecur
edwebser
ver
?
(
a)I
nst
allt
hewebser
verandsecur
eshel
lpackages.
#y
um i
nst
allht
tpd* mod_
ssl
* -
y command.
(
b)Downl
oadt
hepr
ivat
ekeyandpubl
i
ccer
ti
fi
cat
es.
#cd /
etc/
pki
/tl
s/pr
ivat
e
#wgetht
tp:
//cl
assr
oom.
exampl
e.com/
pub/
tls/
pri
vat
e/ser
ver
<no.
>.key
#cd /
etc/
pki
/tl
s/cer
ts
#wgetht
tp:
//cl
assr
oom.
exampl
e.com/
pub/
tls/
cer
ts/
ser
ver
<no.
>.cr
t
#wgetht
tp:
//cl
assr
oom.
exampl
e.com/
pub/
exampl
e-ca.
crt
(
c)Cr
eat
etheconf
igur
ati
onf
il
eforsecur
edwebser
ver
.
#v
im/
etc/
htt
pd/
conf
.d/
htt
ps.
conf
<Vi
rt
ual
Host 172.
25.
9.11:
443>
Ser
ver
Admi
n r
oot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com
Document
Root /
var
/www/
html
</
Vir
tual
Host
>
(
d)Wehav
etocopy7l
i
nesf
rom ssl
.conff
il
etoht
tps.
conff
il
e.
#v
im -
O ssl
.conf ht
tps.
conf

Rat
nakar
Page193
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Copyt
hel
i
nenumber
s 70,75,80,93,100,107,116copy andpast
ethem i
n
ht
tps.
conf f
il
e.
So,af
tercopi
edt
hosel
i
net
heht
tps.
conff
il
eshoul
dbeasbel
ow.
<Vi
rt
ual
Host 172.
25.
9.11:
443>
Ser
ver
Admi
n r
oot
@ser
ver
9.exampl
e.com
Ser
ver
Name ser
ver
9.exampl
e.com
SSLEngi
neon
SSLPr
otocol
all
-SSLv
2-SSLv
3
SSLCi
pher
Sui
teALL:
!ADH:
!EXPORT:
!SSLv
2:RC4+RSA:
+HI
GH:
+MEDI
UM:
+LOW
SSLCer
ti
fi
cat
eFi
l
e/et
c/pki
/t
ls/
cer
ts/
ser
ver
9.cr
t
SSLCer
ti
fi
cat
eKey
Fil
e/et
c/pki
/t
ls/
pri
vat
e/ser
ver
9.key
#SSLCer
ti
fi
cat
eChai
nFi
l
e/et
c/pki
/t
ls/
cer
ts/
exampl
e-ca.
crt
Document
Root /
var
/www/
html
</
Vir
tual
Host
>
<Di
rect
ory "
/var
/www/
html
">
Al
l
owOv
err
ide
Requi
re Al
lGr
ant
ed
</
Dir
ect
ory
> (
sav
e
andexi
tthi
sfi
l
e)
(
e)Got
odocumentr
ootdi
rect
oryby #cd /
var
/www/
html command.
(
f)#v
im i
ndex.
html
<ht
ml>
<H1>
Thi
sisasecur
edwebhost
ing
</H1>
</ht
ml>
(
saveandexi tthi
sfi
le)
(
g)Restar
tthewebser
v erdeamon.
#ser
viceht
tpdst
art (
tost
artt
hewebser
ver
deamoni
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheser
vice
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tost
artt
hewebser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheser
viceatnext
booti
nRHEL-7)
(
h)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 443-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 443-
j ACCEPT
#ser
vicei
ptabl
essav
e

Rat
nakar
Page194
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=ht
tps
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
i)Got
ocl
i
entsy
stem,opent
hef
ir
efoxbr
owserandt
ypeas
ht
tps:
//ser
ver
9.exampl
e.com/ i
n addr
essbar andcheckt
hesecur
edweb
pagei
sdi
spl
ayedornot
.
21.Howt
ogener
ateourownpr
ivat
eandpubl
i
ckey
susi
ngcr
ypt
o-ut
il
spackage?
(
i)I
nst
all
thepackageby #y
um i
nst
allcr
ypt
o-ut
il
s* -
y command.
(
ii
)Cr
eat
eourownpubl
i
candpr
ivat
ekey
sby #genkey <host
nameoft
heser
ver
>
command.
Exampl
e:#genkey ser
ver
9.exampl
e.com (
onewi
ndowwi
l
lbeopenedandwe
hav
etoent
ert
hedet
ail
s)
Cl
i
ckonNex
t--
-> Don'
tchanget
hedef
aul
tsi
ze-
--
>Next-
--
>No-
--
>The
key
sar
egener
atedi
n
t
hei
rdi
rect
ori
es.
Ot
herusef
ulcommands:
#ht
tpd -
t (
tocheckt
hewebser
ver
conf
igur
ati
onf
il
eforsy
ntaxer
ror
s)

21.Mai
lSer
ver

1. Whati
smai
lser
ver
?
Amai
lser
ver(
somet
imesal
sor
efer
redt
oane-
mai
lser
ver
)isaser
vert
hathandl
esand
del
i
ver
se-
mai
lov
eranet
wor
k,usual
l
yov
ert
heI
nter
net
.Amai
lser
vercanr
ecei
vee-
mai
l
sfr
om cl
i
entcomput
ersanddel
i
vert
hem t
oot
hermai
lser
ver
s.Amai
lser
vercan
al
sodel
i
vere-
mai
l
stocl
i
entcomput
ers.Acl
i
entcomput
eri
snor
mal
l
ythecomput
er
wher
eyour
eady
oure-
mai
l
s,f
orexampl
eyourcomput
erathomeori
nyourof
fi
ce.Al
so
anadv
ancedmobi
l
ephoneorSmar
tphone,
wit
he-
mai
lcapabi
l
iti
es,
canber
egar
dedasa
cl
i
entcomput
eri
ntheseci
rcumst
ances.
2. Howmanyt
ypesofmai
lser
ver
sav
ail
abl
einLi
nux?
Ther
ear
etwot
ypesofmai
lser
ver
s.
(
i)Sendmai
lser
ver(
def
aul
tinRHEL-5,av
ail
abl
ein6and7)
(
ii
)Post
fi
x(def
aul
tinRHEL-6and7)
Thesebot
hmai
lser
verar
eusedt
osendandr
ecei
vet
hemai
l
s,butwecannotused
bot
hmai
lser
ver
satat
imei
e.,
wehav
etouseonl
yoneser
veratat
ime.Thesemai
l
ser
ver
sar
eusedasCLImode.Out
lookexpr
essi
nwi
ndowsi
susedt
osendorr
ecei
ve

Rat
nakar
Page195
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
hemai
l
s.Thunder
bir
disusedt
osendorr
ecei
vet
hemai
l
susi
ngGUImodei
nLi
nux.
#mai
list
hecommandusedt
osendt
hemai
l
sinCLImode.
3. Whatar
eMUA,MTA,SMTP,MDA andMRAs?
MUA:
MUA st
andsf
orMai
lUserAgent
.Iti
sthee-
mai
lcl
i
entwhi
chweusedt
ocr
eat
e-dr
aft
-
sendemai
l
s.Gener
all
yMi
crosof
tOut
look,Thunder
bir
d,kmai
l
,..
..
etc.
,ar
ethe
exampl
esf
orMUAs.
MTA:
MTA st
andsf
orMai
lTr
ansf
erAgent
.Iti
susedt
otr
ansf
ert
hemessagesandmai
l
s
bet
weensender
sandr
eci
pient
s.Ex
change,Qmai
l
,Sendmai
l
,Post
fi
x,.
..
.et
c.,ar
ethe
exampl
esf
orMTAs.
SMTP:
SMTP st
andsf
orSi
mpl
eMai
lTr
ansf
erPr
otocol
.Iti
susedt
otr
ansf
ert
hemessages
andmai
l
sbet
weent
heMTAs.
MDA:
MDA st
andsf
orMai
lDel
i
ver
yAgent
.Iti
sacomput
er 
sof
twar
e componentt
hati
s
r
esponsi
blef
ort
hedel
i
ver
yof
 e-
mai
l
 messagest
oal
ocal
reci
pient
'smai
l
box
.Wi
thi
nthe
I
nter
netmai
lar
chi
tect
ure,
local
messagedel
i
ver
yisachi
evedt
hroughapr
ocessof
handl
i
ngmessagesf
rom t
hemessaget
ransf
eragent
,andst
ori
ngmai
li
ntot
he
r
eci
pient
'senv
ironment(
typi
cal
l
ya 
mai
l
box
).
MRA:
MRA st
andsf
orMai
lRet
ri
evalAgent
.Iti
sa 
comput
er 
appl
i
cat
ion 
thatr
etr
iev
esor
f
etches 
e-mai
l
 fr
om ar
emot
emai
lser
verandwor
kswi
tha 
mai
ldel
i
ver
yagent
 t
odel
i
ver
mai
ltoal
ocal
orr
emot
e emai
lmai
l
box
.MRAsmaybeext
ernal
appl
i
cat
ionsby
t
hemsel
vesorbebui
l
tint
oabi
ggerappl
i
cat
ionl
i
keanMUA.Si
gni
fi
cantex
ampl
esof
st
andal
oneMRAsi
ncl
ude 
fet
chmai
l

get
mai
l
 and 
ret
chmai
l
.
4. Whati
sthepr
ofi
l
eofmai
lser
ver
?
Package : sendmai
l(i
nRHEL-5,
6and7)orpost
fi
x(i
nRHEL
-6and7)
.
Conf
igur
ati
onf
il
e : /
etc/
post
fi
x/mai
n.cf
,
/
etc/
dov
ecot
/dov
ecot
.conf
Logf
il
e : /
var
/log/
mai
l
.log
User
'smai
l
slocat
ion : /
var
/spool
/mai
l/
<username>
r
ootuser
'smai
llocat
ion : /
var
/spool
/mai
l/
root
Deamons : post
fi
x
Por
tnumber : 25
5. Howt
oconf
igur
ethemai
lser
ver
?
Thepr
e-r
equi
sit
eformai
lser
veri
sDNS.i
e.,Domai
nNami
ngSy
stem shoul
dbe
conf
igur
edf
ir
st.
(
i)Checkt
hehost
nameoft
heser
verby #host
name command.

Rat
nakar
Page196
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
ii
)Inst
all
themai
lser
verpackageby #y
um i
nst
allpost
fi
x* dov
ecot
*-y command.
(
ii
i) Opent
hemai
lconf
igur
ati
onf
il
eandatl
astt
ypeasbel
ow.
#v
im /
etc/
post
fi
x/mai
n.cf
my
host
name=ser
ver
9.exampl
e.com
my
domai
n=exampl
e.com
my
ori
gin=$my
domai
n
i
net
_int
erf
aces=$my
host
name,l
ocal
host
my
dest
inat
ion=$my
host
name,l
ocal
host
.$l
ocal
domai
n,l
ocal
host
,$my
domai
n
home_
mai
l
box=Mai
l
dir/ (
sav
eand
exi
tthi
sfi
l
e)
(
iv)Opent
heanot
herconf
igur
ati
onf
il
eandatl
astt
ypeasbel
ow.
#v
im /
etc/
dov
ecot
/dov
ecot
.conf
pr
otocol
s=i
map pop3 l
mtp
(
sav
eandexi
tthi
sfi
l
e)
(
v)Rest
artt
hemai
lser
verser
vices.
#ser
vicepost
fi
xrest
art (
tor
est
artt
hepost
fi
x
deamoni
nRHEL-6)
#ser
vicedov
ecotr
est
art (
tor
est
artt
hedov
ecot
deamoni
nRHEL-6)
#chkconf
igpost
fi
xon (
toenabl
ethepost
fi
xdeamonat
nextbooti
nRHEL-6)
#chkconf
igdov
ecoton (
toenabl
ethedov
ecotdeamonatnext
booti
nRHEL-6)
#sy
stemct
lrest
artpost
fi
x dov
eco0t (
tor
est
artt
hepost
fi
xand
dov
ecotdeamonsi
nRHEL-6)
#sy
stemct
lenabl
epost
fi
x dov
ecot (
toenabl
ethedeamons
atnextbooti
nRHEL-6)
(
vi)Addt
heser
vicet
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es -
A I
NPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 25-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 25-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
por
t=25/
tcp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
(
vii
)Sendat
estmai
ltot
heuser
.
#mai
l-st
est
mai
lraj
u
Hit
hisi
sat
estmai
l
okby
e..
.by
e..
.. (
exi
tandsendt
he

Rat
nakar
Page197
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

mai
lbyCt
rl+d)
(
vii
i
)Logi
nasr
ajuuserandcheckt
hemai
l
.
#su-r
aju
$l
s
$cdMai
l
dir
$l
s
$cdnew
$cat<mai
lname>
6. Howt
oconf
igur
emai
lser
verasnul
lcl
i
enti
nRHEL-7?
(
i)Opent
heconf
igur
ati
onf
il
eandatl
astt
ypeasbel
ow.
#v
im /
etc/
post
fi
x/mai
n.cf
r
elay
host=[
cli
ent
9.exampl
e.com]
i
net
_int
erf
aces=l
oopback-
onl
y
my
net
wor
ks=127.
0.0.
0/8 [:
:1]
/128
my
ori
gin=ser
ver
9.exampl
e.com
my
dest
inat
ion=
l
ocal
_tr
anspor
t=er
ror:l
ocaldel
i
ver
ydi
sabl
ed (
sav
eand
exi
tthi
sfi
l
e)
(
ii
)Rest
artt
hepost
fi
xdeamons.
#sy
stemct
lrest
artpost
fi
x
#sy
stemct
lenabl
epost
fi
x
(
ii
i)Addt
hepost
fi
xser
vicet
oFi
rewal
l
.
#f
ir
ewal
l-
cmd -
-per
manent -
-add-
por
t=25/
tcp
#f
ir
ewal
l-
cmd -
-compl
ete-
rel
oad
(
iv)Sendat
estmai
ltot
heuser
.
#mai
l-st
est
mai
lraj
u or #mut
t-st
est
mai
lraj
u
Hit
hisi
sat
estmai
l
okby
e..
.by
e..
.. (
exi
tandsendt
he
mai
lbyCt
rl+d)
(
v)Logi
nasr
ajuuserandcheckt
hemai
l
.
#su-r
aju
$l
s
$cdMai
l
dir
$l
s
$cdnew
$cat<mai
lname>
Ot
herusef
ulcommands:
* Tosendamai
ltot
hel
ocal
syst
em,noneedt
oconf
igur
ethemai
lser
ver
.
* Tosendamai
ltot
her
emot
esy
stem,t
henonl
ywehav
etoconf
igur
ethemai
lser
ver
.
#mai
lraj
u@ser
ver
9.exampl
e.com (
tosendt
hemai
ltot
he

Rat
nakar
Page198
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
ajuuseroft
heser
ver
9)
t
ypet
hemessagewhat
every
ouwant (
pressCt
rl+dt
oexi
tandsend
t
hemai
l
)
#su -r
aju (
toswi
tcht
other
ajuuser
)
$mai
l (
tocheckt
hemai
l
soft
her
aju
user
)
N abcd
N ef
gh
N i
j
kl
N mnop (
ther
ear
efourmai
l
sin
t
hemai
lbox)
&1 (
tor
eadt
he1stmai
l
)
*I
fthemai
li
snewonet
hen'
N'l
ett
eri
sappear
sbef
oret
hemai
l
.Ifi
tisal
ready
seent
hent
her
eisno l
ett
erbef
oret
hemai
l
.
* pr
ess '
q't
oqui
tthemai
lut
il
it
y.
#mai
lormut
t-s "hel
l
o"<username1><username2><username3>
t
ypet
hemat
terwhat
every
ouwant (
pressCt
rl+dt
oexi
tandsend
t
hemai
lto3user
s)
$mai
l (
toseeal
lthemai
li
nthemai
l
box)
&<t
ypet
hemai
lnumber
> (
tor
eadt
hespeci
fi
edmai
lbyi
t'
s
number
)
&r (
tosendt
her
epl
aymai
ltot
hat
user
)
&p (
tosendt
hemai
ltot
hepr
int
er
f
orpr
int
ing)
&w (
towr
it
ethecont
ent
soft
hemai
li
ntoaf
il
e,i
e.,
sav
ethecont
ent
sof
t
hemai
li
naf
il
e)
&q (
toqui
tthemai
lbox)
&d (
todel
etet
hemai
l
)
& d<mai
lnumber
> (
todel
etet
hespeci
fi
edmai
lby
i
t'
snumber
)
& d1-
20 (
todel
etet
hemai
l
sfr
om 1t
o20
number
s)
#mai
l-s"
hel
l
o"<username>@<ser
ver
name>.<domai
nname> (
tosendt
he
mai
ltot
her
emot
esy
stem)
#mai
l
q (
toseet
hemai
l
sint
hequeue)
*I
fthemai
lser
veri
snotconf
igur
edornotr
unni
ng,t
hent
hesentmai
l
swi
l
lbei
nthe
queue.
#mai
l-s"
hel
l
o"<username1><username2><<Fi
l
ename> (
sendt
hemai
l

Rat
nakar
Page199
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

wi
that
tachedf
il
eto
t
he2user
s)
#post
fi
xcheck (
tov
eri
fyt
hemai
lconf
igur
ati
onf
il
e
f
orsy
ntaxer
ror
s)

22.i
SCSI(
Remot
eSt
orage)

1. Whati
sst
orage?
Thememor
ywher
ewecanst
oret
hedat
a,suchasf
il
es,di
rect
ori
es,
..
.et
c.,i
scal
l
edt
he
st
orage.St
oragei
smai
nlyt
wot
ypes.(
i)Localst
orage and (
ii
)Remot
eSt
orage.
(
i)Localst
orage:

Rat
nakar
Page200
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Localst
oragei
sast
oragewhi
chi
sdi
rect
lyconnect
edt
ooursy
stem andr
eadyt
o
use.
Exampl
e:Local
har
ddi
sk,l
ocal
pendr
ive,DAS(
Dir
ectAccessSt
orage).
..et
c.,
(
ii
)Remot
est
orage:
Thest
oragewhi
chi
snotconnect
edt
ooursy
stem di
rect
lybutal
l
ott
edsomespacet
o
oursy
stem i
nremot
e l
ocat
ioni
scal
l
edr
emot
est
orage.
Exampl
e:i
SCSI(
Int
ernetSmal
lComput
erSy
stem I
nter
face)
,SAN(
Stor
ageAr
ea
Net
wor
k),NAS(
Net
wor
k Ar
eaSt
orage)
2. Whati
siSCSIandexpl
aini
t?
i
SCSIi
sawayofconnect
ingst
oragedev
icesov
eranet
wor
kusi
ngTCP/
IP.I
tcanbe
usedov
eral
ocal
area net
wor
k(LAN)
,awi
dear
eanet
wor
k(WAN)
,ort
heI
nter
net
.
i
SCSIdev
icesar
edi
sks,
tapes,
CDs,
andot
herst
oragedev
icesonanot
hernet
wor
ked
comput
ert
haty
oucan connectt
o.Somet
imest
hesest
oragedev
icesar
epar
tofa
net
wor
kcal
l
eda 
Stor
ageAr
eaNet
wor
k (
SAN)
.
I
nther
elat
ionshi
pbet
weenourcomput
erandt
hest
oragedev
ice,ourcomput
eri
s
cal
l
edan 
i
nit
iat
or 
because i
tini
ti
atest
heconnect
iont
othedev
ice,
whi
chi
scal
l
eda 
tar
get
.
i
SCSIpr
ovi
desRemot
eBl
ockorFi
l
eSt
orage.Mostdat
acent
erskeept
hei
rst
oragei
n
cent
ral
i
sedSAN r
acks. i
SCSIpr
ovi
desani
nexpensi
veal
ter
nat
ivet
opr
opr
iet
ary
SAN har
dwar
e.
3. Whati
sthet
ermi
nol
ogyofi
SCSI
?
i
SCSIsuppor
tssendi
ngSCSIcommandsf
rom cl
i
ent
s(i
nit
iat
ors)ov
erI
PtoSCSI
st
oragedev
ices(
tar
get
s)on r
emot
esy
stems(
ser
ver
s).i
qni
sai
SCSIqual
i
fied
nameornumber
.
Thef
ormatofi
qni
s"i
qn.
yyy
y-mm.
<domai
nnamei
nrev
erseor
der
>label
isusedt
o
i
dent
if
yini
ti
ator
sand t
arget
scommuni
cat
ethr
oughpor
tnumber3260.
4. Whati
sthepr
ofi
leofi
SCSI
?
Package : i
scsi
*(f
orRHEL-
6),t
arget
*(f
orRHEL-
7ser
ver
)andi
scsi
-
ut
il
s*(
forRHEL-
7Cl
i
ent
)
Conf
igur
ati
onf
il
es : /
etc/
tgt
/tar
get
.conf(
forRHEL-6)and
/
etc/
tar
get
/sav
econf
ig.
json(
forRHEL-7)
Deamons : t
gtd(
forRHEL-
6)andt
arget(
forRHEL-
7ser
ver
)andi
scsi
,
i
scsi
d(f
orRHEL-
7)
Por
tnumber : 3260
5. Howt
oconf
igur
ethei
SCSIser
ver
?
(
i)Cr
eat
eonepar
ti
ti
onandcr
eat
etheLVM wi
tht
hatpar
ti
ti
on.
#f
disk <dev
icename>
:n(
new par
ti
ti
on)-
--
>Ent
er-
--
>Ent
er-
--
>Ent
er-
--
>+<si
zei
nMB/
GB/
TB> -
--
>
w(
wri
tet
he changesi
ntot
hedi
sk)
#par
tpr
obe (
towr
it
ethechangesi
nto
t
hepar
ti
ti
ont
abl
e)

Rat
nakar
Page201
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#pv
creat
e <di
skpar
ti
ti
onname> (
tocr
eat
ethephy
sical
v
olume)
#v
gcr
eat
e <phy
sicalv
olumename> (
tocr
eat
ethe
v
olumegr
oup)
#l
vcr
eat
e-s <ext
entsi
ze> -
n <l
ogi
calv
olumename><v
gname> (
tocr
eat
e
t
hel
ogi
calv
olume)
(
ii
)Inst
all
thei
SCSIpackageby #y
um i
nst
allscsi
-t
arget
-ut
il
s-y commandi
n
RHEL-6or
I
nst
all
thei
SCSIpackageby #y
um i
nst
allt
arget
*-y commandi
nRHEL-7.
(
ii
i)St
artt
hei
SCSIdeamonandenabl
ethedeamonatnex
tboott
ime.
#ser
vicet
gtdr
est
art (
tost
artt
hei
SCSI
deamoni
nRHEL-6)
#chkconf
igt
gtdon (
toenabl
ethei
SCSIdeamonatnext
booti
nRHEL-6)
#sy
stemct
lst
artt
arget (
tost
artt
het
arget
deamoni
nRHEL-7)
#sy
stemct
lenabl
etar
get (
toenabl
ethet
argetdeamonatnex
t
booti
nRHEL-7)
(
iv)Conf
igur
ethei
SCSIst
orage.
I
nRHEL-6:
#v i/etc/t
gt/target
s.conf
default-dri
veriscsi
<targetiqn.2015-06.com.
example:
ser
ver
9.t
arget
1>
 
  backi ng-store <i
SCSIparti
ti
onname>
 
  wr it
e-cacheof f
</target>
InRHEL-7:
#t
arget
cli (
togett
heconf
igur
ati
onwi
ndow anddi
spl
ays"
/>"
pr
omptappear
s)
/
>ls (
toseet
heconf
igur
ati
on
cont
ent
s)
/
>/backst
ores/
block cr
eat
e <bl
ockst
oragename><t
heabov
ecr
eat
edv
olume
name> (
creat
ethe
bl
ockst
orage)
/
>/i
scsicr
eat
eiqn.
2015-
06.
com.
exampl
e:ser
ver
9 (
tocr
eat
ethel
un
numbernott
hel
unname)
/
>/i
scsi
/i
qn.
2015-
06.
com.
exampl
e:ser
ver
9/t
pg1/
acl
s cr
eat
eiqn.
2015-
06.
com.
exampl
e:ser
ver
9
(
tocr
eat
etheal
i
asnamef
orcl
i
entsi
del
unnumber
)
/
>/i
scsi
/i
qn.
2015-
06.
com.
exampl
e:ser
ver
9/t
pg1/
luns cr
eat
e

Rat
nakar
Page202
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

/
backst
ores/
block/
<bl
ockst
oragename>
(
tocr
eat
ethel
unusi
ngt
hebl
ock
st
oragedev
ice)
/
>/i
scsi
/i
qn.
2015-
06.
com.
exampl
e:ser
ver
9/t
pg1/
por
tal
s cr
eat
e <I
Paddr
essoft
he
ser
ver
>
(
toal
l
ott
heabov
ecr
eat
edl
unt
otheI
Paddr
essandpor
t
number
,ie.
,3260)
/
>sav
econf
ig (
tosav
ethei
SCSIconf
igur
ati
oni
ntot
he
conf
igur
ati
onf
il
e)
/
>exi
t (
toex
itf
rom t
he
conf
igur
ati
onwi
ndow)
(
v)Rest
artt
hei
SCSIdeamonsaf
tert
heconf
igur
ati
onofi
SCSIort
arget
.
#ser
vicet
gtdr
est
art (
tost
artt
hei
SCSI
deamoni
nRHEL-6)
#chkconf
igt
gtdon (
toenabl
ethei
SCSIdeamonatnext
booti
nRHEL-6)
#sy
stemct
lrest
artt
arget (
tost
artt
het
arget
deamoni
nRHEL-7)
#sy
stemct
lenabl
etar
get (
toenabl
ethet
argetdeamonatnex
t
booti
nRHEL-7)
(
vi)#t
gt-
admi
n--
show (
tocheckt
hei
SCSIconf
igur
ati
oni
n
RHEL-6)
(
vii
)Addt
hei
SCSIser
viceandpor
tnumbert
otheI
Ptabl
esandf
ir
ewal
l
.
I
nRHEL-6:
#i
ptabl
es-
IINPUT-
ptcp-
mtcp-
-dpor
t3260-
jACCEPT
#i
ptabl
es-
O OUTPUT -
ptcp-
mtcp-
-dpor
t3260-
jACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
por
t=3260/
tcp
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad
6. Howt
oconf
igur
ethei
SCSIcl
ient
?
(
i)I
nst
all
 i
scsi
-i
nit
iat
or-
uti
l
spackageont
hecl
i
entby#y
um i
nst
all
iscsi
-i
nit
iat
or-
uti
ls*-
ycommandi
nRHEL-
6.
I
nst
all
thei
SCSIpackagesby #y
um i
nst
alli
scsi
-ut
il
s* -
y commandi
nRHEL-7.
(
ii
)Di
scov
ert
het
argetLUN’
sexpor
tedbyser
verusi
ngf
oll
owi
ngcommand.I
twi
l
l
pr
ovi
dei
qnnamewi
thofLUN associ
atedwi
thgi
veni
paddr
ess.
#i
scsi
adm -
m di
scov
ery-
tsendt
arget
s-p<I
Paddr
essoft
heser
ver
>
(
inRHEL-6)
#i
scsi
adm -
-mode di
scov
ery
db -
-t
ype sendt
arget
s--
por
tal
s <I
Paddr
essof

Rat
nakar
Page203
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
heser
ver
) (
inRHEL-7)
(
ii
i)Opent
hei
scsii
nit
iat
orf
il
eandputanent
ryoft
heabov
edi
scov
eredl
unnumber
i
nRHEL-7onl
y.
#v
im /
etc/
iscsi
/i
nit
iat
orname.
iscsi (
got
o
l
astl
i
neandt
ypeasbel
ow)
I
nit
iat
orname=i
qn.
2015-
06.
com.
exampl
e:ser
ver
9 (
sav
e
andexi
tthi
sfi
l
e)
(
iv)Rest
artandenabl
ethei
SCSIcl
i
entsi
dedeamons.
#ser
vicei
scsir
est
art (
tor
est
artt
hei
scsi
cl
i
entdeamoni
nRHEL-6)
#chkconf
igi
scsion (
toenabl
ethei
scsi
cli
entdeamonat
nextbooti
nRHEL-6)
#sy
stemct
lrest
arti
scsi
discsi (
tor
est
artt
hei
scsi
cl
i
entdeamonsi
nRHEL-7)
#sy
stemct
lenabl
eiscsi
discsi (
toenabl
ethei
scsi
cli
ent
deamonsatnextbooti
nRHEL-7)
(
v)Toconnecti
SCSIt
argetwecanusef
oll
owi
ngcommand,
weneedt
oment
ionser
ver
i
pandi
qnname.
I
nRHEL-6:
#i
scsi
adm -
m node-
Tiqn.
2015-
06.
com.
exampl
e:ser
ver
9.t
arget
1–p<I
Paddr
essof
t
heser
ver
>logi
n
I
nRHEL-7:
#i
scsi
adm -
-mode node -
-t
arget
name i
qn.
2015-
06.
com.
exampl
e:ser
ver
9--
por
tal<I
Paddr
essoft
he
ser
ver
>:3260 -
-l
ogi
n
(
vi)Checkt
henewr
emot
edi
sknameby#f
disk -
l command.
(
vii
)Cr
eat
ether
equi
redsi
zepar
ti
ti
onusi
ng#f
disk,#par
tpr
obe commands.
(
vii
i
)Cr
eat
ether
equi
redt
ypeoff
il
esy
stemsby #mkf
s.ext
4 <abov
ecr
eat
ed
par
ti
ti
onname> command.
(
ix)Cr
eat
eamountpoi
ntf
ort
heabov
efi
l
esy
stem by#mkdi
r/mnt
/iscsi command.
(
x)Opent
he /
etc/
fst
ab f
il
eandputenent
ryoft
heabov
efi
l
esy
stem i
nfor
mat
ion.
#v
im /
etc/
fst
ab
<par
ti
ti
onname> or<UUI
D> /
mnt
/i
scsi ext
4 _
net
dev 0 0 (
sav
e
andexi
tthi
sfi
l
e)
(
xi)Mountt
heal
lthepar
ti
ti
onswhi
char
ehav
ingent
ri
esi
n/et
c/f
stabf
il
eby #mount
-
a command.
(
xii
)Checkal
lthemount
edf
il
esy
stemsby #df -
hT command.
(
xii
i
)Todi
sconnecti
SCSIt
argetwecanusef
oll
owi
ngcommands.Don'
tfor
get t
hat
l
ogoutf
rom t
het
arget
.
I
nRHEL-6:

Rat
nakar
Page204
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#i
scsi
adm -
m node-
Tiqn.
2015-
06.
com.
exampl
e:ser
ver
9.t
arget
1–p<I
Paddr
essof
t
heser
ver
>logout
I
nRHEL-7:
#i
scsi
adm -
-mode node -
-t
arget
name i
qn.
2015-
06.
com.
exampl
e:ser
ver
9--
por
tal<I
Paddr
essoft
he
ser
ver
>:3260 -
-l
ogout
(
xiv
)Rest
artt
hecl
i
entsy
stem by #i
nit6 command.
(
xv)Af
terr
ebootcheckt
her
emot
efi
l
esy
stem by #df -
hT command.

23.My
SQLSer
verorMar
iaDB

1. Whati
sMy
SQLorMar
iaDB?
My
SQLorMar
iaDB i
sadat
abasesof
twar
etocr
eat
eandmai
ntai
nthedat
abases.
Upt
oRHEL-6t
hedat
abasesof
twar
eisMy
SQLandf
rom RHEL-7onwar
dst
he
dat
abasesof
twar
eisMar
iaDB.
I
fwewantt
odoanyt
ransact
ionsordat
abaseoper
ati
ons,wehav
etoopent
hemy
sql
>ormar
iadb>pr
ompt
.
I
nMy
SQLorMar
iaDB al
lthedat
abaseoper
ati
oncommandswi
l
lendwi
tha";
"
(
semi
col
on)
.
2. Whati
sthepr
ofi
leofMy
SQLorMar
iaDB?
Package : my
sql
*(i
nRHEL-6) and mar
iadb*(
inRHEL-7)
Ver
sion : 5.
0(i
nRHEL-6)and5.
5(i
nRHEL-7)
Deamons : my
sql
d(i
nRHEL-6)andmar
iadb(
inRHEL-7)
Conf
igur
ati
onf
il
e : /
etc/
my.
cnf
I
nstal
l
ati
on
Commands : my
sql
_secur
e_i
nst
all
ati
on
3. Howt
oconf
igur
eMy
SQLorMar
iaDB?
(
i)I
nst
all
theMy
SQLorMar
iadbsof
twar
epackages.
#y
um gr
oupi
nst
allmy
sql
*-y (
to
i
nst
allMy
SQLi
nRHEL-6)
#y
um gr
oupi
nst
allmar
iadb* (
to
i
nst
allMar
iadbi
nRHEL-7)
(
ii
)Rest
artt
hemy
sql
dandmar
iadbdeamons.
#ser
vicemy
sql
drest
art (
tost
artt
hemy
sql
d

Rat
nakar
Page205
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

deamoni
nRHEL-6)
#chkconf
igmy
sql
don (
toenabl
ethemy
sql
ddeamonat
nextbooti
nRHEL-6)
#sy
stemct
lrest
artmar
iadb (
tost
artt
hemy
sql
d
deamoni
nRHEL-7)
#sy
stemct
lenabl
emar
iadb (
toenabl
ethemy
sql
ddeamonatnext
booti
nRHEL-7)
(
ii
i) Checkt
hemy
sqlpor
tisl
i
steni
ngornot
.
#net
stat-
ntul
p|gr
epmy
sql (
itwor
ksi
n
bot
hRHEL-6&7)
Wher
e n-
--
--
> net
wor
k t-
--
--
>tcppr
otocol u-
--
--
> udp
pr
otocol
l-
--
--
>li
steni
ngornotand p-
--
--
> por
tnumber
(
iv)I
fwewantt
oconf
igur
ethedat
abaseasl
ocal
hosti
e.,
dat
abasewi
l
lnotbeav
ail
abl
e
t
oremot
esy
stems.
#v
im /
etc/
my.
cnf (
opent
hisf
il
eandgot
o2ndl
i
ne,cr
eat
eanempt
yli
neand
t
ypeasbel
ow)
ski
p-net
wor
king=1 (
sav
eand
exi
tthi
sfi
l
e)
(
v)Rest
artt
hemy
sql
dandmar
iadbdeamons.
#ser
vicemy
sql
drest
art (
tost
artt
hemy
sql
d
deamoni
nRHEL-6)
#chkconf
igmy
sql
don (
toenabl
ethemy
sql
ddeamon
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artmar
iadb (
tost
artt
hemy
sql
d
deamoni
nRHEL-7)
#sy
stemct
lenabl
emar
iadb (
toenabl
ethemy
sql
ddeamonatnext
booti
nRHEL-7)
(
vi)I
nst
all
thedat
abaseengi
ne. (
itwor
ksi
n
bot
hRHEL-6&7)
#my
sql
_secur
e_i
nst
all
ati
on
Ent
ercur
rentr
ootpasswor
d: (
her
edonotent
eranypasswor
dsand
j
ustpr
esst
heEnt
erKey
)
Setr
ootpasswor
d[y
/n]:y
Remov
eanany
moususer
s[y
/n]:y
Di
sal
l
owr
ootl
ogi
nremot
ely[
y/n]:y
Remov
etestdat
abaseandaccesst
oit[
y/n]:y
Rel
oadt
hepr
ivi
l
agest
abl
esnow [
y/n]:y
(
vii
)Logi
nint
othemy
sql
ser
verasar
ootuser
.
#my
sql-
uroot-
p (
wher
eu-
--
--
> userand p -
--
--
>

Rat
nakar
Page206
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

usi
ngpasswor
d)
(
wehav
etoent
ert
hepasswor
dforr
ootuser
)
(
vii
i
)Seet
hedef
aul
tdat
abases.
my
sql
>show dat
abases; (
inRHEL-6)
mar
iadb>showdat
abases; (
inRHEL-7)
(
ix) Ex
itf
rom t
hedat
abaseby my
sql>exi
t;(
inRHEL-6)andmar
iadb>exi
t;
(
inRHEL-7)
4. Howt
ocr
eat
eadat
abase,cr
eat
etabl
es,ent
ert
hedat
aint
othet
abl
esandaccess
t
hatdat
a?
(
i)Logi
nint
othedat
abaseser
verby #my
sql-
uroot-
p command.
(
ii
)Cr
eat
ethedat
abaseandconnectt
hedat
abases.
my
sqlormar
iadb>cr
eat
edat
abase <dat
abasename>;
(
tocr
eat
ethedat
abase)
my
sqlormar
iadb>showdat
abases; (
toseeal
lthe
dat
abasesi
ntheser
ver
)
my
sqlormar
iadb>use <dat
abasename>; (
toconnect
t
othespeci
fi
eddat
abase)
(
ii
i)Cr
eat
eat
abl
e,ent
ert
hedat
aandquer
ythedat
a.
my
sqlormar
iadb>cr
eat
etabl
e <t
abl
ename> (
fi
eldname1 dat
aty
pe(
size)
,
f
iel
dname2 dat
aty
pe(
siz
e),
f
iel
dname3 dat
aty
pe(
siz
e))
;
Exampl
e:my
sqlormar
iadb>cr
eat
etabl
emy
det
ail
s(Name v
archar(
30)
,st
atus
v
archar(
10)
,
Addr
essv
archar(
50)
,phone
i
nt(
10)
);
(
iv)Seet
hest
ruct
ureoft
het
abl
e.
my
sqlormar
iadb>descr
ibe<t
abl
ename>; (
toseet
hest
ruct
ureof
t
het
abl
e)
Exampl
e:my
sqlormar
iadb>descr
ibe my
det
ail
s;
(
v)I
nser
torent
ert
hedat
aint
othet
abl
e.
my
sqlormar
iadb>i
nser
tint
omy
det
ail
sval
ues(
"Raj
u","
Singl
e",Hy
der
abad"
,
9848750755)
;
(
vi)Quer
ythet
abl
etogett
hedat
a.
my
sqlormar
iadb>sel
ect*f
rom my
det
ail
s; (
toseeal
l
t
her
ecor
dsoft
het
abl
es)
my
sqlormar
iadb>sel
ectname,phonef
rom my
det
ail
s;(
tosel
ectt
hewant
ed
dat
aie.
,fi
l
ter
ingt
hedat
a)
5. Howt
otakeabackupoft
hedat
abase,dr
opt
hedat
abaseandr
est
oret
hedat
abase
usi
ngbackup?
Tot
akeabackuporr
est
oreoft
hedat
abasef
ir
stweshoul
dcomeoutf
rom t
he

Rat
nakar
Page207
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

dat
abaseser
verandt
hent
akeabackuporr
est
oret
hebackup.
(
i)Exi
tthef
rom t
hedat
abaseser
ver
.
my
sqlormar
iadb>exi
t;
(
ii
)Takeabackupoft
hedat
abase.
#my
sql
dump -
uroot-
p <dat
abasename>><f
il
enamewi
thf
ull
pat
h>
Exampl
e:#my
sql
dump -
uroot-
p my
det
ail
s >/
root
/my
det
ail
s.bak
(
ii
i)Del
etet
hedat
abasef
rom t
hedat
abaseser
ver
.
my
sqlormar
iadb>dr
opdat
abase <dat
abasename>;
Exampl
e:my
sqlormar
iadb>dr
opdat
abase my
det
ail
s;
(
iv)Rest
oret
hedel
eteddat
abaseusi
ngt
hebackupcopy
.
my
sqlormar
iadb>exi
t;
#my
sql-
uroot-
p <dat
abasename><<backupf
il
enamewi
thpat
h>
Exampl
e:#my
sql-
uroot-
p my
det
ail
s < /
root
/my
det
ail
s.bak
6. Howt
ocr
eat
etheuseri
nthedat
abaseandmaket
heusert
odot
ransact
ionsor
oper
ati
ons?
(
i)Tocr
eat
etheuseri
nthedat
abasef
ir
stl
ogi
ntot
hedat
abaseandt
hencr
eat
ethe
user
.
my
sqlormar
iadb>cr
eat
euser<username>@<hostname> i
dent
if
iedby
"
<passwor
d>"
;
Exampl
e:my
sqlormar
iadb>cr
eat
euserr
aju@l
ocal
hostor
ser
ver
9.exampl
e.com i
dent
if
iedby
"
raj
u123"
;
(
ii
) Maket
heusert
odot
ransact
ionsont
hedat
abase.(
not
hingbutgr
ant
ing
t
heper
missi
on)
my
sqlormar
iadb>gr
antsel
ect
,inser
t,updat
e,del
eteon<dat
abasename>.
*
t
o <username>;or
my
sqlormar
iadb>gr
antal
lon <dat
abasename>.
*to<username>;
Exampl
e:my
sqlormar
iadb>gr
antsel
ect
,inser
t,updat
e,del
eteonmy
det
ail
s.*
t
oraj
u;or
my
sqlormar
iadb>gr
antal
lonmy
det
ail
s.*t
oraj
u;
(
wher
edat
abase.* meansgr
ant
ingper
missi
onsonal
lthecont
ent
sli
ket
abl
es,
i
ndexes,v
iews,
sy
nony
msandot
her
s)
7. Howt
oupdat
ethet
abl
eint
hedat
abasewi
thnewdat
a?
my
sqlormar
iadb>updat
e<t
abl
ename><f
iel
dname>=<new v
alue> wher
e
<pr
imar
ykeyf
iel
d
name>="
<val
ue>"
;
Exampl
e:my
sqlormar
iadb>updat
e my
det
ail
s name="
bangar
am"wher
e
name='
raj
u'
;
8. Howt
odel
etet
het
abl
efr
om t
hedat
abase?

Rat
nakar
Page208
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

my
sqlormar
iadb>dr
opt
abl
e<t
abl
ename>;
Exampl
e:my
sqlormar
iadb>dr
opt
abl
e my
det
ail
s;
9. Howt
oconnectt
her
emot
edat
abasef
rom oursy
stem?
#my
sql -
uroot-
h <hostname> -
p (
her
ewehav
e
t
oent
ert
hepasswor
d)
Exampl
e:#my
sql -
uroot-
h ser
ver
9.exampl
e.com -
p
(
Ift
hedat
abasei
sconf
igur
edasl
ocal
hostdat
abase,t
henser
verwi
l
lnotal
l
ow
r
emot
edat
abaseconnect
ionsand Per
missi
ondeni
ed messagewi
l
lbedi
spl
ayedon
t
hescr
een)
10.How t
oaddmy
sql
dser
vicet
oIPt
abl
esandmar
iadbser
vicet
ofi
rewal
l?
I
nRHEL-6:
#i
ptabl
es -
AINPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 3306-
j ACCEPT
#i
ptabl
es -
A OUTPUT -
iet
h0 -
ptcp -
m t
cp -
-depor
t 3306-
j ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
#chkconf
igi
ptabl
eson
I
nRHEL-7:
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
por
t=3306
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad

24.LogSer
verandLogFi
les

1. Whati
slogser
ver
?
Al
ogser
verr
epr
esent
sacent
ral
logmoni
tor
ingpoi
ntonanet
wor
k,t
owhi
chal
lki
ndsof
dev
icesi
ncl
udi
ngLi
nuxorWi
ndowsser
ver
s,r
out
ers,
swi
tchesoranyot
herhost
scan
sendt
hei
rlogsov
ernet
wor
k.Byset
ti
ngupal
ogser
ver
,youcanf
il
terandconsol
i
dat
e
l
ogsf
rom di
ff
erenthost
sanddev
icesi
ntoasi
ngl
elocat
ion,
sot
haty
oucanv
iewand
ar
chi
vei
mpor
tantl
ogmessagesmor
eeasi
l
y.
OnmostLi
nuxdi
str
ibut
ions,
 
rsy
slog 
i
sthest
andar
dsy
slogdaemont
hatcomespr
e-
i
nst
all
ed.Conf
igur
edi
nacl
i
ent
/ser
verar
chi
tect
ure,
 
rsy
slog 
canpl
aybot
hrol
es;
asa

Rat
nakar
Page209
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

sy
slogser
ver
 r
sysl
og 
cangat
herl
ogsf
rom ot
herdev
ices,
andasa 
sysl
og
cl
i
ent

rsy
slog 
cant
ransmi
tit
sint
ernal
logst
oar
emot
esy
slogser
ver
.
Whenl
ogsar
ecol
l
ect
edwi
thsy
slogmechani
sm,
thr
eei
mpor
tantt
hingsmustbet
aken
i
ntoconsi
der
ati
on:
 Faci
li
tyl
evel
:
 whatt
ypeofpr
ocessest
omoni
tor
 Sever
it
y(pr
ior
it
y)l
evel

whatt
ypeofl
ogmessagest
ocol
l
ect
 Dest
inat
ion:
 
wher
etosendorr
ecor
dlogmessages
2. Whati
sthepr
ofi
leofl
ogser
ver
?
Thi
sisal
socal
l
edasr
sysl
ogser
ver
.Ther
equi
rement
sar
egi
venbel
ow.
(
i)Package : r
sysl
og*
(
ii
)Deamon : r
sysl
og
(
ii
i) Por
tNo. : 514
(
iv) Conf
igur
ati
onf
il
e : /
etc/
rsy
slog.
conf
3. Howt
oconf
igur
ethel
ogser
ver
?
(
i)I
nst
allr
sysl
ogpackageby #y
um i
nst
allr
sysl
og* -
y command.
(
ii
)Opent
hel
ogser
verconf
igur
ati
onandf
il
eandedi
tasperr
equi
rement
s.
#v
im /
etc/
rsy
slog.
conf
Got
oli
neno.:15& 16anduncommentont
hosel
i
nes. (
sav
eand
exi
tthi
sfi
l
e)
(
ii
i) Rest
artt
hel
ogser
verdeamoni
nRHEL-6andRHEL-7.
#ser
vice r
sysl
og r
est
art (
tor
est
artt
hel
ogser
ver
deamoni
nRHEL-6)
#chkconf
igr
sysl
og on (
toenabl
ethel
ogser
verdeamonatnext
booti
nRHEL-6)
#sy
stemct
lrest
artr
sysl
og (
tor
est
artt
hel
ogser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
ersy
slog (
toenabl
ethel
ogser
verdeamonatnext
booti
nRHEL-7)
(
iv) Ver
if
ywhet
hert
hel
ogser
veri
sli
steni
ngornot
.
#net
stat-
ntul
p|gr
ep514
(
v)Addt
hel
ogser
verser
vicet
oIPt
abl
es.
#i
ptabl
es -
A I
NPUT -
ptcp -
m t
cp -
-depor
t514-
jACCEPT (
toaddt
he
i
ncomi
ngpor
tno.t
o
I
ptabl
esi
nRHEL-6)
#i
ptabl
es -
A I
NPUT -
p udp -
m udp -
-depor
t514-
jACCEPT (
toadd
t
hei
ncomi
ngpor
tno.t
o
I
ptabl
esi
nRHEL-6)
#i
ptabl
es -
A OUTPUT -
ptcp -
m t
cp -
-depor
t514-
jACCEPT (
toadd
t
heout
goi
ngpor
tno.t
o
I
ptabl
esi
nRHEL-6)

Rat
nakar
Page210
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#i
ptabl
es -
A OUTPUT -
p udp -
m udp -
-depor
t514-
jACCEPT (
toadd
t
heout
goi
ngpor
tno.t
o
I
ptabl
esi
nRHEL-6)
#f
ir
ewal
l-
cmd -
-per
manent -
add-
por
t=514/
tcp (
toaddt
he514t
cppor
t
no.t
othef
ir
ewal
l
)
#f
ir
ewal
l-
cmd -
-per
manent -
add-
por
t=514/
udp (
toaddt
he514udppor
t
no.t
othef
ir
ewal
l
)
#f
ir
ewal
l-
cmd -
-compl
ete-
rel
oad (
tor
eloadt
he
f
ir
ewal
lconf
igur
ati
on)
4. Howt
oconf
igur
ethecl
ientsy
stem t
osendl
ogmessagest
othel
ogser
ver
?
(
i)Opent
hel
ogser
verconf
igur
ati
onf
il
eby #v
im /
etc/
rsy
slog.
conf command.
(
ii
)Got
oli
neno.90andt
ypeasbel
ow.
*
.*@<l
ogser
verI
Paddr
ess>:514
Exampl
e: *
.*@172.
25.
9.11:
514 (
sav
eandexi
t
t
hisf
il
e)
(
ii
i) Rest
artt
hel
ogser
verdeamonsi
nRHEL-6andRHEL-7.
#ser
vice r
sysl
og r
est
art (
tor
est
artt
hel
ogser
ver
deamoni
nRHEL-6)
#chkconf
igr
sysl
og on (
toenabl
ethel
ogser
verdeamonatnext
booti
nRHEL-6)
#sy
stemct
lrest
artr
sysl
og (
tor
est
artt
hel
ogser
ver
deamoni
nRHEL-7)
#sy
stemct
lenabl
ersy
slog (
toenabl
ethel
ogser
verdeamonatnext
booti
nRHEL-7)
* Thenal
lthel
ogmessagesar
est
oredi
n/v
ar/
log/
secur
elocat
ion.
* Tomoni
toral
lthemessagesont
heser
verby#t
ail
f/v
ar/
log/
secur
e command.
* Opent
he /
etc/
rsy
slog.
conf f
il
eandt
ypeasbel
owt
ost
oreal
lthecl
i
ent
'sl
og
messagesi
nremot
elogser
veronl
y.
#v
im /
etc/
rsy
slog.
conf
*
.* /
var
/l
og/
secur
e
(
sav
eandex
itt
hisf
il
e)
* Thenr
est
artt
hel
ogser
verdeamonsi
nRHEL-6andRHEL-7.
#ser
vice r
sysl
og r
est
art (
tor
est
artt
hel
ogser
ver
deamoni
nRHEL-6)
#sy
stemct
lrest
artr
sysl
og (
tor
est
artt
hel
ogser
ver
deamoni
nRHEL-7)
5. Whati
slogf
il
e?
Logf
il
eisf
il
ethatcont
ainsmessagesaboutt
hatsy
stem,i
ncl
udi
ngt
heker
nel
,ser
vices
andappl
i
cat
ionsr
unni
ngoni
t,.
..
.et
c.,Ther
ear
edi
ff
erentl
ogf
il
esf
ordi
ff
erent
i
nfor
mat
ion.Thesef
il
esar
ever
yusef
ulwhent
ryi
ngt
otr
oubl
eshootapr
obl
em wi
th

Rat
nakar
Page211
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

sy
stems.
Al
mostal
ll
ogmessagesar
est
oredi
n/v
ar/
log di
rect
ory
.Onl
yrootusercanr
ead
t
hesel
ogmessages.Wecanusel
essormor
ecommandst
oreadt
hesel
ogf
il
es.The
messageswi
l
lbegener
atedonl
ywhenr
sysl
ogser
vicei
srunni
ng,ot
her
wiset
hel
og
messageswi
l
lnotbegener
ated.
Thedi
ff
erentt
ypesofl
ogf
il
esandt
hei
rlocat
ions:
/
var
/log/
messages -
--
--
> Sy
stem andgener
almessagesandDHCPl
ogmessages.
/
var
/log/
aut
hlog -
--
--
> Aut
hent
icat
ionl
ogmessages.
/
var
/log/
secur
e--
--
-> Secur
it
yandaut
hent
icat
ionanduserl
ogmessages.
/
var
/log/
mai
l
log -
--
--
> Mai
lser
verl
ogmessages.
/
var
/log/
cron -
--
--
> Cr
onj
obsl
ogmessages.
/
var
/log/
boot
.l
og -
--
--
> Al
lboot
ingl
ogmessages.
/
var
/log/
htt
pd -
--
--
> Al
lApachewebser
verl
ogmessages.
/
var
/log/
mysql
d.l
og -
--
--
> My
sqldat
abaseser
verl
ogmessages.
/
var
/log/
utmp or/
var
/log/
wtmp -
--
--
> Al
ltheuser
'sl
ogi
nmessages.
/
var
/log/
Qmai
l--
--
-> Qmai
llogmessages.
/
var
/log/
ker
nel
.l
og -
--
--
> Al
lker
nelr
elat
edl
ogmessages.
/
var
/log/
samba -
--
--
> Al
lsambaser
verl
ogmessages.
/
var
/log/
anakonda.
log -
--
--
> Li
nuxi
nst
all
ati
onl
ogmessages.
/
var
/log/
last
log -
--
--
> Recentl
ogi
ninf
ormat
ionf
oral
luser
s.
#l
ast
log (
toseet
hel
ogmessagesoft
he
abov
elogf
il
e)
/
var
/log/
yum.
log -
--
--
> Al
lpackagei
nst
all
ati
onl
ogmessagesgener
atedby#y
um or
#r
pm commands.
/
var
/log/
cups -
--
--
> Al
lpr
int
erandpr
int
ingr
elat
edl
ogmessages.
/
var
/log/
ntpst
at-
--
--
> Al
lnt
pser
verandser
vicesl
ogmessages.
/
var
/log/
spool
er-
--
--
> Mai
l
,pr
int
erandcr
onj
obsspool
i
ngmessages.
/
var
/log/
sssd -
--
--
> Sy
stem secur
it
yser
vicedeamonl
ogmessages.
/
var
/log/
audi
t.
log -
--
--
> SELi
nuxl
ogmessages.
#dmesg (
toseet
hebootl
ogmessages)
#t
ail
f or#t
ail-
f/v
ar/
log/
secur
e (
tocheckorwat
cht
hel
ogf
il
es
cont
inuousl
y)
#v
im /
etc/
rsy
slog.
conf (
wecanchanget
hel
ogmessages
def
aul
tdest
inat
ions)
* Whenev
erwechanget
hecont
ent
soft
he/
etc/
rsy
slog.
conff
il
e,t
henwehav
eto
r
est
artt
her
sysl
ogser
vice.
* Ther
ear
e7t
ypesofpr
ior
it
ymessages.Wecanchanget
hedef
aul
tdest
inat
ionof
t
hosel
ogf
il
es.Fort
hat
openr
sysl
ogser
verconf
igur
ati
onf
il
eandwehav
eent
ert
her
ulesasf
oll
ows.
#v
im /
etc/
rsy
slog.
conf

Rat
nakar
Page212
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

<pr
ior
it
yty
pe>.<pr
ior
it
yname> <new dest
inat
ionoft
hel
ogf
il
es> (
sav
eand
exi
tthi
sfi
l
e)
#l
ogger <t
ypeanyt
ext
> (
tosendt
hatt
exti
nto/
var
/log/
messagesf
il
es
andt
otestwhet
herl
oggi
ng
ser
vicei
srunni
ngornot
)
#l
ogr
otat
e (
tocr
eat
ethel
ogf
il
eswi
thdat
ewi
se)
* Gener
all
yinl
ogmessagest
hef
iel
dsar
e,
Dat
e& Ti
me:Fr
om whi
chsy
stem :commandnameorchange:Execut
ion
oft
hecommand
#y
um i
nst
allt
mpwat
ch -
y (
toi
nst
all
thet
mpwat
chpackaget
oexecut
ethebel
ow
command)
#t
mpwat
ch (
tomoni
tort
he/
tmp di
rect
ory
)
#l
ogwat
ch (
tomoni
tort
hel
ogmessages)
#y
um i
nst
allwat
ch -
y (
toi
nst
all
thewat
chpackaget
oexecut
ethebel
ow
command)
#wat
ch <command> (
towat
cht
hespeci
fi
edcommandr
esul
tscont
inuousl
y)
#mkdi
r mode=755 /
ram (
togi
vet
heper
missi
onst
othedi
rect
orywhi
l
e
cr
eat
ingt
hatdi
rect
ory
)
#j
our
nal
ctl (
itt
racksal
lthel
ogf
il
esbet
weent
wodi
ff
erentt
imi
ngs
andsav
ebydef
aul
t
i
n/r
un/
log l
ocat
ion)
*/
run/
logi
smount
edont
mpf
sfi
l
esy
stem i
e.,
ift
hesy
stem i
sreboot
edt
hewhol
e
i
nfor
mat
ioni
nthat
l
ocat
ionwi
l
lbedel
etedorer
ased.

Rat
nakar
Page213
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

25.Conf
igur
ingI
Ptabl
esandFi
rewal
l

1. Whatar
eIPt
abl
esorf
ir
ewal
ls?
I
Ptabl
esi
sacommand-
li
nef
ir
ewal
lut
il
it
ythatusespol
i
cychai
nst
oal
l
oworbl
ock
t
raf
fi
c.Whenaconnect
iont
ri
est
oest
abl
i
shi
tsel
fony
oursy
stem,
ipt
abl
esl
ooksf
ora
r
ulei
nit
sli
stt
omat
chi
tto.I
fitdoesn’
tfi
ndone,
itr
esor
tst
othedef
aul
tact
ion.I
Ptabl
es
al
mostal
way
scomespr
e-i
nst
all
edonanyLi
nuxdi
str
ibut
ion.
Wecanupdat
e/Rei
nst
allt
heI
Ptabl
espackageby #y
um i
nst
alli
ptabl
es* -
y
command.
2. Whatar
ethet
ypesoff
ir
ewal
ls?
Ther
ear
efourt
ypesoff
ir
ewal
l
s.
(
i)Packetf
ir
ewal
ls:
 I
twor
ksat
Phy
sical
,Dat
aLi
nkandNet
wor
kLay
ers.
 I
twor
ksf
astandef
fi
cient
ly.
 I
ttr
eat
seachpacketi
nisol
ati
on.
(
ii
)St
atef
ullf
ir
ewal
ls:
I
tident
if
iesapacket
sconnect
ionst
ate.
I
tmai
ntai
nspacket
shi
stor
yint
hest
atet
abl
es.
(
ii
i)Appl
icat
ionl
ayerf
ir
ewal
ls:
I
tinspect
sandf
il
terpacket
sonOSIl
ayerupt
oAppl
i
cat
ionLay
er.
I
tident
if
iesi
fpr
otocol
sar
ebei
ngmi
sused.
(
iv)Pr
oxi
esf
ir
ewal
l
s:
I
tact
sasani
nter
medi
ary
.
I
toper
atesatAppl
i
cat
ionLay
er.
I
twon'
tal
l
owdi
rectconnect
ions.
3. Whatar
ethet
abl
esmai
ntai
nedbyI
Ptabl
es?
Nor
mal
l
yIPt
abl
esmai
ntai
n3t
abl
es.
(
i)I
NPUT t
abl
e:
Thi
schai
nhandl
esal
lpacket
sthatar
eaddr
essedt
oyourser
verandal
sot
ocont
rol
t
hebehav
iourf
or i
ncomi
ngconnect
ions.Forexampl
e,i
fauserat
tempt
s
t
oSSHi
ntoy
ourPC/
ser
ver
,ipt
abl
eswi
l
lat
temptt
o mat
cht
heI
Paddr
essandpor
tto
ar
ulei
nthei
nputchai
n.
(
ii
)OUTPUT t
abl
e:
 
Thi
schai
ncont
ainsr
ulesf
ort
raf
fi
ccr
eat
edbyy
ourser
ver
.Thi
schai
nisusedf
or
out
goi
ngconnect
ions.For exampl
e,i
fyout
ryt
opi
nggoogl
e.com,
ipt
abl
eswi
l
l
checki
tsout
putchai
ntoseewhatt
her
ulesar
e r
egar
dingpi
ngand
googl
e.combef
oremaki
ngadeci
siont
oal
l
owordenyt
heconnect
ionat
tempt
.
(
ii
i) FORWARD t
abl
e:
Thi
schai
nisusedf
ori
ncomi
ngconnect
ionst
hatar
en’
tact
ual
l
ybei
ngdel
i
ver
ed

Rat
nakar
Page214
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

l
ocal
l
y.Thi
nkofar
out
er– dat
aisal
way
sbei
ngsentt
oitbutr
arel
yact
ual
l
y
dest
inedf
ort
her
out
eri
tsel
f;t
hedat
aisj
ustf
orwar
dedt
o i
tst
arget
.Unl
essy
ou’
re
doi
ngsomeki
ndofr
out
ing,
NATi
ng,
orsomet
hingel
seony
oursy
stem t
hatr
equi
res
f
orwar
ding,
youwon’
tev
enuset
hischai
n.Thi
schai
nisusedt
odeal
wit
htr
aff
icdest
ined
f
orot
herser
ver
sthatar
enotcr
eat
edony
ourser
ver
.Thi
schai
nisbasi
cal
l
yawayt
o
conf
igur
eyourser
vert
orout
erequest
sto ot
hermachi
nes.
4. Whatar
ethemeani
ngsofREJECT,DROP andACCEPT?
REJECT:
REJECT meansser
verr
ecei
vest
heFTP r
equestf
rom t
hespeci
fi
edI
Paddr
essand
r
eject
sthatr
equestand
al
sosendt
heacknowl
edgement
.
DROP:
DROP meansser
verr
ecei
vest
heFTPr
equest
sfr
om t
hespeci
fi
edI
Paddr
essand
dr
opt
her
equestwi
thoutsendi
nganyacknowl
edgement
.
ACCEPT:
ACCEPT meansser
verr
ecei
vest
heFTP r
equest
sfr
om t
hespeci
fi
edI
Paddr
essand
al
l
owt
hatsy
stem f
orFTP ser
vices.
5. Whati
stheconf
igur
ati
onf
il
eofI
Ptabl
esandwhatar
etheopt
ionsav
ail
abl
einI
P
t
abl
escommand?
/
etc/
sysconf
ig/
ipt
abl
es i
stheconf
igur
ati
onf
il
eofI
Ptabl
es.
#i
ptabl
es <opt
ions><chai
n> f
ir
ewal
l
-rul
e (
to
execut
etheI
Ptabl
es)
Theopt
ionsar
easf
oll
ows.
-
A--
--
-> Addorappendt
her
ule.
-
p--
--
->I
ndi
cat
est
hepr
otocolf
ort
hatr
ule(
tcp,udp,i
cmp,
..
..
etc.
;
).
-
s--
--
->I
ndi
cat
est
hesour
ceoft
hepacket(
IPaddr
ess,Net
wor
kID orHost
name)
.
-
d--
--
->I
ndi
cat
est
hedest
inat
ionoft
hepacket
.
-
j--
--
->'
Jumpt
otar
get
'indi
cat
est
hei
nter
facet
hroughwhi
cht
hei
ncomi
ng
packet
sar
ecomi
ngt
hrough t
heI
NPUT,FORWARD andPREROOTI
NG
chai
n.
-
o--
--
->'
Out
putI
nter
face'i
ndi
cat
est
hei
nter
facet
hroughwhi
cht
heout
goi
ng
packet
sar
esentt
hrough t
heI
NPUT,FORWARD andPREROOTI
NG
chai
n.
-
spor
tor-
sour
ce-
por
t--
--
-> Sour
cepor
tfor-
ptcpor-
pudp.
-
dpor
tor-
dest
inat
ion-
por
t--
--
-> Dest
inat
ionpor
tfor-
ptcpor-
pudp.
6. Howt
oal
l
owapi
ngf
rom out
sidet
oinsi
deandi
nsi
det
oout
side?
#i
ptabl
es -
AINPUT -
picmp -
-i
cmp-
type echo-
request -
j ACCEPT
#i
ptabl
es -
A OUTPUT -
picmp -
-i
cmp-
type echo-
repl
y -
j ACCEPT
#i
ptabl
es -
A OUTPUT -
picmp -
-i
cmp-
type echo-
request -
j ACCEPT
#i
ptabl
es -
AINPUT -
picmp -
-i
cmp-
type echo-
repl
y -
j ACCEPT

Rat
nakar
Page215
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

7. I
nhowmanyway
scanwepr
otectt
henet
wor
k?
Ther
ear
e4way
stopr
otectt
henet
wor
k.
(
i)SELi
nux
(
ii
)IPt
abl
es
(
ii
i)Fi
rewal
l
d
(
iv)TCP wr
apper
s
I
Ptabl
esandf
ir
ewal
l
dbot
har
eusedt
opr
otectoursy
stemsser
vicesf
rom out
side.But
wecanuseonl
yonewayatat
ime.
8. Howt
oconf
igur
ethef
ir
ewal
ld?
(
i)I
nst
all
thef
ir
ewal
l
dpackageby#y
um i
nst
allf
ir
ewal
l
d* -
y command.
(
ii
) Checkwhet
hert
hef
ir
ewal
l
dpackagei
sinst
all
edornotby#r
pm -
qa
f
ir
ewal
ld command.
(
ii
i) Checkt
hest
atusoft
hef
ir
ewal
l
dbyexecut
ingt
hebel
ow commands.
#sy
stemct
lst
atusf
ir
ewal
ld or#f
ir
ewal
l-
cmd -
-st
atus
Exampl
esofI
Ptabl
escommands:
#ser
vicei
ptabl
esst
atus (
tocheck
t
heI
Ptabl
esst
atus)
#ser
vicei
ptabl
esst
art (
tost
art
t
heI
Ptabl
es)
#ser
vicei
ptabl
esst
op (
tost
op
t
heI
Ptabl
es)
#ser
vicei
ptabl
esr
est
art (
to
r
est
artt
heI
Ptabl
es)
#ser
vicei
ptabl
essav
e (
tosav
ethei
ptabl
e
r
ulesper
manent
ly)
#chkconf
igi
ptabl
eson (
toenabl
ethe
i
ptabl
esatnextboot
)
#chkconf
igi
ptabl
esof
f (
todi
sabl
ethe
i
ptabl
esatnextboot
)
#i
ptabl
es -
AINPUT -
i et
h0 -
ptcp -
-depor
t 22 -
j ACCEPT (
toaddt
he
r
ulest
otheexi
sti
ng
i
ptabl
est
oal
l
owssh)
wher
e -
A--
->Addorappendar
ulet
otheI
NPUT chai
nfori
ncomi
ngt
raf
fi
c.
-
iet
h0-
--
>Incomi
ngpacket
sthr
ought
hei
nter
faceet
h0wi
l
lbev
eri
fi
ed
agai
nstt
hisaddednewr
ule.
-
ptcp -
depor
t 22-
--
>pr
otocoli
stcpandt
hedest
inat
ionpor
tis22.
-
j ACCEPT -
--
>Acceptt
hepacket
.
#i
ptabl
es -
AINPUT -
ptcp -
m st
ate -
-st
ateNEW -
m t
cp -
-depor
t 80 -
j
ACCEPT
(
to

Rat
nakar
Page216
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

al
l
owht
tpt
raf
fi
c)
#i
ptabl
es -
AINPUT -
s9.
9.9.
9-pt
cp -
m st
ate -
-st
ateNEW -
m t
cp -
-depor
t
443 -
j ACCEPT
(
to
al
l
owht
tpst
raf
fi
c)
#i
ptabl
es -
AINPUT -
iet
h0 -
ptcp -
-depor
t22 -
m st
ate-
-st
ateNEW,
ESTABLI
SHED -
j ACCEPTand#i
ptabl
es -
A I
NPUT -
oeht
0-pt
cp -
-spor
t22 -
m st
ate -
-st
ate ESTABLI
SHED -
jACCEPT
(
toal
l
owssh i
nputandout
putonpor
tnumber22t
hroughadev
iceet
h0)
#i
ptabl
es -
AINPUT -
p udp -
m st
ate-
-st
ate NEW -
m udp-
-depor
t 161 -
j
ACCEPT
(
toal
l
ow SNMP t
raf
fi
cthr
oughpor
tnumber161)
#i
ptabl
es -
PINPUT DROP (
tobl
ock
t
hei
nputt
raf
fi
c)
#i
ptabl
es -
P FORWARD DROP (
to
bl
ockt
hef
orwar
dtr
aff
ic)
#i
ptabl
es -
p OUTPUT DROP (
tobl
ock
t
heout
putt
raf
fi
c)
(
wher
eP i
scapi
tall
ett
er)
#i
ptabl
es -
AINPUT -
s 9.
9.9.
9-j DROP (
tobl
ockt
he
9.
9.9.
9inputt
raf
fi
c)
#i
ptabl
es -
L (
toseet
he
l
i
stoft
heI
Ptabl
es)
#i
ptabl
es -
F (
tof
lusht
hei
ptabl
erul
esnot
hingbut
del
eti
ngal
lther
ules)
* Don'
trunt
hiscommandonpr
oduct
ionser
ver
sorr
eal
timeenv
ironment
.
#i
ptabl
es-
sav
e>/
root
/i
ptabl
es (
tosav
eal
ltheexi
sti
ngi
ptabl
esr
ulesasbackup
copyi
n/r
oot
/i
ptabl
esf
il
e)
#i
ptabl
es -
F (
todel
ete
al
li
ptabl
esr
ules)
#i
ptabl
es -
rest
ore</
root
/i
ptabl
es (
tor
est
oret
heI
Ptabl
es
f
rom t
hebackupf
il
e)
#i
ptabl
es -
IINPUT -
s <I
P addr
ess> -
ptcp -
-depor
t 21 -
j <REJECT>or
<DROP>or<ACCEPT>
(
toREJECTorDROP orACCEPT t
he FTP r
equest
sfr
om t
hespeci
fi
edI
P
addr
esssy
stem)
#i
ptabl
es -
IINPUT -
s <I
P addr
ess>/
<netmaskas8/
16/
24> -
ptcp -
-depor
t
21 -
j<REJECT> or
<DROP>or<ACCEPT>
(
toREJECT,DROP orACCEPTt
heFTP r
equest
sfr
om al
lthesy
stemsi
nthat

Rat
nakar
Page217
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

net
wor
k)
#i
ptabl
es -
IINPUT-
s<I
P addr
ess>/
<netmaskas8/
16/
24>-
ptcp -
j<REJECT>
or<DROP>or<ACCEPT>
(
toREJECT,DROP orACCEPT al
lther
equest
sfr
om t
hespeci
fi
edsy
stem al
lthe
sy
stemsi
nthatnet
wor
k)
#wat
ch -
d-n5f
ree (
tor
epeataf
reecommandf
or
ev
ery5seconds)
* Def
aul
tisf
orev
ery 2seconds.-
dopt
ionhi
ghl
i
ght
sthechange.Pr
essCt
rl
+ct
o
qui
tfr
om t
heabov
e command.
#pi
ng -
a 192.
168.
10.
1 (
topi
ngt
heI
Paddr
esswi
th
audi
abl
epi
ngi
e.,
itmakesnoi
ses)
#shr
ed -
n5t
rai
l
.txt (
toov
erwr
it
ethet
rai
l
.txtf
il
efi
vet
imes
def
aul
tis3t
imes)
#shr
ed -
u5t
rai
l
.txt (
tor
emov
eaf
il
e
af
terov
erwr
it
ing)
* Thi
sshed t
oolmaynotwor
kinj
our
nal
i
ngorRAI
Dfi
l
esy
stems.
#f
il
e <f
il
ename> (
toknowwhat
t
ypef
il
eist
hat
)
#mt
r <I
Paddr
ess> (
tocheckt
heconnect
ionbet
weent
hesour
ce
andt
hedest
inat
ions)
* Theabov
ecommandgi
vest
her
epor
tcont
inuousl
yunt
ilt
heuserpr
essCt
rl
+c.
#ht
op (
iti
sani
mpr
oved t
op commandandi
tal
l
owst
oscr
oll
v
ert
ical
l
yorhor
izont
all
y)
#l
ogsav
efi
l
eli
st.
txtl
s-l (
tocapt
uret
heout
putofanycommandand
st
oresi
tinaf
il
eal
ongwi
th
t
hest
art
ingandendi
ngt
imeoft
hecommand)
#l
ook "
pri
ntf
"av
ltr
ee.
c (
todi
spl
ayal
lthel
i
nesi
naf
il
ethatst
artwi
tha
par
ti
cul
arst
ri
ngand
per
for
manceoft
hiscommandi
smor
ethangr
ep)
#st
at <f
il
ename> (
todi
spl
ayt
hest
atusofaf
il
eorf
il
esy
stem l
i
keabsol
utepat
h
oft
hef
il
es,t
henoofbl
ocksusedbyt
hef
il
e,t
heI
/O bl
ocksi
ze,i
nodeaccess
speci
fi
er,accesst
ime,t
imeofmodi
fi
cat
ion,.
..
.et
c)
#mc (
iti
sapower
fult
extbasedf
il
emanagerandi
tisadi
rect
ory
br
owsi
ngt
oolandal
l
owst
o see
t
hecont
ent
soft
hear
chi
vedf
il
es,
..
.et
c.;
)
*I
nRHEL-6wehav
etowr
it
ether
ulesandr
egul
ati
onst
oal
l
ow ordenyt
hesy
stem
but
,inRHEL-7wehav
e
enabl
eordi
sabl
ethef
ir
ewal
l
dopt
ionsonl
y.
#f
ir
ewal
l
-conf
ig (
tomanaget
hef
ir
ewal
l
dser
vicesusi
ng
gr
aphi
cal
usermode)

Rat
nakar
Page218
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#f
ir
ewal
l
-cmd -
-get
-zones (
todi
spl
ayal
l
av
ail
abl
ezones)
#f
ir
ewal
l
-cmd -
-get
-def
aul
t-
zone (
tocheckt
hedef
aul
tzone,t
he
def
aul
tzonei
spubl
iczone)
#f
ir
ewal
l
-cmd -
-set
-def
aul
t-
zone=wor
k (
toact
ivat
ethewor
kzone,
not
hingbutchangi
ngdef
aul
t
zonet
empor
ari
l
y)
#f
ir
ewal
l
-cmd-
-per
manent -
-set
-def
aul
t-
zone=wor
k (
tosett
hedef
aul
tzone
aswor
kper
manent
ly)
#f
ir
ewal
l
-cmd -
-get
-act
ivat
e-zones (
todi
spl
aywhi
chzonei
sanact
ivewi
thI
P
addr
essandi
nter
faceet
h0)
#f
ir
ewal
l
-cmd -
-add-
ser
vice=172.
25.
0.0/
24 -
-zone=publ
i
c(t
oaddt
hesour
cet
othe
publ
i
czonet
empor
ari
l
y)
#f
ir
ewal
l
-cmd -
-get
-act
ivat
e-zone (
toseet
he
def
aul
tzonewhi
chi
sact
ivat
ed)
#f
ir
ewal
l
-cmd -
-per
manent -
add-
sour
ce=172.
25.
0.0/
24 -
-zone=publ
i
c
(
toaddt
heI
Paddr
esst
opubl
i
c
zoneper
manent
ly)
#f
ir
ewal
l
-cmd -
-r
emov
e-souce=172.
25.
0.0/
24 -
-zone=publ
i
c (
tor
emov
ethei
P
addr
essf
rom publ
i
czone
t
empor
ari
l
y)
#f
ir
ewal
l
-cmd -
-per
manent-
-r
emov
e-sour
ce=172.
25.
0.0/
24 -
-zone=publ
i
c
(
tor
emov
ethei
Paddr
essf
rom publ
i
c
zoneper
manent
ly)
#f
ir
ewal
l
-cmd -
-add-
int
erf
ace=et
h1 -
-zone=publ
i
c (
tochanget
hei
nter
face oradd
i
nter
facet
othe
publ
i
czonet
empor
ari
l
y)
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
int
erf
ace=et
h1 -
-zone=publ
i
c (
to
changet
hei
nter
face oradd
i
nter
facet
othepubl
i
czoneper
manent
ly)
#f
ir
ewal
l
-cmd -
-get
-act
ive-
zones (
toseet
he
act
ivat
edz
ones)
* Al
lrul
eswhatwehav
ewr
it
tenar
etempor
ary
.Ift
hesy
stem i
sreboot
edt
henal
l
changedv
aluesar
erev
ert
backt
oit
'spr
evi
ousst
ate
* Tomaket
hechangedv
aluesper
manentt
hen,add -
-per
manentt
oal
lthe
commandssetoff
ir
ewal
l
d.
#f
ir
ewal
l
-cmd -
-r
eload (
toappl
ythechanged
r
ulesi
mmedi
atel
y)
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
ser
vice=sshd (
toaddt
hesshdser
vicet
o

Rat
nakar
Page219
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

f
ir
ewal
lper
manent
ly)
#f
ir
ewal
l
-cmd -
-l
ist
-ser
vices (
tol
i
stal
lthef
ir
ewal
l
addedser
vices)
#f
ir
ewal
l
-cmd -
-l
ist
-al
l (
tol
i
stal
ltheal
lthef
ir
ewal
laddedser
viceswi
th
det
ail
edi
nfor
mat
ion)
#f
ir
ewal
l
-cmd -
-per
manent -
-r
emov
e-ser
vice=sshd(
tor
emov
esshdser
vicef
rom
f
ir
ewal
lper
manent
ly)
#f
ir
ewal
l
-cmd -
-per
manent -
-add-
por
t=22/
tcp (
toaddt
hepor
tnumber22wi
th
t
cppr
otocol
tof
ir
ewal
l
per
manent
ly)
#f
ir
ewal
l
-cmd -
-per
manent -
-r
emov
e-por
t=22/
tcp (
tor
emov
ethepor
t
number22per
manent
ly)
#f
ir
ewal
l
-cmd -
-compl
ete-
rel
oad (
fi
rsti
tunl
oadal
lthef
ir
ewal
lset
ti
ngs
andagai
nrel
oadt
hef
ir
ewal
l
set
ti
ngscompl
etel
y)
TCP WRAPPERS:
* Fi
rewal
l
dwi
l
lpr
otectal
ltheser
vices.
* TCPWRAPPER wi
l
lal
sopr
otectt
heser
vices,buti
tcansuppor
tforonl
yli
mit
ed
ser
vices.Andi
tcanpr
otect
t
heser
viceswhi
char
ehav
ingt
he l
ibwr
ap.
somodul
eisl
oadedf
ort
hatser
vice.
* So,TCPWRAPPER doesnotsuppor
ttopr
otectal
ltheser
vicesex
ceptl
i
bwr
ap.
so
modul
eloaded.
#l
dd (
thi
scommandi
susedt
ocheckt
hemodul
eswhi
char
e
l
oadedf
ort
hisser
vices)
#l
dd <ser
vicenamewi
thf
ullpat
h> (
todi
spl
ayal
lthel
oadedmodul
esoft
he
speci
fi
edser
vice)
#l
dd /
usr
/sbi
n/sshd (
todi
spl
ayal
lthel
oadedmodul
esof
t
hesshdser
vice)
#l
dd /
usr
/sbi
n/sshd|
grep -
ili
bwr
ap.
so (
tocheckwhet
herl
i
bwr
ap.
somodul
e
i
sloadedornot
)
Toconf
igur
etheTCPWRAPPER:
(
i)Open/
etc/
host
s.deny or/
etc/
host
s.al
l
ow f
il
eby #v
im /
etc/
host
s.denyor
host
s.al
low commands.
*Theabov
efi
l
esar
etobeedi
tedormodi
fi
edt
oenabl
eordi
sabl
ethet
cpwr
apper
ser
vicest
heuser
s.
#v
im /
etc/
host
s.deny (
Got
olastl
i
neandt
ypeasbel
ow)
sshd:172.
25.
9.11 orsy
stem9.
exampl
e.com (
todenyt
hespeci
fi
ed
hostorhost
name)
sshd:ALL (
todenyal
lthecl
i
ent
s)

Rat
nakar
Page220
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

sshd:ALLEXCEPT *
.eampl
e.com (
todenyal
lthecl
i
ent
s
exceptal
lthesy
stemsof
exampl
e.com domai
n)
(
ii
)sav
eandexi
tthi
sfi
l
e.
(
ii
i)Open/
etc/
host
s.al
low by #v
im /
etc/
host
s.al
l
ow commandandgot
olastl
i
ne
andt
ypeasbel
ow.
sshd:172.
25.
9.11 172.
25.
6.11 (
toal
l
ow
2sy
stemsonl
y)
(
iv)sav
eandex
itt
hisf
il
e.
*I
fthecl
i
entsy
stem'
sent
ryi
sther
einbot
h/et
c/host
s.denyand /
etc/
host
s.al
l
ow
f
il
es,t
hent
he
TCPWRAPPER wi
l
llook/
etc/
host
s.al
l
ow f
il
efi
rst
.Theni
twi
l
llook/
etc/
host
s.denyf
il
e.
I
fther
eisan ent
ryi
nbot
hthef
il
es,t
heni
twi
l
lal
l
owt
hesy
stem becausebasedon
t
heabov
erul
efi
rsti
twi
l
lread /
etc/
host
s.al
l
ow f
il
eandal
l
owt
hesy
stem.I
twon'
t
r
eadt
he /
etc/
host
s.deny f
il
e.

26.Vi
rt
ual
izat
ion

1. Whati
svi
rt
ual
izat
ion?
Vi
rt
ual
i
zat
ional
l
owsmul
ti
pleoper
ati
ngsy
stem i
nst
ancest
orunconcur
rent
lyonasi
ngl
e
comput
er;
i
tisameans ofsepar
ati
nghar
dwar
efr
om asi
ngl
eoper
ati
ngsy
stem.Each

guest
”OSi
smanagedby
aVi
rt
ual
Machi
neMoni
tor(
VMM)
,al
soknownasahy
per
visor
.
Becauset
hev
irt
ual
i
zat
ionsy
stem si
tsbet
weent
heguestandt
he har
dwar
e,i
tcancont
rol
t
heguest
s’useofCPU,
memor
y,andst
orage,
evenal
l
owi
ngaguestOSt
omi
grat
efr
om one
machi
net
oanot
her
.

Rat
nakar
Page221
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

2. Whatar
ety
pesofv
irt
ual
izat
ionsav
ail
abl
einLi
nux?
RHEL-5: RHEL-6& 7:
xen kv
m
64bi
t 64bi
t
VT-
Enabl
ed VT-
Enabl
ed
I
ntel
/AMD I
ntel
/AMD
2GB RAM 2GB RAM
6GB Har
ddi
sk 6GB Har
ddi
sk
3. Whatar
ethepackagesofv
irt
ual
izat
ionandhowt
oinst
allt
hepackages?
(
i)qemu (
Iti
susedt
opr
ovi
deuserl
evelKVM v
irt
ual
i
zat
ionanddi
ski
mage
al
so)
(
ii
)vi
rt (
Iti
susedt
opr
ovi
dev
irt
ual
i
zat
ionsof
twar
e)
(
ii
i)l
i
bvi
rt (
Iti
susedt
opr
ovi
det
hel
i
brar
iesf
orv
irt
ual
i
zat
ionsof
twar
e)
(
iv)py
thon (
Thi
spackagepr
ovi
dest
hehostandser
verl
i
brar
iesf
ori
nter
act
ing
wi
thHy
per
visorand
Hostsy
stem)
#y
um i
nst
allqemu* v
irt
* l
i
bvi
rt
* py
thon* -
y (
toi
nst
all
the
v
irt
ual
i
zat
ionsof
twar
es)
4. Howt
ost
artt
hev
irt
ual
izat
ionmanagerandhowt
ocr
eat
eanewv
irt
ual
machi
ne?
(
i)Got
oAppl
i
cat
ions -
--
--
> Sy
stem Tool
s--
--
-> Vi
rt
ualMachi
neManager
(
ii
)Vi
tualMachi
neManageri
susedt
ocheckanddi
spl
ayst
heav
ail
abl
evi
rt
ual
machi
nes.I
tisal
sousedt
o cr
eat
ethenewv
irt
ual
machi
nes.
(
ii
i)Tocr
eat
eanewv
irt
ual
machi
nef
ir
stcl
i
ckonmoni
tori
con,t
henent
ert
hev
irt
ual
machi
nename,Sel
ect LocalandSel
ectFor
war
d.
(
iv)Cl
i
ckonBr
owseLocal
,Sel
ectt
heguestO/
S ".i
so"i
magef
il
eandSel
ect
For
war
d.
5. Whatar
ethepackagesofVi
rt
ual
izat
ionHy
per
visorandhowt
oinst
all
thepackages?
(
i)"
vir
tual
i
zat
ionhy
per
visor
" (
prov
idest
hef
oundat
iont
ohostv
irt
ual
machi
nes
i
ncl
udest
hel
i
bvi
rtand
qemu-kv
m package)
(
ii
)"v
irt
ual
i
zat
ioncl
i
ent
" (
prov
idest
hesuppor
ttoi
nst
allandmanagev
irt
ual
machi
nesi
ncl
udes v
irsh,v
irt
-i
nst
all
,vi
rt
-
manager
,vi
rt
-t
opandv
irt
-vi
ewerpackages)
(
ii
i)"
vir
tual
i
zat
iont
ool
s" (
prov
idest
ool
sforof
fl
inemanagementofv
irt
ual
machi
nesi
ncl
udest
he
l
i
bguest
fspackage)
(
iv)"
vir
tual
i
zat
ionpl
atf
orm" (
prov
idesani
nter
facet
oaccessandcont
rol
vir
tual
machi
nesi
ncl
udest
he l
i
bvi
rt
,
l
i
bvi
rt
-cl
i
entandv
irt
-whopackages)
I
nst
all
ati
onofVi
rt
ual
izat
ionHy
per
visor:

Rat
nakar
Page222
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#y
um gr
oupi
nst
all"
vir
tual
izat
ionhy
per
visor
""v
irt
ual
izat
ioncl
ient
"
"
vir
tual
izat
iont
ool
s"
"
vir
tual
izat
ionpl
atf
orm" -
y

6. Howt
ocr
eat
east
oragepoolandv
olumeusi
ngv
irsht
ool
?
(
i)Vi
ewal
ltheav
ail
abl
est
oragepool
sby #v
irsh pool
-l
ist command.
(
ii
)Cr
eat
east
oragepool
dir
ect
oryby #mkdi
r/v
ar/
li
b/l
ibv
irt
/<poolname>
command.
(
ii
i) Def
inet
hest
oragepool
dir
ect
oryby #v
irshpool
-def
ine-
as <poolname>
di
r--
--
/var
/li
b/l
i
bvi
rt
/<pool
name> command.
(
iv)St
artt
hev
irt
ual
stor
agepoolby #v
irshpool
-st
art<poolname> command.
(
v)Toseet
hespeci
fi
edst
oragepool
inf
ormat
ionby #v
irshpool
-i
nfo <poolname>
command.
(
vi) Cr
eat
ethest
oragepool
vol
umewi
thspeci
fi
edsi
zeby #v
irshv
ol-
creat
e-as
<poolname><pool
v
olume><si
zei
nMB/
GB/
TB> command.
(
vii
)Toseet
hel
i
stofal
lav
ail
abl
est
oragepool
vol
umesby #v
irshv
ol-
li
st<pool
name> command.

Ot
herusef
ulcommands:
#l
scpu (
tol
i
stt
heCPU i
nfor
mat
ion)
#cat/
proc/
cpui
nfo (
todi
spl
ayt
heCPU i
nfor
mat
ion)
#v
irsh st
art<v
irt
ualmachi
nename> (
tost
artt
hev
irt
ualmachi
ne)
#v
irsh shut
down<v
irt
ualmachi
nename> (
toshut
downt
hev
irt
ualmachi
ne)
#v
irsh dest
roy <v
irt
ualmachi
nename> (
todel
etet
hev
irt
ualmachi
ne)
#v
irsh suspend <v
irt
ualmachi
nename> (
topauset
hev
irt
ualmachi
ne)
#v
irsh r
esume <v
irt
ualmachi
ne> (
tost
artt
hepausedv
irt
ualmachi
ne)
#v
irshnet
-l
ist (
toseeal
ltheav
ail
abl
evi
rt
ual
machi
nes)
#v
irshnet
-def
ine /
root
/<v
irt
ual
net
name.
xml
>(t
odef
ineav
irt
ual
net
wor
kusi
ngxml
f
il
e)
#v
irsh net
-aut
ost
art<v
irt
ual
netname> (
tosett
hev
irt
ual
net
wor
kaut
ost
artat
r
eboot
)
#v
irshnet
-st
art<v
irt
ual
netname> (
tost
artt
hev
irt
ual
net
wor
k)
#r
ht-
vmct
lful
l
resetal
l (
tor
esetal
lthev
irt
ualmachi
nesas
new machi
nes)
#r
ht-
vmct
lresetser
ver (
tor
esett
heser
verv
irt
ualmachi
ne)
#r
ht-
vmct
lresetcl
i
ent (
tor
esett
hecl
i
entv
irt
ualmachi
ne)
#pushcour
se al
l<sy
stem host
name> (
tosendt
heser
verandcl
i
ent
v
irt
ualmachi
nest
othe

Rat
nakar
Page223
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

speci
fi
edsy
stem)

27.Gener
alQuest
ions

1. Tel
lmeabouty
our
sel
f?
(
i)Tel
lyourper
sonal
det
ail
s
(
ii
)Techni
cal
(Educat
ional
det
ail
s)
2. Tel
lmeabouty
ourpr
ofi
le?
(
i)Tel
lyourper
sonal
det
ail
s.
(
ii
)Educat
ional
det
ail
s.
(
ii
i)Wor
khi
stor
y(pr
evi
ouscompani
es)
.
(
iv)Pr
ofi
l
e(Pr
esentcompany
):
(
a)Comi
ngt
oLi
nux:(
upt
oti
l
ldat
e)
(
1)O/
Sinst
all
ati
on.
(
2)Fi
l
esy
stem cr
eat
ion.
(
3)Useradmi
nist
rat
ionl
i
keusercr
eat
ion,
userper
missi
ons,
prof
il
es,
set
ti
ng
env
ironmentt
ouser
,gi
vi
ng speci
alper
missi
ons(
sudoandACLs)t
othem and
usert
roubl
eshoot
ingi
ssuesl
i
keuserunabl
eto l
ogi
npasswor
drequest
s.
(
4)Har
dwar
erel
atedi
ssuesl
i
keaddi
ngdi
sks,
NICcar
ds,
processorr
epl
acement
,
memor
yrepl
acement
, i
ncr
easememor
yandpowersuppl
y
r
epl
acement
,..
..
etc.
,
(
5)Net
wor
krel
atedi
ssuesl
i
kepr
ovi
dingnet
wor
king,
set
ti
ngNI
Ccar
dpar
amet
ers,
t
roubl
eshoot
ing i
ssues.
(
6)Somei
nter
nal
backups.
(
7)O/
Spat
chi
ngandpackageadmi
nist
rat
ionwhenev
erneededusi
ng r
pm and

Rat
nakar
Page224
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

y
um.
(
8)Ial
sosuppor
tspr
ocessr
elat
edi
ssuesl
i
kememor
yut
il
izat
ionf
ull
(90%)
,CPU
ut
il
izat
ionf
ull
(90%)and f
il
esy
stem f
ull
,.
..
etc.
,
(
9)Ial
sosuppor
tforsy
stem t
roubl
eshoot
ingi
ssuesl
i
kesy
stem notr
espondi
ng,
nodedown,
star
ti
ngand st
oppi
ngser
vicesanddeamons.
(
b)Comi
ngt
oVer
it
asVol
umeManager:(
from t
hel
ast1y
ear
)
(
1)Wegetr
equest
sfr
om pr
oduct
ion,
dat
abase,
QApeopl
eli
kecr
eat
ingv
olumes,
f
il
esy
stem cr
eat
ion, i
ncr
easeand(
or)decr
easet
hev
olumesi
zes,
prov
ide
per
missi
ons,
redundancy
,putt
hev
olumei
nto cl
ust
ert
opr
ovi
dehi
gh
av
ail
abi
l
ity
,
(
2)somet
imesdest
royorr
emov
ethev
olumes,
backupandr
est
orewhenev
er
necessar
y,
(
3)Weal
sogetsomet
roubl
eshoot
ingi
ssuesl
i
kev
olumenotst
art
ed,
vol
umenot
accessi
ble,
fil
esy
stem cr
ashed,
mountpoi
ntdel
eted,
disksf
ail
ed,
v
olumemanagerdeamonsar
enotwor
king,
conf
igur
ati
on f
il
esmi
ssed,
cr
ashed,
diskgr
oupsnotdepor
ti
ngandnoti
mpor
ti
ng,
vol
umest
art
edbutuser
sar
e
unabl
etoaccessf
il
esy
stemsont
hosev
olumes,
.
..
etc.
,
(
c)Comi
ngt
oVer
it
asCl
ust
er:(
from 6mont
hs)
(
1)Wegetr
equest
sli
kenodeaddi
ng,
resour
ceaddi
ng,
ser
vicegr
oupaddi
ng,
addi
ngser
vicegr
oupsand r
esour
cest
oex
ist
ingser
vicegr
oups,
mount
poi
ntsaddi
ng,
addi
ngNI
Ccar
s,I
Paddr
esses,
addi
ng v
olumes,
di
skgr
oups,
freezi
ngandunf
reezi
ngser
vicesgr
oupsandal
sogetsomet
roubl
eshoot
ing
i
ssuesl
i
kecl
ust
ernotr
unni
ng,
ifr
esour
cesf
aul
tedt
henr
est
artt
heser
vice
gr
oups,
communi
cat
ion f
ail
edbet
weent
wosy
stems,
Gabi
snotr
unni
ng,
l
l
tnotr
unni
ng,
andconf
igur
ati
onf
il
esmai
n.cf cr
ashedormi
ssed
andr
esour
cesar
enotst
art
ed,
..
.et
c.
(
d)Ial
sowr
it
esmal
lscr
ipt
stoper
for
mint
ernal
rout
inej
obs,
documentpr
epar
ati
on,
handov
ermai
l
s checki
ng,
howmanyt
icket
sissued,
howmanyt
icket
s
sol
vedandhowmanyj
obspendi
ng,
..
..
etc.
,
(
e)Ial
sosuppor
tsi
nappl
i
cat
iondepl
oyment
,dat
abasedepl
oymentandot
her
s.
3. Whatar
ethet
ool
syouar
eusi
ng?
(
i) net
stat
,vmst
at,
iost
at,
nmapandt
opf
orper
for
mancemoni
tor
ingt
ool
s.
(
ii
)cr
onandatf
orj
obschedul
i
ng.
(
ii
i)Remedyt
ool
fort
icket
ingsy
stem.
(
iv)Ver
it
asNet
backup,
Tiv
oli
,.
..
.et
c.,
forbacki
ngpur
pose
(
v)Out
lookf
ori
nter
nal
mai
l
ing.
4. Whatar
ethest
orageboxesusi
ng?
(
i) Net
Apps,
VMC,
Clar
ianandEMC2.
(
ii
)Emul
ex,
Qlogi
c(HBAcar
ds)
.
5. Whatar
etheAppl
icat
ionsar
eyouusi
ng?

Rat
nakar
Page225
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i) Dat
abases(
Oracl
e10g,
11gandMy
sql
).
(
ii
)Or
acl
eAppl
i
cat
ionsl
i
keERPpackages(
Oracl
e11i
and12)
.
(
ii
i)SAPappl
i
cat
ions.
(
iv)Dat
awar
ehousi
ng,
..
..
etc.
,
6. Whati
syourcompanyhi
erar
chy
?
Me -
--
--
> Team Lead orTechLead -
--
--
> Manager -
--
--
> Del
i
ver
yManager -
--
--
>
Asi
ahead
7. Whatl
evelar
eyousuppor
ti
ng?
Li
nuxAdmi
nist
rat
orasLev
el2.
8. Whatar
eyourshi
ftt
imi
ngs?
Gener
alshi
ft-
--
--
> 09:
00-18:
00hr
s.
Shi
ft
s:Oneshi
ftf
rom USAandt
woshi
ft
sfr
om I
ndi
aoper
ati
onsupt
olast2mont
hsand
nowal
ltheoper
ati
ons ar
efr
om I
ndi
aonl
yanddat
acent
reoper
ati
onsf
rom
USAonl
y.
1stshi
ftf
rom 07:
00-15:
00hr
s,2ndshi
ftf
rom 15:
00-23:
00hr
s,3r
dshi
ft
f
rom 21:
00-07:
00hr
s.
9. Whati
syourt
eam si
ze?
Tot
al18member
s.Foreachshi
ft5member
seachand3member
sonweekl
yof
f.
10.Whataboutt
icket
sissuesandt
icket
sfr
equency
?
(
i)7-8t
icket
sdai
l
yandMax.10perday
.
I
nthose85-90%ar
eCPUut
il
izat
ionf
ull
,memor
yful
l
,fi
l
esy
stem f
ull
,l
ogi
npr
obl
ems
andsomet
imesnode downi
ssues.
(
ii
)Gener
alt
icket
ssev
eri
ty-3,sev
eri
ty-2,sev
eri
ty-1.
Wear
enotr
esol
vedsev
eri
tyl
evel
-1t
icket
s.
(
ii
i)I
nci
dent
s:
Sev
eri
tyl
evel-1 shoul
dbesol
vedwi
thi
n1hour(
Immedi
ate)
.
Sev
eri
tyl
evel-2 shoul
dbesol
vedwi
thi
n6hour
s.
Sev
eri
tyl
evel-1 shoul
dbesol
vedwi
thi
n24hour
s.
Sev
eri
tyl
evel-1 shoul
dbesol
vedwi
thi
n2day
s.
Requestpr
ior
it
y--
--
> Hi
gh,medi
um andl
ow
11.Whati
syournot
iceper
iod?
25-30day
s.
12.AnyMai
li
ds?
I
nter
nal
mai
li
d(mai
l
swon'
tcomef
rom out
sideandgot
oout
side)
.
13.Ar
eyoucont
ractorper
manent
?Andwhyar
eyouchangi
ng?
Per
manenti
nXXXXXXXXXXX Pv
tli
mit
ed.Iam l
ooki
ngt
hecompanywhi
chpr
ovi
des
hi
ghav
ail
abi
l
ityoncl
oud, v
irt
ual
i
zat
ionandst
orageenv
ironment
stoenhancemy
knowl
edgeandbet
tercar
eergr
owt
h.
14.Whatar
ethepr
oject
sar
eyoudeal
ing?
(
i) Dat
abases.

Rat
nakar
Page226
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
ii
)Banki
ng.
(
ii
i)Fi
nance.
(
iv)Logi
sti
cs.
(
v)Hot
elandTour
ism,
..
..
.et
c.,
15.Howmanyser
ver
sar
eyouhandl
ing?
Tot
al600sy
stems.
200phy
sical
syst
emsandr
emai
ning400sy
stemsar
einv
irt
ual
i
zat
ionenv
ironment
.
10f
or
20f
orQual
i
ty& 10under
550f
orLi
nux 10f
orWi
ndows Appl
i
cat
ion
I
nter
nal
Test
ing t
ransi
ti
on
Dev
elopment
16.Whati
syourenv
ironment
?
(
i) Dev
elopmentupt
o10ser
ver
s
(
ii
)Qual
i
tyAssur
anceorQual
i
tyt
est
ingupt
o20ser
ver
s.
(
ii
i)UserAut
hent
icat
ion(
UA)upt
o10ser
ver
s.
(
iv)Pr
oduct
ion upt
o550ser
ver
s.
(
v)Underbui
l
ding 10.
17.Howt
ohandov
ert
heshi
ft
?
* Mai
ltor
eli
ever
.
* Di
rectt
orel
i
ever
.
18.Cany
oucont
actt
hedat
acent
re?
(
i)I
tdependsont
hesev
eri
ty.
(
ii
)Ift
hesi
tuat
ioni
semer
gency
,thenwewi
l
lcal
lthedat
acent
rebyphone.
(
ii
i)I
fthesi
tuat
ioni
snon-emer
gencyt
henwewi
l
lmai
ltot
hedat
acent
repeopl
e.
19.Whati
sser
verhar
deni
ng?
(
i) Tochecki
ngoursy
stem i
sreachi
ngt
ost
andar
dsr
equi
redbyt
heor
gani
zat
ion.
(
ii
)Thati
smi
nimum passwor
dlengt
h,mi
nimum si
zeofr
ootpar
ti
ti
on.
(
ii
i)Mi
nimum f
reespaceandpasswor
dexpi
ryandal
lot
hersecur
it
yst
andar
ds.
20.Whatar
edecommi
ssi
onandr
ecommi
ssi
on?
(
i) Nor
mal
l
yser
ver
sshoul
dbechangedev
ery5-6y
ear
sbecauseofper
for
mance
degr
adat
ionasperst
andar
ds oft
hecompany
.
(
ii
)Decommi
ssi
onmeanst
hepr
ocessofr
emov
ingt
heol
dsy
stem f
rom t
he
pr
oduct
ionenv
ironmentand Recommi
ssi
onmeanst
hepr
ocessofput
ti
ng
t
henewsy
stem i
ntot
hepr
oduct
ionenv
ironment
.
(
ii
i) Wear
enotdedi
cat
edf
ordecommi
ssi
on.Wedodecommi
ssi
onal
ongwi
th
ourr
out
inewor
k.
(
iv)Logi
nasr
oott
houghconsol
e.
(
v)Fi
rsti
nfor
m orr
aiset
het
ickett
omoni
tor
ingt
eam t
oignor
etheal
ert
s.
(
vi)
Stopt
heappl
i
cat
ionanddat
abases.
(
vii
)St
opt
hecl
ust
erandVol
umeManager
.
(
vii
i
)Unmountt
hef
il
esy
stem.

Rat
nakar
Page227
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
ix)Af
tert
hatweshoul
dputt
hesy
stem f
oroneweek.
(
x)Wewi
l
linf
orm orr
aiset
het
ickett
othenet
wor
kteam t
orel
easet
hepor
tsbel
ongi
ng
t
othatsy
stem.
(
xi) Fi
nal
l
ywei
nfor
mtot
hedat
acent
repeopl
etor
emov
ethecabl
esf
rom t
hat
sy
stem.
21.Expl
ainbackupandwhati
syourbackuppol
icy
?
(
i) Backupmeanst
aki
ngacopyoft
heexi
sti
ngsy
stem andr
est
orewhent
hesy
stem i
s
f
ormat
tedorcr
ashed.
(
ii
)Inbackupenv
ironmentnor
mal
l
ywehav
e3ser
ver
s.
(
a)Mast
erSer
ver(
1or2sy
stems)
.
(
b)Medi
aSer
ver(
1or2sy
stems)
.
(
c)Cl
i
entSer
ver (
1or2sy
stems)
.
(
ii
i)I
nouror
gani
zat
ionweusedt
otaket
hebackupi
nMedi
aSer
ver
.
(
iv)Backupf
ail
smeanspr
oduct
ionser
vermaydownormedi
aser
vermaybei
ndown,
f
il
esy
stem maynotbe av
ail
abl
eorbackupt
ool
por
tnumbermaybebl
ocked.
(
v)Backupcanbet
akeni
n3t
ypes.
(
a)Appl
i
cat
ionBackup(
Appl
i
cat
ionpeopl
ewi
l
ltake)
.
(
b)Fi
l
esy
stem (
O/S)backup(
Syst
em Admi
nist
rat
orswi
l
ltake)
.
(
c)Dat
abasebackup(
Dat
abaseAdmi
nist
rat
orswi
l
ltake)
.
(
vi)Backupi
saut
omat
edt
houghcr
ont
aborsepar
atebackupt
ool
sli
keVer
it
asNet
backupandTi
vol
i
,..
..
etc.
,
(
vii
)Thecr
ont
abwi
l
lnoti
nfor
mthef
ail
edbackup.ButVer
it
asNetbackupandTi
vol
i
t
ool
swi
l
lsendmessages aboutbackupf
ail
sandwhyt
hebackupi
sfai
l
ed
becauset
heset
ool
swi
l
lgener
atet
hef
ail
edbackupl
ogf
il
es.
(
vii
i
)Ifanyf
il
esar
eopeni
nthepr
oduct
ionser
ver
,thebackupmaybef
ail
ed.So,
check
anyf
il
esopenedornot by#l
sofor#f
user -
cv <f
il
esy
stem>commands.
(
ix)Somet
imest
hescr
ipti
nVer
it
asNetbackuporTi
vol
itool
smaybecor
rupt
edornot
r
unni
ng,
thenr
est
ore t
hosescr
ipt
sfr
om backuporweneedmanual
l
ydepor
t&
i
mpor
tandt
akebackup.
(
x)Somet
imesbackupf
ail
edduet
obackuppor
tno.13782maybenotwor
kingori
n
bl
ockedst
ate.I
tcanbe checkedby #net
stat-
ntul
p|gr
ep13782
command.
(
xi)I
fthemedi
aser
verandpr
oduct
ionser
verar
enoti
nthesamedomai
n,t
henbackup
maybef
ail
ed.(
ie.
, pr
oduct
ionser
verdomai
nnamemaybechangedbut
noi
nti
mat
iont
obackupt
eam aboutt
hatchange,
so medi
aser
veri
sin
anot
herdomai
n).
BackupPr
ocedur
e:
(
i)Depor
tthedi
skgr
ouponpr
oduct
ionser
ver
.
(
ii
)Impor
tthedi
skgr
ouponbackup(
medi
a)ser
ver
.
(
ii
i)Joi
nthedi
skgr
oupwi
thmedi
aser
ver
.

Rat
nakar
Page228
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
iv)Sy
nct
hedat
awi
thpr
oduct
ionser
ver
.
(
v)Taket
hebackup.
(
vi)spl
i
tthedi
skgr
oupf
rom medi
aser
ver
.
(
vii
)Joi
nthedi
skgr
oupwi
thpr
oduct
ionser
ver
.
(
vii
i
)Depor
tthedi
skgr
oupf
rom medi
aser
ver
.
(
ix)I
mpor
tthedi
skgr
ouponpr
oduct
ionser
ver
.
Backuppol
icy:
(
i)Compl
ete(
ful
l
)backup(
ever
ymont
hie.
,oncei
namont
h).
(
ii
)Incr
ement
albackup (
Dai
l
y).
(
ii
i)Di
ff
erent
ialorcumul
ati
vebackup (
ever
yweekend)
.
22.Howt
otr
oubl
eshooti
fthef
il
esy
stem i
sful
l?
(
i) Fi
rstcheckwhet
hert
hef
il
esy
stem i
sO/
Sorot
hert
hanO/
S.
(
ii
)Ifi
tisot
hert
hanO/
S,t
heni
nfor
mtot
hatr
espect
ivet
eamst
ohousekeept
hef
il
e
sy
stem (
ie.
,remov
ethe unnecessar
yfi
l
esi
nthosef
il
esy
stem)
.
(
ii
i)I
fnotpossi
blet
ohousekeept
heni
nfor
mtodi
ff
erentt
eams(
rai
set
heCRQ(
Change
Request
))f
ori
ncr
easi
ng t
hef
il
esy
stem.
(
a)Fi
rstt
akebusi
nessappr
oval
andr
aiset
heCRQt
omoni
tor
ingt
eam t
oignor
ethe
al
ert
sfr
om t
hesy
stem, st
opt
heappl
i
cat
iont
eam t
ost
opt
heappl
i
cat
ion
anddat
abaset
eam t
ost
opt
hedat
abase.
(
b)Nor
mal
l
yteam l
eadort
echl
eadormanagerwi
l
ldot
hisbyi
nit
iat
ethemai
l
t
hread.
(
c)Wewi
l
ldot
hisonweekendt
oreducet
hebusi
nessi
mpact
.
(
iv)Fi
rstt
akeabackupoft
hef
il
esy
stem t
henunmountt
hef
il
esy
stem.
(
v)Remov
ethatpar
ti
ti
onandagai
ncr
eat
ethatf
il
esy
stem wi
thi
ncr
easedsi
ze,
then
mountagai
nthatf
il
e sy
stem andr
est
oret
hebackup.
(
vi)I
fthef
il
esy
stem bel
ongst
osy
stem l
ogf
il
esorot
herl
ogf
il
esandnott
odel
etet
hen
t
heyr
equest
edust
o pr
ovi
deoneReposi
tor
yser
ver(
onl
yforl
ogf
il
es)
.Nor
mal
l
yone
scr
iptwi
l
ldoaut
omat
ical
l
yredi
rectt
hel
og f
il
est
othatr
eposi
tor
yser
ver
.
(
vii
)Somet
imeswewi
l
ldel
etef
il
econt
ent
snott
hef
il
est
oreducet
hef
il
esi
zes.Fort
hat
weexecut
ethe command#cat/
dev
/nul
l><f
il
enamewi
thpat
h>
i
e.,
nul
l
ify
ingt
hef
il
es.
(
ix)I
fiti
srootf
il
esy
stem orO/
Sfi
l
esy
stem,
(
a)maybe/
optf
ull or maybe/
var f
ull or maybe/
tmpf
ull
(
b)I
n/v
ar/
log/
secur
eor/
var
/log/
syst
em or/
var
/tmp f
il
esmaybef
ull
.Ift
hose
f
il
esar
eimpor
tantt
hen r
edi
rectt
hem t
oot
hercent
ral
reposi
tor
yser
veror
backupt
hosef
il
esandnul
l
ify
ingt
hosef
il
es.
(
c)I
f/home di
rect
oryi
spr
esenti
nroot(/)f
il
esy
stem t
hent
hisf
il
esy
stem f
ull
wi
l
loccur
.Gener
all
y /
homewi
l
lbesepar
atedf
rom r
ootf
il
esy
stem andcr
eat
edas
separ
ate/
homef
il
esy
stem.I
f /
homei
sinr
oot(/)asadi
rect
oryt
hen
cr
eat
easepar
atef
il
esy
stem f
or/
homeandcopyt
hosef
il
es and

Rat
nakar
Page229
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

di
rect
ori
esbel
ongst
o/homeandr
emov
ethat /
homedi
rect
ory
.
(
d)I
froot(/)i
sful
lthencannotl
ogi
ntot
hesy
stem.So,
bootwi
thnetorCDROM
i
nsi
ngl
eusermodeand dot
heabov
esai
d.
(
x)Nor
mal
l
yiff
il
esy
stem i
sot
hert
hanO/
Sthenwewi
l
linf
ormt
othatr
espect
ive
managerorownerandt
ake t
heper
missi
onst
oremov
eunnecessar
yfi
l
est
hrough
v
erbal
per
missi
onorCRQ.
23.CPUut
il
izat
ionf
ull
,howt
otr
oubl
eshooti
t?
(
a)Nor
mal
l
ywegett
hesescenar
iosonweekendsbecausebackupt
eam wi
l
ltakeheav
y
backups.
(
b)Fi
rstcheckwhi
chpr
ocessesar
eusi
ngmor
eCPUut
il
izat
ionby#t
opandt
akea
snapshotoft
hatuser pr
ocessesandsendt
hesnapshotandi
nfor
m
t
othatusert
oki
l
ltheunnecessar
ypr
ocess.
(
c)I
fthosepr
ocessesar
ebackupst
heni
nfor
mtot
hebackupt
eam t
oreducet
he
backupsbyst
oppi
ngsome backupst
oreducet
heCPUut
il
iz
ati
on.
(
d)Somet
imesi
npeakst
ages(
peakhour
smeanshav
ingbusi
nesshour
s)CPU
ut
il
izat
ionwi
l
lful
landgetbackt
o t
henor
mal
posi
ti
onaut
omat
ical
l
yaf
tersome
t
ime(
wit
hinseconds)
.Butt
icketr
aisedbymoni
tor
ingt
eam. So,
wehav
eto
t
akeasnapshotoft
hatpeakst
ageandat
tacht
hatsnapshott
other
aisedt
icketandcl
ose
t
hatt
icket
.
(
e)Somet
imesi
fheav
yappl
i
cat
ionsar
erunni
ngandnott
oki
l
l(i
e.,
busi
ness
appl
i
cat
ions)
,theni
fanyspar
e pr
ocessori
sav
ail
abl
eorot
herl
owl
oad
CPUsav
ail
abl
ethenmov
ethoseheav
yappl
i
cat
ionpr
ocessest
othose CPUs.
(
d)I
fCPUsar
eal
sonotav
ail
abl
etheni
fthesy
stem suppor
tsanot
herCPUt
heni
nfor
m
t
othedat
acent
repeopl
e orCPUv
endort
opur
chasenewCPUt
houghBusi
ness
appr
oval
andmov
esomepr
ocessest
othenewl
y pur
chasedCPUs.
24.Howt
otr
oubl
eshootwhent
hesy
stem i
ssl
ow?
(
a)Sy
stem sl
owmeanst
heenduser
sresponsei
ssl
ow.
(
b)Checkt
heAppl
i
cat
ionf
il
esy
stem,
CPUut
il
iz
ati
on,
memor
yut
il
iz
ati
onandO/
Sfi
l
e
sy
stem ut
il
izat
ion.
(
c)I
fal
lar
eok,
thenchecknet
wor
kst
ati
sti
csandi
nter
faceswhet
hert
hei
nter
facesar
e
r
unni
ngi
nful
ldupl
ex modeorhal
fdupl
exmodeandcheckwhet
hert
hepacket
sar
e
mi
ssi
ng.I
fal
lar
eokf
rom oursi
det
hen,
(
d)I
nfor
mtonet
wor
kteam andot
herr
espect
ivet
eamst
osol
vet
hisi
ssue.
25.Howt
otr
oubl
eshooti
fthenodei
sdown?
(
a)Checkpi
ngi
ngt
hesy
stem.I
fpi
ngi
ng,
thencheckwhet
hert
hesy
stem i
sinsi
ngl
euser
modeornot
.
(
b)I
fthesy
stem i
sinsi
ngl
eusermodet
henputt
hesy
stem i
nmul
tiusermodei
e.,
def
aul
trunl
evel
by conf
ir
mingwi
thourt
eam whet
hersy
stem i
sunder
mai
ntenanceornot
.
(
c) Checki
nwhi
chr
unl
evel
thesy
stem i
srunni
ng.I
fiti
sini
nit1i
twi
l
lnotbe

Rat
nakar
Page230
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

abl
etopi
ng.I
fiti
sini
nitst
heni
t wi
l
lpi
ng.
(
d)I
nthi
ssi
tuat
ional
soi
fiti
snotpi
ngi
ngt
hent
ryt
ologi
nthr
oughconsol
epor
t.I
fnot
possi
blet
heni
nfor
mto dat
acent
respeopl
etohar
dboott
hesy
stem.
(
d)I
fconnect
edt
hroughconsol
epor
tthenwemaygett
heconsol
epr
ompt
.
26.Howt
otr
oubl
eshooti
fthememor
yut
il
izat
ionf
ull
?
(
a)Checkhowmuchmemor
yisi
nst
all
edi
nthesy
stem by#dmi
decode -
tmemor
y
command.
(
b)Checkt
hememor
yut
il
izat
ionby#v
mst
at-
v command.
(
c)Nor
mal
l
yappl
i
cat
ionorheav
ybackupsut
il
izemor
ememor
y.So,
inf
ormt
o
appl
i
cat
iont
eam orbackupt
eam orot
hert
eamswhi
cht
eam i
sut
il
izi
ngt
hemor
e
memor
ytor
educet
hepr
ocessesbyki
l
li
ngt
hem orpause t
hem.
(
d)Tr
ytoki
l
lordi
sabl
eorst
opt
heunnecessar
yser
vices.
(
e)I
fal
ltheway
sar
enotpossi
blet
heni
nfor
mtot
eam l
eadort
echl
eadormanagert
o
i
ncr
easet
hememor
y (
swapspace)
.Ifi
tisal
sonotpossi
blet
hent
aki
nghi
gher
aut
hor
it
y'
sper
missi
onst
oincr
easet
hephy
sical memor
y.Fort
hosewe
cont
actt
heser
verv
endorandco-
ordi
nat
ewi
tht
hem t
hroughdat
acent
repeopl
eto
i
ncr
easet
heRAM si
ze.
27.Howt
orepl
acet
hef
ail
edhar
ddi
sk?
(
a)Checkwhet
hert
hedi
ski
sfai
l
edornotby #i
ost
at -
En|gr
ep -
ihar
d/sof
t
command.
(
b)I
fhar
der
ror
sar
eabov
e20t
henwewi
l
lgof
orr
epl
acementoft
hedi
sk.
(
c)I
fthedi
ski
sfr
om SANpeopl
ethenwewi
l
linf
ormt
othem aboutt
her
epl
acementof
t
hedi
sk.I
fiti
sint
ernal di
skt
henwer
aiset
heCRQt
orepl
acet
hedi
sk.
(
d)Fort
hiswewi
l
lconsi
der
edt
wot
hings.
(
i)whet
hert
hesy
stem i
swi
thi
nthewar
rant
y.
(
ii
)wi
thoutwar
rant
y.
(
e)Wewi
l
ldi
rect
lycal
ltot
het
ollf
reeno.oft
hesy
stem v
endorandr
aiset
het
icket
.They
wi
l
lissuet
hecaseno. Thi
sist
heno.wehav
etoment
ioni
nal
l
cor
respondencest
ovendorr
egar
dingt
hisi
ssue.
(
f)I
fiti
shav
ingwar
rant
ytheyasksr
ackno.sy
stem no.andot
herdet
ail
sandr
epl
ace
t
hehar
ddi
skwi
thco- or
dinat
eoft
hedat
acent
repeopl
e.
(
g)I
fiti
snothav
ingwar
rant
y,wehav
etosol
vet
hepr
obl
em byourownorr
e-
agr
eementt
oext
endt
he war
rant
yandsol
vet
hatpr
obl
em.
28.Howt
orepl
acet
hepr
ocessor
?
(
a)Checkt
hepr
ocessor
'sst
atususi
ng #l
scpu or#dmi
decode -
tpr
ocessor
commands.
(
b)I
fitshowsanyer
ror
sthenwehav
etor
epl
acet
hepr
ocessor
.
(
c)Thenr
aiset
hecaset
ovendorbyt
oll
freeno.wi
thhi
gheraut
hor
it
iesper
missi
on.
(
d)Thev
endorwi
l
lgi
vecaseno.f
orf
utur
eref
erences.
(
e)Theyal
soasksr
ackno. sy
stem no.oft
hedat
acent
ref
orpr
ocessorr
epl
acement
.

Rat
nakar
Page231
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
f)Wewi
l
linf
ormt
otheDat
acent
repeopl
etoco-
ordi
nat
ewi
thv
endor
.
29.Howr
epl
acet
hef
ail
edmemor
ymodul
es?
Causes:
(
a)Thesy
stem i
scont
inuousl
yreboot
ing.
(
b)Wheni
npeakbusi
nesshour
s,i
ftheheav
yappl
i
cat
ionsar
erunni
ngt
hesy
stem
getpani
candr
eboot
ed. Thi
sisr
epeat
ingr
egul
arl
y.
Sol
uti
on:
(
a)Fi
rstwecheckhowmuchRAM pr
esenti
nthesy
stem wi
th#dmi
decode -
t
memor
y command.
(
b)Thenwer
aiset
hecaset
ovendorwi
tht
hehel
pofhi
gheraut
hor
it
ies.
(
c)Thent
hev
endor
swi
l
lpr
ovi
det
hecaseno.f
orf
utur
eref
erence.
(
d)Theywi
l
lal
soasksr
ackno.sy
stem no.t
orepl
acet
hememor
y.
(
e)wewi
l
linf
ormt
hedat
acent
repeopl
etoco-
ordi
nat
ewi
tht
hev
endor
.
30.Whati
syourr
olei
nDBpat
chi
ng?
I
nDat
abasepat
chi
ngt
hef
oll
owi
ngt
eamswi
l
lbei
nvol
ved.
(
i)Dat
abaseAdmi
nist
rat
or(
DBA)t
eam.
(
ii
)Li
nuxAdmi
nist
rat
orst
eam.
(
ii
i)Moni
tor
ingt
eam.
(
iv)Appl
i
cat
iont
eam.
(
i)DBAt
eam :
Thi
sist
het
eam t
oappl
ythepat
chest
othedat
abases.
(
ii
)Li
nuxt
eam :
Thi
steam i
sal
soi
nvol
vedi
fanypr
obl
emsoccur
.Ift
hedat
abasev
olumei
shav
inga
mi
rr
orweshoul
dfi
rst br
eakt
hemi
rr
orandt
hent
heDBApeopl
ewi
l
lappl
ythe
pat
ches.Af
ter1or2day
sther
eisnopr
obl
em agai
nweneedsy
nct
hedat
a
bet
weenmi
rr
oredv
olumet
opat
chappl
i
edv
olume.I
fther
eisnospacef
or
pat
chwehav
etopr
ovi
despacet
oDBAt
eam.
(
ii
i) Moni
tor
ingt
eam :
Thi
steam shoul
drecei
ver
equest
sorsuggest
ionst
oignor
eanypr
obl
emsoccur
s.
Af
terappl
i
edt
hepat
chi
f t
hesy
stem i
saut
omat
ical
l
yreboot
edt
henmoni
tor
ing
t
eam wi
l
lrai
set
het
icket"
Nodedown"t
osy
stem admi
nist
rat
orst
eam.So,
t
oav
oidt
hoset
ypeoft
icket
swehav
etosentr
equest
stoi
gnor
ethoset
ypeal
ert
s.
(
iv) Appl
icat
iont
eam :
Forappl
yi
nganypat
ches,t
hedat
abasesshoul
dnotbeav
ail
abl
etoappl
i
cat
ion.So,
if
suddenl
ydat
abasei
s notav
ail
abl
ethenappl
i
cat
ionmaybecr
ashed.So,
fir
stt
he
appl
i
cat
ionshoul
dbest
opped.Thi
swi
l
lbedone byappl
i
cat
iont
eam.
31.Whati
sSLA?
Aser
vice-
lev
elagr
eement(
SLA)i
ssi
mpl
yadocumentdescr
ibi
ngt
hel
evel
ofser
vice
expect
edbyacust
omer f
rom asuppl
i
er,
lay
ingoutt
hemet
ri
csbywhi
cht
hatser
vicei
s
measur
edandt
her
emedi
esorpenal
ti
es,
ifany
, shoul
dtheagr
eed-
uponl
evel
snotbe

Rat
nakar
Page232
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

achi
eved.Usual
l
y,SLAsar
ebet
weencompani
esandext
ernal
suppl
i
ers, butt
heymayal
so
bebet
weent
wodepar
tment
swi
thi .
nacompany
32.Whati
sPr
obl
em Management
?
Theobj
ect
iveofPr
obl
em Managementi
stomi
nimi
zet
hei
mpactofpr
obl
emsont
he
or
gani
sat
ion.Pr
obl
em Managementpl
aysani
mpor
tantr
olei
nthedet
ect
ionand
pr
ovi
dingsol
uti
onst
opr
obl
ems(
wor
kar
ound& knowner
ror
s)andpr
event
sthei
r
r
eoccur
rence.
A'
Probl
em'
ist
heunknowncauseofoneormor
einci
dent
s,of
teni
dent
if
iedasar
esul
t
ofmul
ti
plesi
mil
ar
i
nci
dent
s.A'
Knowner
ror
'isani
dent
if
iedr
ootcauseofaPr
obl
em.
33.Whati
sInci
dentManagement
?
An'
I
nci
dent
'i
sanyev
entwhi
chi
snotpar
toft
hest
andar
doper
ati
onoft
heser
viceand
whi
chcausesormaycause,
ani
nter
rupt
ionorar
educt
ionoft
hequal
i
tyoft
heser
vice.
Theobj
ect
iveofI
nci
dentManagementi
stor
est
orenor
mal
oper
ati
onsasqui
ckl
yas
possi
blewi
tht
hel
east possi
blei
mpactonei
thert
hebusi
nessort
heuser
,atacost
-
ef
fect
ivepr
ice.
I
nput
sforI
nci
dentManagementmost
lycomef
rom user
s,butcanhav
eot
hersour
ces
aswel
ll
ikemanagement I
nfor
mat
ionorDet
ect
ionSy
stems.Theout
put
soft
hepr
ocess
ar
eRFC’
s(Request
sforChanges)
,resol
vedand cl
osedI
nci
dent
s,management
i
nfor
mat
ionandcommuni
cat
iont
othecust
omer
.

34.Whati
sChangeManagement
?
Changemanagementi
sasy
stemat
icappr
oacht
odeal
i
ngwi
thchange,
bot
hfr
om t
he
per
spect
iveofan or
gani
zat
ionandont
hei
ndi
vi
dual
lev
el 
.changemanagementhasat
l
eastt
hreedi
ff
erentaspect
s,i
ncl
udi
ng adapt
ingt
ochange,
 
cont
rol
l
ingchange,
and
ef
fect
ingchange.Apr
oact
iveappr
oacht
odeal
i
ngwi
thchangei
sat t
hecor
eofal
l
t
hreeaspect
s.I
nani
nfor
mat
iont
echnol
ogy(
IT)sy
stem env
ironment
,changemanagement
r
efer
stoasy
stemat
icappr
oacht
okeepi
ngt
rackoft
hedet
ail
soft
hesy
stem (
forex
ampl
e,
what
 oper
ati
ng sy
stem 
rel
easei
srunni
ngoneachcomput
erandwhi
ch 
fi
xes 
hav
e
beenappl
i
ed)
.
35.Whati
sRequestManagement
?
ser
vicer
equestmanagement(
SRM)i
stheunder
lyi
ngwor
kfl
owandpr
ocessest
hat
enabl
eanI
Tpr
ocur
ementorser
vicer
equestt
ober
eli
abl
ysubmi
tt
ed,
rout
ed,
appr
oved,
moni
tor
edanddel
i
ver
ed.SRM i
sthepr
ocessof managi
ngaser
vicer
equestt
hroughi
ts
l
i
fecy
clef
rom submi
ssi
ont
hroughdel
i
ver
yandf
oll
ow-
up.
 
SRM maybemanual
oraut
omat
ed.I
namanual
syst
em,
ausercal
l
sahel
pdeskt
o
r
equestaser
vice,
andhel
p deskper
sonnel
creat
easer
vicet
ickett
orout
etheser
vice
r
equest
.Inanaut
omat
edsy
stem,
theusersubmi
tsa r
equestt
hroughanonl
i
neser
vice
cat
alog,
andt
heappl
i
cat
ionsof
twar
eaut
omat
ical
l
yrout
est
her
equest t
hrought
he
appr
opr
iat
epr
ocessesf
orappr
oval
andser
vicedel
i
ver
y.Thesesy
stemsal
sot
ypi
cal
l
yenabl
e

Rat
nakar
Page233
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

user
stot
rackt
hest
atusoft
hei
rser
vicer
equest
s,andmanagementt
omoni
torser
vice
del
i
ver
ylev
elsf
orqual
i
ty cont
rol
pur
poses.
36.Whati
sgr
ep?
(
i)gr
ep meansGl
obal
l
ysear
chf
orRegul
arExpr
essi
on.
(
ii
)Usi
nggr
epwecanf
il
tert
her
esul
tst
ogetapar
ti
cul
ari
nfor
mat
ion.
(
ii
i) Wecangetonl
yinf
ormat
ionaboutwhatst
ri
ngwehav
especi
fi
edi
ngr
ep
command.
37.Whatar
epi
pesandf
il
ter
sinLi
nux?
Pi
pes:
(
a)Pi
pesar
enot
hingbutaddi
ngt
wocommandsandmakeasonecommand.
(
b)Nor
mal
l
ywecannotcombi
net
wocommands,
butusi
ngpi
peswegetonecommand
bycombi
ningt
wo commands.
(
c)So,
wecangett
her
esul
tsaswhatwer
equi
red.
Fi
lt
ers:
(
a)Fi
l
ter
sar
enot
hingbutf
il
ter
ingt
her
esul
tswhatwer
equi
red.
(
b)Usi
ngf
il
ter
swecangetex
actr
esul
tsdependsuponwhatwespeci
fi
edi
nthe
expr
essi
on.
(
c)So,
ther
eisnowast
ageoft
imebecausei
tfi
l
ter
sresul
tswhatwespeci
fi
edi
nthe
commandexpr
essi
on.
38.Whati
sthef
ull
for
m ofCOMPUTER?
C -
--
--
>Commonl
y
O -
--
--
> Oper
ated
M -
--
--
> Machi
ne
P -
--
--
> Par
ti
cul
arl
y
U -
--
--
>Used
T -
--
--
>Techni
cal
and
E -
--
--
>Educat
ional
R-
--
--
> Resear
ch
39.Whati
sthecommandi
nsart
omoni
torNI
Cdev
icesr
ecei
ved/
transmi
tt
edpacket
s?
#sar-
nDEV15 
Thi
swi
l
lshow5consecut
iveout
puteachwi
that
imei
nter
val
of1secf
oral
ltheet
her
net
dev
ices
40.Whati
sLi
nuxKer
nel
?
I
tact
sasani
nter
pret
erbet
ween 
LinuxOS 
andi
ts 
har
dwar
e.I
tist
hef
undament
al
componentofLi
nuxOSand cont
ainshar
dwar
edr
iver
sfort
hedev
icesi
nst
all
edont
he
sy
stem.Theker
nel
isapar
toft
hesy
stem whi
chl
oads f
ir
standi
tst
aysont
hememor
y.
41.Whatar
ethemai
npar
amet
ersef
fectonser
verper
for
mance?
Theoneoft
hemosti
mpor
tantt
askofanyLi
nuxAdmi
nincl
udesper
for
mance
moni
tor
ingwhi
chi
ncl
udesa par
amet
er"
Load 
Aver
age"or"
CPU 
Load"
.
42.Whati
sloadav
erage?

Rat
nakar
Page234
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

LoadAv
erage 
i
sthev
aluewhi
chr
epr
esent
sthel
oadony
oursy
stem f
oraspeci
fi
c
per
iodoft
ime.Al
soi
tcanbeconsi
der
edt
her
ati
ooft
henumberofact
ivet
askst
othe
numberofav
ail
abl
eCPUs.
43.Howt
ocheck?
Wecanuseei
thert
oporupt
imecommandt
ovi
ewt
heout
putoft
hel
oadav
erageas
shownbel
ow.
#upt
ime
 
00:
07:
00up4day
s, 
6:14,
 1user
, l
oadav
erage:
0.11,
0.14,
0.09
#t
op
t
op-00:
07:
12up4day
s, 
6:15,
 1user
, l
oadav
erage:
0.09,
0.13,
0.09
44.Whatar
ethet
hreev
alues?
Asy
oucanseet
hreev
aluesr
epr
esent
ingt
hel
oadav
eragecol
umn.Theseshowt
hel
oad
ony
oursy
stem ov
era si
gni
fi
cantper
iodoft
ime(
oneorcur
rent
,fi
veandf
if
teen
mi
nut
esav
erages)
.
45.Howdoy
ouknowy
oursy
stem hasahi
ghl
oad?
Themosti
mpor
tantquest
ionasi
nmostcasesIhav
eseenhowdoy
oudet
ermi
ney
our
sy
stem hashi
ghl
oad.
Doesahi
ghv
aluer
epr
esent
shi
ghl
oadav
erageandt
haty
oursy
stem r
equi
resat
tent
ion?
Whati
sthet
hreshol
dval
uef
orl
oadav
erage?
Howcanweconcl
udei
fthel
oadav
eragev
aluei
sgoodorbad?
ACent
ral
Processi
ngUni
tinear
li
erday
susedt
obehav
ingonl
yonepr
ocessorandt
he
cor
econceptwasnott
hei
rint
hoseday
s.Butwi
tht
headv
ancementi
ntechnol
ogyand
t
he 
urge 
ofhi
gherspeedt
omeetupdemands ofI
Tindust
rymul
ti
plepr
ocessorwer
e
i
ntegr
atedi
nthesameCPUmaki
ngi
tmul
ti
-pr
ocessor
.
Howev
er 
i
ncr
easi
ng 
theno.ofpr
ocessordi
dincr
easedt
hewor
kingspeedofmanyt
asks
andper
for
mancebuti
t al
sol
eadst
oincr
easei
nsi
ze,
compl
exi
tyandheati
ssues.So,
i
nor
dert
ocont
inuei
mpr
ovementofper
for
mance t
hecor
econceptwasi
ntr
oduced.
I
nst
eadofhav
ingt
woCPUsandamot
her
boar
dcapabl
eofhost
ingt
hem,
twoCPUSar
e
t
akent
oget
herand combi
nedt
ofor
m a 
dual
cor
epr
ocessor
 whi
chwi
l
lut
il
izeani
ndi
vi
dual
socketusi
ngl
esspowerandsi
zecapabl
e ofper
for
mingt
hesameamountoft
askasdual
pr
ocessorCPU.
Bot
tom Li
ne 
i
sthatLoadv
aluedependsont
heno.ofcor
esi
nyourmachi
ne.For
exampl
eadual
cor
eisr
elev
ant t
o2pr
ocessoror2cor
esandquadcor
eisr
elev
antt
o4
pr
ocessororf
ourcor
esast
hemax
imum v
aluef
orl
oad.
46.HowdoIcheckt
heno.ofcor
esonmyLi
nuxsy
stem?
Thei
nfor
mat
ionwhi
chy
ouseeunder
 /
proc/
cpui
nfo 
canbeconf
usi
ngatt
imes.I
fyou
r
unt
hebel
owcommand
#l
ess/
proc/
cpui
nfo|
greppr
ocessor
pr
ocessor 
  :
0
pr
ocessor 
  :
1

Rat
nakar
Page235
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

pr
ocessor 
  :
2
pr
ocessor 
  :
3
pr
ocessor  
 :4
pr
ocessor 
  :
5
Soaspert
heabov
ecommandmysy
stem has16pr
ocessor
sini
t.Howev
eri
treal
l
yhas
8pr
ocessor
swi
th hy
per
 t
hreadi
ng 
enabl
ed.Thehy
pert
hreadi
ng 
present
s 2l
ogi
cal
CPUs
t
otheoper
ati
ngsy
stem f
oreachact
ual cor
esoi
tef
fect
ivel
ydoubl
est
heno.ofl
ogi
cal
CPUi
nyoursy
stem.
47.Howt
ofi
ndi
fhy
pert
hreadi
ngi
senabl
ed
Lookoutf
or"
ht"i
nthe 
fl
ags 
sect
ioni
nsi
decpui
nfowi
tht
hebel
owcommand
#l
ess/
proc/
cpui
nfo|
grepf
lags|
uni
q|gr
ep-
i "
ht"
f
lags:f
puv
medepset
scmsrpaemcecx8api
csepmt
rrpgemcacmovpatpse36
cl
fl
ushdt
sacpi
mmxf
xsrsse sse2ss 
ht 
tm sy
scal
lnxr
dtscpl
m const
ant
_tsc
nonst
op_
tscpni
moni
tords_
cpl
vmxestt
m2ssse3cx16x
tpr sse4_
1sse4_
2popcnt
l
ahf
_lm.
Thef
iel
dsweneedt
ocompar
etof
indt
heno.ofcor
ear
e"phy
sicali
d"and"
cor
eid"
.Run
t
hebel
owcommand
#l
ess/
proc/
cpui
nfo|
grep"
phy
sical
id"|
sor
t|
uni
q|wc-
l
2
#l
ess/
proc/
cpui
nfo|
grep"
cor
eid"|
sor
t|
uni
q|wc-
l
4
Sot
heno.ofcor
eswoul
dbe 
2x4=8cor
es.
48.Whatdoy
ouunder
standt
heLoadAv
erage?
I
fthenumberofact
ivet
asksut
il
izi
ngCPUi
slessascompar
edt
oav
ail
abl
eCPUcor
es
t
hent
hel
oadav
eragecan beconsi
der
ednor
mal
buti
ftheno.ofact
ivet
asksst
art
s
i
ncr
easi
ngwi
thr
espectt
oav
ail
abl
eCPUcor
est
hent
he l
oadav
eragewi
l
lst
artr
isi
ng.
For
exampl
e,
#upt
ime
 
00:
43:
58up212day
s,14:
19,
 4user
s, 
l
oadav
erage:
6.07,
7.08,
8.07
49.Howt
ocheckal
lthecur
rentr
unni
ngser
vicesi
nLi
nux?
Tof
indt
hest
atusofany
 si
ngl
eser
vice:
#ser
vicev
sft
pdst
atus
v
sft
pd(
pid5909)i
srunni
ng.
..
Togett
hest
atusofal
lther
unni
ngser
vices:
#ser
vice-
-st
atus-
all
 

grepr
unni
ng
acpi
d(pi
d5310)i
srunni
ng.
..
at
d(pi
d 6528)i
srunni
ng.
..
audi
td(
pid 
5012)i
srunni
ng.
..
Av
ahi
 
daemon 
i
snotr
unni
ng
Av
ahi
DNSdaemoni
snotr
unni
ng

Rat
nakar
Page236
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

ThePegasus 
CIM 
List
eneri
srunni
ng.
ThePegasusCI
M Obj
ectManageri
srunni
ng.
cr
ond(
pid 
6242)i
srunni
ng.
..
dcer
pcd(
pid 
5177)i
srunni
ng.
..
ev
ent
logd(
pid 
5223)i
srunni
ng.
..
I
ncasey
oudon'
tusegr
epy
ouwi
llbeabl
etoseeal
ltheser
vicesony
our
 machi
ne:
#ser
vice-
-st
atus-
all
Net
wor
kManageri
s st
opped
acpi
d(pi
d5310)i
srunni
ng.
..
anacr
oni
s st
opped
at
d(pi
d 6528)i
srunni
ng.
..
audi
td(
pid 
5012)i
srunni
ng.
..
aut
omounti
s st
opped
Av
ahi
daemoni
snotr
unni
ng
Av
ahi
DNSdaemoni
snotr
unni
ng
hci
dis 
stopped
sdpdi
s st
opped
Youcanal
socheckt
he 
act
ive 
por
tsal
ongwi
tht
hei
rser
vicesusi
ng:
#net
stat-
ntl
p
Act
iveI
nter
netconnect
ions(
onl
yser
ver
s)
Pr
otocol Recv
-QSend-
QLocal
Addr
ess For
eignAddr
ess
St
ate PI
D/Pr
ogr
am name
t
cp 
     
0   
00.
0.0.
0:52961  
   0.
0.0.
0:*    
  LI
STEN 
 
 
5223/
event
logd
t
cp   
  0  
 00.
0.0.
0:5988  
    0.
0.0.
0:* 
     LI
STEN  
 
6116/
cimser
ver
t
cp   
  0  
 00.
0.0.
0:5989  
   0.
0.0.
0:* 
     LI
STEN  
 
6116/
cimser
ver
t
cp  
   0  
 00.
0.0.
0:678  
    0.
0.0.
0:* 
     LI
STEN  
 
5160/
rpc.
stat
d
t
cp   
  0  
 00.
0.0.
0:14247   
  0.
0.0.
0:* 
     LI
STEN  
 
6460/
jav
a
t
cp   
  0  
 0127.
0.0.
1:199   
  0.
0.0.
0:* 
     LI
STEN  
 
5857/
snmpd
t
cp   
  0  
 00.
0.0.
0:135  
    0.
0.0.
0:* 
     LI
STEN  
 
5177/
dcer
pcd
50.Howdoy
oucheckLi
nuxmachi
nei
sPhy
sical
orVi
rt
ualr
emot
ely
?
Ther
eisnohar
dandf
astr
ulet
ocheckwhet
hert
hemachi
nei
s phy
sical
 
orv
irt
ual
butst
il
l
wedohav
esome commandswhi
chcanbeusedf
ort
hesamepur
pose.
Thecommandusedt
ovi
ewal
lther
equi
redhar
dwar
erel
atedi
nfor
mat
ionf
oranyLi
nux

Rat
nakar
Page237
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

machi
nei
s
#dmi
decode
Butt
heout
putwoul
dbev
eryl
ongandhar
dtof
indoutt
hespeci
fi
cdet
ail
slooki
ngf
or.So,
l
et'
snar
rowi
tdown.
Phy
sicalSer
ver
s:
#dmi
decode-
ssy
stem-
product
-name
Sy
stem x
3550M2-
[7284AC1]
-
Nowt
ogetmor
edet
ail
saboutt
hesy
stem
#dmi
decode|
less 
(Andsear
chf
or"
Syst
em I
nfor
mat
ion"
)
Sy
stem I
nfor
mat
ion
   
  Manuf
act
urer

IBM
   
  Pr
oductName:
 
Syst
em x3550M2-
[7284AC1]
-
   
  Ver
sion:
00
   
  Wake-
upTy
pe:
Other
   
  SKUNumber
:XxXxXxX
   
   Fami
l
y:Sy
stem x
Vi
rt
ualSer
ver
s:
#dmi
decode-
ssy
stem-
product
-name
VMwar
eVi
rt
ual
Plat
for
m
#dmi
decode|
less
Sy
stem I
nfor
mat
ion
   
  Manuf
act
urer

VMwar
e,I
nc.
   
  Pr
oductName:
 
VMwar
eVi
rt
ual
Plat
for
m
   
  Ver
sion:
None
   
  Wake-
upTy
pe:
PowerSwi
tch
   
  SKUNumber
:NotSpeci
fi
ed
Fami
l
y:NotSpeci
fi
ed
Onav
irt
ualser
verr
unni
ngVMwar
eyoucanr
unt
hebel
owcommandt
over
if
y:
#l
spci
|gr
ep-
ivmwar
e
00:
0f.
0VGA 
compat
ibl
e cont
rol
l
er:
VMwar
eSVGAI
IAdapt
er
51.Howt
ofi
ndt
he 
bit
 si
zeofy
ourl
inuxmachi
ne?
#uname-
m
i
686
#uname-
m
x86_
64
I
fweget
 i
386,
 
i586 
and 
i
686 
thatsi
gni
fi
esy
ourmachi
nei
s32-
bitbuti
fwe
get
x86_
64 
or 
i
a64 
theny
our machi
newi
l
lbe64-
bit
.
#get
confLONG_
BIT
32
#get
confLONG_
BIT

Rat
nakar
Page238
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

64 (
Her
ewegetanout
putofbi
tsi
zeei
ther32or64)
52.Howcany
ouaddabannerorl
ogi
nmessagei
nLi
nux?
Byedi
ti
ngt
heset
wof
il
es
/
etc/
issue
/
etc/
mot
d
53.Whati
sthedi
ff
erencebet
weennor
mal
ker
nelandker
nel
-PAE?
ker
nel
in32bi
tmachi
nesuppor
tsmaxof4 
GBRAM,
wher
eas
ker
nel
PAEi
n32bi
tli
nuxmachi
nesuppor
tst
il
l64GBRAM
54.Tel
lmet
hecommandt
ofi
ndal
lthecommandsi
nyourl
inuxmachi
nehav
ingonl
y2
wor
dsl
i
kel
s,cp,
cdet
c.
#f
ind/
bin/
sbi
n/usr
/bi
n/usr
/sbi
n-name?
?-t
ypef
55.Whi
chf
il
eisgener
all
yusedt
oconf
igur
eki
ckst
art
?
anaconda.
cfg
56.Whi
chl
ogf
il
ewi
l
lyoucheckf
oral
laut
hent
icat
ionr
elat
edmessages?
/
var
/l
og/
secur
e
57.Whati
sthecommandusedt
ofi
ndt
hepr
ocessr
esponsi
blef
orapar
ti
cul
arr
unni
ngf
il
e?
#f
user
 f
il
ename
#l
soff
il
ename
58.Whati
sthecommandt
otaker
emot
eofanyLi
nuxmachi
ne?
#r
deskt
op
59.Whatar
ethet
hreev
aluesshowni
nloadav
eragesect
ionoft
opcommand?
I
tshowst
hecur
rent
,5mi
nbackand15mi
nbackl
oadav
eragev
alue.
60.Howt
ocheckal
lthepr
ocessr
unni
ngbyapar
ti
cul
aruser
?
#ps-
u<user
name>
61.Whati
sanor
phanpr
ocess?
Anor
phanpr
ocessi
sapr
ocesst
hati
sst
il
lexecut
ing,
butwhosepar
enthasdi
ed.
62.Whati
sadef
unctpr
ocess?
Thesear
eal
sot
ermedaszombi
epr
ocess.Thesear
ethosepr
ocesswhohav
e
compl
etedt
hei
rexecut
ionbutst
il
l hasanent
ryi
nthepr
ocesst
abl
e.Whenapr
ocessends,
al
loft
hememor
yandr
esour
cesassoci
atedwi
thi
tar
e de-
all
ocat
edsot
heycanbeused
byot
herpr
ocesses.
Aft
ert
hezombi
eisr
emov
ed,
itspr
ocessi
dent
if
ier(
PID) andent
ry
i
nthepr
ocesst
abl
ecant
henber
eused.
Zombi
escanbei
dent
if
iedi
ntheout
putf
rom t
heUni
xpscommandbyt
hepr
esenceofa
"
Z"i
nthe"
STAT" col
umn
63.Howdoy
oul
imi
tmaxi
mum connect
ionsi
nyourapacheser
ver
?
Changet
hebel
owpar
amet
erv
aluei
nsi
de 
htt
pd.
conf
MaxCl
i
ent
s256
64.Whi
chcommanddoy
ouuset
odownl
oadaf
il
efr
om f
tporht
tpwebsi
teusi
ngCLI
?
#wget
 pat
h_t
o_t
he_
fil
e
65.Whati
sthedef
aul
tpor
tforssh?Howwi
lly
ouchangei
ttosomeot
herr
andom por
tno.
?

Rat
nakar
Page239
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

SSHpor
tno.bydef
aul
tis22.Tochanget
hedef
aul
tpor
tno.weneedmaker
equi
red
changesi
nsi
desshd_
conf
igf
il
eint
hebel
owment
ionedl
i
ne
#Por
t22 (
Uncommentt
heabov
eli
neanddef
inet
henewpor
tno)
Rest
artt
heser
vicesf
orchangest
otakeef
fect
.
66.Whati
sthedi
ff
erencebet
weenAr
ecor
dand 
CNAME 
recor
dinDNS?
Ar
ecor
d:
 I
tist
heAddr
essr
ecor
dsal
soknownashostr
ecor
ds
 Poi
ntst
otheI
Paddr
essr
efl
ect
ingt
hedomai
n
 Usedf
orf
orwar
dlookupofanydomai
nname
Forexampl
e:
Ourwebsi
tei
sconf
igur
edon50.
63.
202.
15I
Psot
heAr
ecor
dof
 mydomai
nname 
wil
l
poi
ntt
owar
dst
hatI
P.
Ev
eryt
imeaquer
yforgol
i
nuxhub.
com i
smadet
hei
nter
netwi
l
llookupf
orcont
ent
s
st
oredont
hemachi
newi
th 50.
63.
202.
15t
hisI
P.
CNAMERecor
d:
 I
tisshor
tabbr
evi
ati
onf
orCanoni
cal
Name
 Pr
ovi
desanal
i
asnamef
orsamehost
name
 Hel
pscr
eat
esubdomai
ns
NOTE:
 Youcannotcr
eat
eaCNAMEr
ecor
dfort
hedomai
nnamei
tsel
f(i
tshoul
dbedone
wi
thAr
ecor
d)
Forexampl
e:
gol
i
nuxhub.
com 
i
sadomai
nnamewher www.
eas  gol
i
nuxhub.
com 
i
sasubdomai
n
name.

28.Ki
ckst
artI
nst
all
ati
onandPXE(
Net
wor
k)I
nst
all
ati
on

1. Whati
sKi
ckst
arti
nst
all
ati
on?
I
nst
all
ati
onofRedHatLi
nuxi
nnon-
int
eract
ivemodei
scal
l
edt
heKi
ckst
arti
nst
all
ati
on.
Manysy
stem admi
nist
rat
orswoul
dpr
efert
ouseanaut
omat
edi
nst
all
ati
onmet
hodt
o
i
nst
allRedHat Ent
erpr
iseLi
nuxont
hei
rmachi
nes.Usi
ngki
ckst
art
,asy
stem
admi
nist
rat
orcancr
eat
easi
ngl
efi
l
econt
aini
ng t
heanswert
oal
lthequest
ionst
hat
woul
dnor
mal
l
yaskeddur
ingat
ypi
cal
inst
all
ati
on.
Ki
ckst
artf
il
escanbekeptonasi
ngl
eser
versy
stem andr
eadbyi
ndi
vi
dual
comput
ers
dur
ingt
hei
nst
all
ati
on.Thi
s i
nst
all
ati
onmet
hodcansuppor
ttheuseofasi
ngl
eki
ckst
art
f
il
etoi
nst
all
RedHatEnt
erpr
iseLi
nuxonmul
ti
ple machi
nes,
maki
ngi
tideal
fornet
wor
k
andsy
stem admi
nist
rat
ors.
Thedef
aul
tKi
ckst
arti
nst
all
ati
onf
il
eisanaconda-
ks.
cfg.

Rat
nakar
Page240
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

2. Whatar
ethemi
nimum r
equi
rement
sforki
ckst
arti
nst
all
ati
on?
(
i)RedHatEnt
erpr
iseLi
nux-5,6or7I
SOi
magef
il
ewi
thf
ull
pat
h.
(
ii
)Ki
ckst
arti
nst
all
ati
onf
il
eli
keanaconda-
ks.
cfgoroutcust
om ki
ckst
arti
nst
all
ati
on
f
il
e.
(
ii
i)Copyt
heO/
SISOi
magef
il
ebyconf
igur
ingt
heki
ckst
art
.
(
iv)Av
ail
abi
l
ityofi
nst
all
ati
onmedi
ator
emot
esy
stemst
hroughNFS,FTP orHTTP
3. Howt
oset
upt
heKi
ckst
arti
nst
all
ati
onser
ver
?
(
i)I
nst
all
the sy
stem-
conf
ig-
kickst
artpackageby #y
um i
nst
allsy
stem-
conf
ig-
ki
ckst
art-
y command.
(
ii
)Cr
eat
eaki
ckst
arti
nst
all
ati
onf
il
einGUImode.
#sy
stem-
conf
ig-
kickst
art (
thi
scommandwi
l
ldi
spl
ayt
heki
ckst
art
conf
igur
ati
onwi
ndow)
(
ii
i)Basi
cConf
igur
ati
on i
sthef
ir
stopt
ioni
ntheki
ckst
artconf
igur
ati
onwi
ndow and
wehav
etochooset
he f
oll
owi
ngopt
ionsi
nthi
s.
(
a)Sel
ectt
hedef
aul
tlanguage(
forexampl
e Engl
i
sh)
.
(
b)Sel
ectt
heKey
boar
dty
pe(
forexampl
eUSEngl
i
sh)
.
(
c)Sel
ectt
heTi
mezone(
forex
ampl
eAsi
a/Kol
kat
a).
(
d)Ty
pet
heRootpasswor
dandRe-
typet
hesamet
oconf
ir
mther
ootpasswor
d.
(
e)Sel
ectt
heTar
getAr
chi
tect
ure(
x86_
64or32bi
t)
(
iv)I
nst
all
ati
onMet
hod i
sthesecondopt
ion.
(
a)I
nst
all
ati
onMet
hod. (
Sel
ectanyone
opt
ion)
(
1)Per
for
m New I
nst
all
ati
on
(
2)Upgr
adeanexi
sti
ngi
nst
all
ati
on
(
b)I
nst
all
ati
onSour
ce. (
Sel
ectany
oneopt
ion)
(
1)CD-
ROM/
DVD
(
2)NFS
(
3)FTP
(
4)HTTP
(
5)Har
dDr
ive
(
v)BootLoaderopt
ions i
sthenex
topt
ioni
nki
ckst
artconf
igur
ati
on.
(
a)Sel
ectI
nst
allNewBootLoader opt
ion.
(
vi)Par
ti
ti
onI
nfor
mat
ion i
sthenextopt
ion.
(
a)Mast
erBootRecor
d (
Sel
ectany
oneopt
ion)
(
1)Cr
eat
eMast
erBootRecor
d
(
2)Donotcr
eat
eMast
erBootRecor
d
(
b)Par
ti
ti
ons (
Sel
ectanyone
opt
ion)

Rat
nakar
Page241
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
1)Remov
eal
lexi
sti
ngpar
ti
ti
ons
(
2)Remov
eexi
sti
ngLi
nuxpar
ti
ti
ons
(
3)Pr
eser
veexi
sti
ngpar
ti
ti
ons
(
c)Di
skLabel (
Sel
ectanyone
opt
ion)
(
1)I
nit
ial
i
zet
hedi
skl
abel
(
2)Donoti
nit
ial
i
zet
hedi
skl
abel
(
d)Sel
ectAddbut
tonandsel
ectMountpoi
nt,Fi
l
esy
stem t
ypeandSi
zest
o
cr
eat
ethepar
ti
ti
ons.
(
vii
)Net
wor
kConf
igur
ati
on i
sthenextopt
ion.
(
a)Sel
ectAddNet
wor
kDev
icet
oaddt
heNI
C dev
ice,conf
igur
etheI
Paddr
ess
ei
therDHCP orSt
ati
c andsel
ectenabl
etheNI
C atboott
imeornot
.
(
vii
i
)Aut
hent
icat
ion i
sthenextopt
ion.
Sel
ectt
heaut
hent
icat
ionmechani
sm l
i
keShadowpasswor
ds,NI
S,LDAP or
Ker
ber
os.
..et
c.,
(
ix)Fi
rewal
lConf
igur
ati
on i
sthenextopt
ion.
Sel
ectwhet
heract
ivat
etheSELi
nuxornot
,Secur
it
yLev
elandFi
rewal
l
I
nfor
mat
ion.
(
x)Di
spl
ayConf
igur
ati
on i
sthenex
topt
ion.
Sel
ectt
hedi
spl
ayconf
igur
ati
onoft
heO/
Sei
therGUIorCLImode.
(
xi)PackageSel
ect
ion i
sthenextopt
ion.
Sel
ectt
her
equi
redpackagesf
ori
nst
all
ati
on. (
wecannotsel
ect
t
hepackagesi
nRHEL-7)
(
xii
)and(
xii
i
)Pr
e-I
nst
all
ati
onScr
ipt
sandPost
-I
nst
all
ati
onScr
ipt
sar
ethel
ast
opt
ions.
I
fwehav
eanyPr
e-i
nst
all
ati
onorPost
-i
nst
all
ati
onscr
ipt
s,t
henwehav
etospeci
fy
t
hel
ocat
ionsoft
hose.
(
xiv
)Sav
ethi
sfi
ebysel
ectt
heSav
eopt
ioni
nFi
l
emenu.
(
xv)Exi
tfr
om t
heKi
ckst
artConf
igur
ati
onwi
ndowbysel
ectt
heQui
topt
ioni
nFi
l
emenu.
(
xvi
)Opent
heki
ckst
artf
il
eandt
hedef
aul
tki
ckst
artf
il
eatt
imebyt
hef
oll
owi
ng
command.
#v
im-
O <ki
ckst
artf
il
e><anacondaf
il
e>
Got
opackagesect
ioni
nanacondaf
il
e,copyt
hesel
ectt
hepackagesandpast
e
t
hem i
ntheki
ckst
artf
il
e.
(
xvi
i
)Checkt
heki
ckst
artf
il
eforsy
ntaxer
ror
sby #ksv
ali
dat
or<ki
ckst
artf
il
e>
command.
(
xvi
i
i)I
nst
all
thewebser
verpackageby#y
um i
nst
allht
tpd* -
y command.
(
xix)Copyt
heki
ckst
artf
il
einDocumentRootoft
hewebser
verandpr
eser
vert
he
per
missi
ons.
#cp -
p <ki
ckst
artf
il
e> /
var
/www/
html
/

Rat
nakar
Page242
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
xx)Rest
artt
hewebser
verdeamonsi
nRHEL-6andRHEL-7.
#ser
viceht
tpdr
est
art (
tor
est
artt
hewebser
verdeamoni
n
RHEL-6)
#chkconf
ig ht
tpdon (
toenabl
ethewebser
verdeamon
atnextbooti
nRHEL-6)
#sy
stemct
lrest
artht
tpd (
tor
est
artt
hewebser
verdeamoni
n
RHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
ethewebser
verdeamonatnext
booti
nRHEL-7)
(
xxi
)Addt
hewebser
verser
vicet
oIPt
abl
esandFi
rewal
l
.
I
nRHEL-6:
#set
up
Sel
ectFi
rewal
lconf
igur
ati
on -
--
--
> Sel
ectHTTP andHTTPSt
othef
ir
ewal
l
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
#chkconf
igi
ptabl
eson
I
nRHEL-7:
#f
ir
ewal
l-
cmd -
-per
manent -
-add-
ser
vice=ht
tp
#f
ir
ewal
l-
cmd -
-per
manent -
-add-
ser
vice=ht
tps
#f
ir
ewal
l-
cmd -
-compl
ete-
rel
oad
4. Howt
oinst
all
oncl
i
entsy
stem usi
ngki
ckst
artf
il
e?
(
i)Boott
hecl
i
entsy
stem usi
ngRHEL-6DVD andpr
essEsckey
.
(
ii
)Theni
tpr
ompt
susboot:scr
een.
(
ii
i)Ty
pet
hef
oll
owi
ngi
nfor
mat
ionaboutt
heki
ckst
artf
il
e,i
tsser
verandal
soassi
gn
someI
Paddr
esst
othe cl
i
entsy
stem t
ocommuni
cat
ewi
thki
ckst
artser
ver
.
boot:l
inux i
p=<I
Paddr
esst
othecl
i
ent
> net
mask=<net
maskoft
hatI
P>
ks=f
tp:
//<I
Paddr
essoft
he ki
ckst
artser
ver
>/<ki
ckst
artf
il
enamewi
thf
ull
pat
h> (
pressEnt
erkey
)
* Thent
hei
nst
all
ati
onwi
l
lcont
inuebyt
aki
ngt
hei
nst
all
ati
oni
nfor
mat
ionf
rom t
he
ki
ckst
artf
il
e.
5. I
nhowmanyway
scanwei
nst
allRedHatLi
nuxt
hroughnet
wor
k?
(
i)FTP
(
ii
)NFS
(
ii
i)HTTP
(
iv)PXE
6. Howt
oinst
all
RedHatLi
nuxt
houghFTP?
(
i)Fi
rstconf
igur
etheFTPser
verandcopyt
heent
ir
eRedHatLi
nuxDVDi
nthatFTP
documentr
ootdi
rect
ory
.
(
ii
)Inst
all
ati
onofLi
nuxt
hroughnet
wor
krequi
resoneboot
.i
soi
mageorRHELDVD.
TomakeaDVD/
Pendr
iveboot
abl
eusi
ngboot
.i
soi
mage:

Rat
nakar
Page243
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
a)Downl
oadt
heboot
.i
soi
magef
rom r
edhatwebsi
te.
#cdr
ecor
d /
root
/boot
.i
so (
/root
/boot
.i
soi
sthepat
hof
boot
.i
soi
mage)
(
b)Copyt
heboot
.i
soi
magei
ntoDVD orpendr
ive.
#dd i
f=/
root
/boot
.i
so of
=/dev
/sdb1 (
/dev
/sdb1i
stheaddr
essoft
he
USB orpendr
ive)
(
ii
i)Boott
hesy
stem wi
tht
heabov
ecr
eat
edboot
.i
soi
mageandpr
essEsckeyt
oget
t
heboot:pr
ompt
.
(
iv)Thenex
ecut
ethebel
owcommandt
oinst
all
theO/
S.
boot:l
inuxaskmet
hod (
PressEnt
erkey
)
(
v)Sel
ectt
hepr
efer
redl
anguagef
ori
nst
all
ati
on(
forexampl
eEngl
i
sh)
.
(
vi)Sel
ectt
heKey
boar
dlay
outasUS.
(
vii
)Sel
ectt
heur
lopt
ionf
ort
hei
nst
all
ati
onmedi
a(f
orex
ampl
eFTP/
NFS/
HTTP)
.
(
vii
i
)Sel
ectI
Pv4orI
Pv6t
odef
inenet
wor
kset
ti
ngsandsel
ectdy
nami
corst
ati
c
opt
ions.
(
ix)Assi
gnt
hesamer
angeI
Paddr
ess andnet
maskt
othecl
i
entsy
stem t
o
communi
cat
ewi
thser
ver
.
(
x)Thenspeci
fyt
heFTPser
verI
Paddr
essandpat
hoft
hei
nst
all
ati
onmedi
ato
i
nst
all
theO/
S.
7. Howt
oinst
allRedHatLi
nuxt
hroughNFS?
(
i)Makeanent
ryi
n/et
c/expor
tst
oexpor
ttheRHELmedi
a.
#v
im /
etc/
expor
ts
<i
nst
all
ati
onmedi
adi
rect
ory
> <net
wor
kID>(
rw,
sync)
(
sav
eandexi
tthi
sfi
l
e)
Exampl
e:
/
var
/ft
p/pub/
rhel
6 172.
25.
9.0(
rw,
sync) (
Ift
hei
nst
all
ati
onmedi
a
i
sin/
var
/ft
p/pub/
rhel
6)
(
ii
)Expor
ttheabov
eNFSshar
eddi
rect
oryby #expor
tfs-
rv command.
(
ii
i)Thenr
est
artt
heNFSser
viceby#ser
vicer
est
artnf
scommandandaddt
he
NFSt
oIPt
abl
esorf
ir
ewal
l
.
(
iv) I
nst
all
ati
onofLi
nuxt
hroughnet
wor
krequi
resoneboot
.i
soi
mageorRHEL
DVD.
TomakeaDVD/
Pendr
iveboot
abl
eusi
ngboot
.i
soi
mage:
(
a)Downl
oadt
heboot
.i
soi
magef
rom r
edhatwebsi
te.
#cdr
ecor
d /
root
/boot
.i
so (
/root
/boot
.i
soi
sthepat
hof
boot
.i
soi
mage)
(
b)Copyt
heboot
.i
soi
magei
ntoDVD orpendr
ive.
#dd i
f=/
root
/boot
.i
so of
=/dev
/sdb1 (
/dev
/sdb1i
stheaddr
essoft
he
USB orpendr
ive)
(
v)Boott
hesy
stem wi
tht
heabov
ecr
eat
edboot
.i
soi
mageandpr
essEsckeyt
oget

Rat
nakar
Page244
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
heboot:pr
ompt
.
(
vi)Thenex
ecut
ethebel
owcommandt
oinst
all
theO/
S.
boot:l
inuxaskmet
hod (
PressEnt
erkey
)
(
vii
)Sel
ectt
hepr
efer
redl
anguagef
ori
nst
all
ati
on(
forexampl
eEngl
i
sh)
.
(
vii
i
)Sel
ectt
heKey
boar
dlay
outasUS.
(
ix)Thensel
ectt
heNFSdi
rect
oryopt
ionandspeci
fyt
heNFSser
verI
Paddr
ess
andNFSshar
eddi
rect
ory andt
hei
nst
all
ati
onwi
l
lbedone.
8. Howt
oinst
all
theRedHatLi
nuxt
hroughHTTP?
(
i)Fi
rsti
nst
all
theht
tpwebser
verby#y
um i
nst
allht
tpd* -
y command.
(
ii
)Copyt
heent
ir
eRHELDVDcont
ent
sint
o/v
ar/
www/
html
/rhel
6by
#cp -
rvpf /
medi
a/RHEL/
*.* /
var
/www/
html
/rhel
6
(
ii
i)I
fnotpossi
blet
odot
heabov
est
ep2,t
hencr
eat
eal
i
nkbet
weent
he
/
var
/ft
p/pub/
rhel
6 and /
var
/www/
htmlby #l
n-s
/
var
/ft
p/pub/
rhel
6 /
var
/www/
html
/rhel
6 command.
(
iv)Rest
artt
heht
tpser
vicesandaddi
ttot
hef
ir
ewal
l
.
I
nRHEL-6:
#ser
viceht
tpdr
est
art (
tor
est
artt
heht
tpser
vice
i
nRHEL-6)
#chkconf
ight
tpdon (
toenabl
etheht
tpser
viceatnext
booti
nRHEL-6)
#set
up (
thr
ought
heset
upcommandaddt
he
ht
tpser
vicet
othe I
Ptabl
es)
#ser
vicei
ptabl
essav
e (
tosav
ethei
ptabl
es
conf
igur
ati
on)
#ser
vicei
ptabl
esr
est
art (
tor
est
artt
hei
ptabl
esser
vice)
I
nRHEL-7:
#sy
stemct
lrest
artht
tpd (
tor
est
artt
heht
tpser
vicei
n
RHEL-7)
#sy
stemct
lenabl
eht
tpd (
toenabl
etheht
tpser
viceatnext
booti
nRHEL-7)
#f
ir
ewal
l-
cmd -
-per
manent -
add-
ser
vice=ht
tp(
toaddt
heht
tpser
vicet
othe
f
ir
ewal
li
nRHEL-7)
#f
ir
ewal
l-
cmd -
compl
ete-
rel
oad (
tor
eloadt
hef
ir
ewal
l
conf
igur
ati
on)
(
v)I
nst
all
ati
onofLi
nuxt
hroughnet
wor
krequi
resoneboot
.i
soi
mageorRHELDVD.
TomakeaDVD/
Pendr
iveboot
abl
eusi
ngboot
.i
soi
mage:
(
a)Downl
oadt
heboot
.i
soi
magef
rom r
edhatwebsi
te.
#cdr
ecor
d /
root
/boot
.i
so (
/root
/boot
.i
soi
sthepat
hof
boot
.i
soi
mage)
(
b)Copyt
heboot
.i
soi
magei
ntoDVD orpendr
ive.

Rat
nakar
Page245
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#dd i
f=/
root
/boot
.i
so of
=/dev
/sdb1 (
/dev
/sdb1i
stheaddr
essoft
he
USB orpendr
ive)
(
vi)Boott
hesy
stem wi
tht
heabov
ecr
eat
edboot
.i
soi
mageandpr
essEsckeyt
oget
t
heboot:pr
ompt
.
(
vii
)Thenex
ecut
ethebel
owcommandt
oinst
all
theO/
S.
boot:l
inuxaskmet
hod (
PressEnt
erkey
)
(
vii
i
)Sel
ectt
hepr
efer
redl
anguagef
ori
nst
all
ati
on(
forex
ampl
eEngl
i
sh)
.
(
ix)Sel
ectt
heKey
boar
dlay
outasUS.
(
x)Sel
ectt
heur
lopt
ionf
ort
hei
nst
all
ati
onmedi
aandspeci
fyt
heht
tporht
tpsI
P
addr
essandl
ocat
ion.
Exampl
e:
ht
tporht
tps:
//172.
25.
9.11/
rhel
6
(
xi)Theni
nst
all
ati
onofRedHatLi
nuxwi
l
lbedonet
hroughHTTP.
9. Whati
sPXEi
nst
all
ati
onandwhatar
eit
'sr
equi
rement
s?
Aut
omat
icI
nst
all
ati
onofRHELf
rom t
heNet
wor
kiscal
l
edPXEi
nst
all
ati
on.Thi
sis
al
socal
l
edasun-
att
ended
i
nst
all
ati
on.Themeansnobodyi
nter
act
ioni
srequi
redi
nthei
nst
all
ati
onpr
ocess.
PXEst
andsf
orPr
eExecut
ion.ThePXEdoesnotr
equi
resaRHELDVD orany
boot
.i
soi
mage.
Ther
equi
rement
sforPXEser
ver:
(
i)St
ati
cnet
wor
katser
versi
de.
(
ii
)DHCPser
vershoul
dbeconf
igur
edont
heser
ver
.
(
ii
i)FTPser
vershoul
dbeconf
igur
edont
heser
ver
.
(
iv)Yum ser
vershoul
dbeconf
igur
edont
heser
ver
.
(
v)TFTP ser
vershoul
dbeconf
igur
edont
heser
ver
.
(
vi)Cr
eat
etheki
ckst
arti
nst
all
ati
onf
il
e.
*I
fal
ltheabov
e5ser
ver
sar
econf
igur
edi
noneser
ver
,thatser
vershoul
dbecal
l
ed
asPXEser
ver
.
10.Howt
oconf
igur
ethePXEser
verandhowt
oinst
all
RedHatf
rom PXEser
ver
?
(
a)Putt
heRHEL-6DVD i
ntot
heDVD dr
iveandgot
oPackagesdi
rect
ory
.
#cd /
medi
a/RHEL6/
Packages
(
b)I
nst
all
thev
sft
pdpackaget
oconf
igur
etheFTPser
ver
.
#r
pm -
ivhv
sft
pd*
(
c)Copyt
heent
ir
eRHEL-6DVD cont
ent
sint
othe/
var
/ft
p/pub/
rhel
6 di
rect
ory
.
#cp -
rvpf /
medi
a/RHEL6/
*.* /
var
/ft
p/pub/
rhel
6
(
d)Rest
art
,enabl
ethef
tpser
viceatnextboot
,addt
heser
vicet
oIPt
abl
esand
r
est
artt
heI
Ptabl
es.
#ser
vicev
sft
pdr
est
art
#chkconf
igv
sft
pdon
#i
ptabl
es -
A I
NPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t21-
j

Rat
nakar
Page246
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

ACCEPT
#i
ptabl
es -
A OUTPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t21-
j
ACCEPT
#i
ptabl
es -
A I
NPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t20-
j
ACCEPT
#i
ptabl
es -
A OUTPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t20-
j
ACCEPT
#ser
vicei
ptabl
essav
e
#ser
vicei
ptabl
esr
est
art
#chkconf
igi
ptabl
eson
(
e)Conf
igur
ethenet
wor
kasst
ati
cby#set
up commandandr
est
artt
henet
wor
k
andNet
wor
kManager
.
(
f)Conf
igur
ethey
um ser
ver
.
#v
im/
etc/
yum.
repos.
d/l
inux.
repo
[
li
nux]
name=Li
nuxy
um ser
ver
baseur
l=f
tp:
//172.
25.
9.11/
pub/
rhel
6 (
Speci
fy
t
heFTP ser
verI
Paddr
ess)
gpgcheck=0
enabl
ed=1 (
sav
eand
exi
tthef
il
e)
#y
um cl
eanal
l
#y
um r
epol
ist
(
g)Conf
igur
etheDHCP ser
ver
.
#y
um i
nst
alldhcp* -
y
#cp -
rvpf /
usr
/shar
e/doc/
dhcp-
4.1.
1/dhcpd.
conf
.sampl
e
/
etc/
dhcp/
dhcpd.
conf
#v
im /
etc/
dhcp/
dhcpd.
conf
Got
oli
nenumber47andedi
tthel
i
neasbel
ow.
subnet 172.
25.
9.0 net
mask 255.
255.
255.
0{
r
ange 172.
25.
9.50 172.
25.
9.200;
*commentonnextt
wol
ines
opt
ionr
out
ers 172.
25.
9.11;
opt
ionbr
oadcast
-addr
ess 172.
25.
9.255;
def
aul
t-
lease-
ti
me 600;
max-
lease-
ti
me 7200;
al
l
ow boot
ing;
al
l
ow boot
p;
next
-ser
ver 172.
25.
9.11;
f
il
ename "
Pxel
i
nux
.0"
;

Rat
nakar
Page247
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

aut
hor
it
ati
ve; (
sav
eand
exi
tthi
sfi
l
e)
#ser
vicedhcpdr
est
art
#chkconf
igdhcpdon
#i
ptabl
es -
A I
NPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t67-
j
ACCEPT
#i
ptabl
es -
A OUTPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t68-
j
ACCEPT
#i
ptabl
es -
A I
NPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t67-
j
ACCEPT
#i
ptabl
es -
A OUTPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t68-
j
ACCEPT
(
h)Conf
igur
etheTFTP ser
ver
.
#y
um i
nst
allt
ftp* sy
sli
nux* -
y
#v
im/
etc/
xinet
d.d/
tft
* Got
odi
sabl
e=y
es l
i
neandmakei
tasno (
sav
eand
exi
tthi
sfi
l
e)
#cp -
rvpf /
medi
a/RHEL6/
isol
inux/
*.* /
var
/li
b/t
ftpboot
#mkdi
r/v
ar/
li
b/t
ftpboot
/pxel
inux.
cfg
#cp /
var
/li
b/t
ftpboot
/isol
inux.
cfg /
var
/li
b/f
tfpboot
/pxel
inux.
cfg/
def
aul
t
#cp -
rvpf /
usr
/shar
e/sy
sli
nux/
pxel
inux.
0 /
var
/li
b/t
ftpboot
#ser
vicexi
net
drest
art
#chkconf
igxi
net
don
#i
ptabl
es -
A I
NPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t69-
j
ACCEPT
#i
ptabl
es -
A OUTPUT -
m st
ate-
-st
ate NEW -
mtcp -
ptcp -
-depor
t69-
j
ACCEPT
(
i)Cr
eat
etheki
ckst
artf
il
e
#y
um i
nst
allsy
stem-
conf
ig-
kickst
art-
y
#sy
stem-
conf
ig-
kickst
art (
creat
eaki
ckst
artf
il
eandsav
eiti
n
/
var
/ft
p/pub di
rect
ory
)
#ksv
ali
dat
or /
var
/ft
p/pub/
ks.
cfg
(
j)Speci
fyt
heki
ckst
artf
il
elocat
ioni
npxel
i
nux
.cf
gfi
l
e.
#v
im /
var
/li
b/t
ftpboot
/pxel
inux.
cfg/
def
aul
t
* Got
oli
ne19andedi
tthel
i
nesasbel
ow.
menu l
abel^PXESERVER
menu def
aul
t
ker
nelv
mli
nuz
append i
nit
rd=i
nit
rd.
img l
i
nux ks=f
tp:
//172.
25.
9.11/
pub/
ks.
cfg
(
sav
eandex
itt
hisf
il
e)

Rat
nakar
Page248
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
k)Rest
artal
ltheser
vicesonceagai
n.
#ser
vicenet
wor
krest
art
#chkconf
ignet
wor
kon
#ser
vicev
sft
pdr
est
art
#chkconf
igv
sft
pdon
#ser
vicedhcpdr
est
art
#chkconf
igdhcpdon
#ser
vicexi
net
drest
art
#chkconf
igxi
net
don

Rat
nakar
Page249
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

29.Ver
it
asVol
umeManagerandVer
it
asCl
ust
er

1. Whati
sthedi
ff
erencebet
weenFai
l
ing and Fai
led?
Fai
li
ng:
Fai
l
ingmeans,i
tisgoi
ngt
ofai
l
.Inf
ail
i
ngdi
sk'
spr
ivat
eregi
oni
sav
ail
abl
eandpubl
i
c
r
egi
oni
snotav
ail
abl
e. so,wecanr
ecov
ert
hedat
ausi
ngt
hepr
ivat
eregi
on.
Fai
led:
Fai
l
edmeans,i
tisal
readyf
ail
ed.I
nfai
l
eddi
skt
hebot
hpr
ivat
eandpubl
i
cregi
ons
ar
enotav
ail
abl
e.So,
we cannotgetbackt
he(
recov
er)dat
a.Theonl
ythi
ngi
s
r
epl
aceorr
est
oret
hedat
afr
om backup.
2. Whatar
ethedeamonsofVer
it
asVol
umeManager
?
(
a)v
xconf
igd:
(
i)Thi
sist
hemai
ndeamoni
nVer
it
asVol
umeManager
.
(
ii
)Itmai
ntai
nst
heVol
umeManagerconf
igur
ati
oni
nfor
mat
ion.
(
ii
i)I
tal
way
sresi
desi
nthepr
ivat
eregi
onoft
hedi
sk.
(
iv)I
tcommuni
cat
ewi
tht
heker
nel
andupdat
etheVol
umest
atest
oconf
igur
ethe
dat
abase.
(
v)I
tal
way
sst
art
sbef
oremount
ingt
her
oot(/)f
il
esy
stem.
(
b)v
xiod:
(
i)Thi
sisusedt
omai
ntai
nI/
O(i
nputandout
put
)oper
ati
ons.
(
ii
)Thi
sal
sodef
ineshowmanyI
/O oper
ati
onsatat
ime.
(
c)v
xrel
ocd:
(
i)I
tal
way
smoni
tor
stheconsi
stencyi
nthedi
sksandnot
if
ytheuseri
ffai
l
ed
usi
ng(
by)v
xnot
if
yd deamon.
(
ii
)Ital
sor
elocat
eandr
ecogni
zet
henewdi
sk.
(
d)v
xrecov
erd:
(
i)I
tpassest
hel
ostdat
aint
onewdi
sk.
(
ii
)Ital
sonot
if
ytot
heAdmi
nist
rat
orsusi
ng(
by)v
xnot
if
yddeamon.
(
e)v
xnot
if
yd:
(
i)I
tnot
if
ytot
heuser(
Admi
nist
rat
or)aboutf
ail
eddi
sksandaf
terr
ecov
eryal
soi
t
not
if
ytot
he Admi
nist
rat
or.
3. Howt
ocr
eat
ether
ootmi
rr
or?

Rat
nakar
Page250
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Br
ingt
hedi
skf
rom O/
StoVer
it
asVol
umeManagercont
rol
usi
ngt
heVer
it
as
Adv
ancedManagementt
ool
, #v
xdi
skadm command(
Itgi
ves(
displ
ays)
opt
ionsf
oreasyadmi
nist
rat
ionofVer
it
asVol
umeManager
).
(
ii
)Sel
ect2ndopt
ioni
e.,Encapsul
ati
onbecauset
opr
eser
vet
heex
ist
ingdat
apr
esenti
n
t
hedi
skandr
eboot t
hesy
stem t
oef
fectEncapsul
ati
onandmodi
fyt
he
/
etc/
sysconf
igf
il
e.Whi
l
eEncapsul
ati
ng,
itasksdi
sk nameanddi
skgr
oup
(
rootdi
sknameandr
oot
dg)
.
(
ii
i) Backupt
he/(
root
),/
etc/
sysconf
igdi
rect
ori
es.
(
iv)Takeanot
herdi
skandi
nit
ial
i
zei
tby#v
xdi
skset
up -
i <mi
rr
oredr
ootdi
sk
name> command.
(
v)Addt
heabov
eini
ti
ali
zeddi
skt
othev
olumegr
oupi
e.,r
oodgby
#v
xdg -
g <r
oot
dg> adddi
sk mi
rr
ordi
sk=<mi
rr
oredr
ootdi
skname>
(
vi)v
xmi
rr
or -
v -
g <r
oot
dg><or
igi
naldi
skname><mi
rr
oredr
ootdi
skname> (
disk
l
evelmi
rr
ori
ng)
(
vii
)Fori
ndi
vi
dual
mir
ror
ing,#v
xassi
st -
g <r
oot
dg> mi
rr
or <v
olumename> or
#v
xroot
mir
r-g <r
oot
dg><v
olumename> command.

4. Whati
stheser
vicegr
oupi
nVer
ti
asCl
ust
er?
Ser
vicegr
oupi
smadeupofr
esour
cesandt
hei
rli
nkswhi
chwenor
mal
l
yrequi
rest
o
mai
ntai
ntheHi
gh Av
ail
abi
l
ityf
ort
heappl
i
cat
ion.
5. Whati
stheuseof'
hal
ink'command?
#hal
ink commandi
susedt
oli
nkt
hedependenci
esoft
her
esour
ces.
6. Whatar
ethedi
ff
erencesbet
weenswi
tchov
erandf
ail
over
?
Swi
tchOv
er Fai
lOv
er
(
i)Swi
tchov
eri
sthemanual
task. (
i)But
,Fai
l
overi
saaut
omat
ict
ask.
(i
i)But,thefail
overwil
lfai
l
ov ert
heservi
cegroup
(i
i
)Wecanswi tchoverser
vicegroupsfrom to
onli
ne theot hernodewhenVer it
asClust
er
clust
ernodetooffl
ineclust
ernodeincaseof heartbeat
poweroutage,hardwarefail
ure,schedul
e li
nkdown,damaged, brokenbecauseof
shutdownandr eboot. some
disasterorsy st
em hung.

7. Whi
cht
hemai
nconf
igur
ati
onf
il
eforVCS (
Ver
it
asCl
ust
er) and wher
eiti
sst
ored?
'
mai
n.cf'i
sthemai
nconf
igur
ati
onf
il
eforVCS and i
tisl
ocat
edi
n
/
etc/
VRTSv
cs/
conf
/conf
ig di
rect
ory
.
8. Whati
sthepubl
icr
egi
onandpr
ivat
eregi
on?
whenwebr
ingt
hedi
skf
rom O/
Scont
rol
toVol
umeManagercont
rol
inanyf
ormat
(
eit
herCDS,si
mpl
eor sl
i
ced)
,thedi
ski
slogi
cal
l
ydi
vi
dedi
ntot
wopar
ts.
(
a)Pr
ivat
eregi
on:
I
tcont
ainsVer
it
asconf
igur
ati
oni
nfor
mat
ionl
i
kedi
skt
ypeandname,di
skgr
oup

Rat
nakar
Page251
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

name,gr
oupi
dand conf
igdb.Thedef
aul
tsi
zei
s2048KB.
(
b)Publ
icr
egi
on:
I
tcont
ainst
heact
ual
user
'sdat
ali
keappl
i
cat
ions,dat
abasesandot
her
s.
9. Ther
ear
efi
vedi
sksonVxVM (
Ver
it
asVol
umeManager
)andal
lar
efai
led.Whatar
e
t
hest
epsy
ouf
oll
owt
o gett
hosedi
sksi
ntoonl
ine?
(
i)Checkt
hel
i
stofdi
sksi
nVol
umemanagercont
rolby#v
xdi
skl
istcommand.
(
ii
)Ift
heabov
edi
sksar
enotpr
esent
,thenbr
ingt
hem O/
Scont
rolt
oVxVM cont
rol
by
#v
xdi
skset
up -
i <di
sknames> (
ifdat
aisnotont
hosedi
sk) or
execut
e
#v
xdi
skadm commandandsel
ect2ndopt
ioni
e.,encapsul
ati
onmet
hodi
fthe
di
skshav
ingt
hedat
a.
(
ii
i) Ev
ent
houghI
fiti
snotpossi
ble,
thencheckt
hedi
sksar
eav
ail
abl
eatO/
S
l
evelby#f
disk -
lcommand.
(
a)I
fthedi
sksar
eav
ail
abl
e,ex
ecut
etheabov
ecommandonceagai
n.
(
b)I
fthedi
sksar
enotav
ail
abl
ethenr
ecogni
zet
hem byscanni
ngt
hehar
dwar
e.
(
iv)Ev
ent
houghi
fiti
snotpossi
ble,
thenr
eboott
hesy
stem andf
oll
owt
hest
eps(
i)
and(
ii
).
10.Whati
sthebasi
cdi
ff
erencebet
weenpr
ivat
edi
skgr
oup and shar
eddi
skgr
oup?
Pr
ivat
edi
skgr
oup:
Thedi
skgr
oupi
sonl
yvi
sibl
efort
hehostonwhi
chwehav
ecr
eat
edi
t.I
fthehosti
sa
par
toft
hecl
ust
er,
the pr
ivat
edi
skgr
oupwi
l
lnotbev
isi
blet
otheot
hercl
ust
ernodes.
Shar
eddi
skgr
oup:
Thedi
skgr
oupi
sshar
abl
eandv
isi
blet
otheot
hercl
ust
ernodes.
11.Howwi
lly
oucr
eat
epr
ivat
edi
skgr
oupandshar
eddi
skgr
oup?
#v
xdg i
nit <di
skgr
oupname><di
skmedi
aname>=<O/
Sdi
skname> (
to
cr
eat
ethepr
ivat
edi
skgr
oup)
#v
xdg -
sini
t<di
skgr
oupname><di
skmedi
aname>=<O/
Sdi
skname>(
tocr
eat
e
t
heshar
eddi
skgr
oup)
12.Howwi
lly
ouaddnewdi
skt
otheexi
sti
ngdi
skgr
oup?
wecandot
hisi
ntwoway
s.
(
i)Run#v
xdi
skadm command,
whi
chwi
l
lopenmenudr
ivenpr
ogr
am t
odov
ari
ous
di
skoper
ati
ons.Sel
ect adddi
skopt
ionandgi
vedi
skgr
oupnameanddi
sk
name.
(
ii
)#v
xdg -
g <di
skgr
oupname> adddi
sk <di
skmedi
aname>=<O/
Sdi
skname>
Exampl
e:#v
xdg -
g appsdg adddi
sk di
sk02=/
dev
/sdb
13.Howwi
lly
ougr
ow orshr
inkt
hev
olume/
fil
esy
stem?Whati
sthemeani
ngofgr
owby
,
gr
owt
o,shr
inkby and shr
inkt
oopt
ions?
(
i)Wecangr
owt
hev
olume/
fil
esy
stem by
,
#v
xassi
st -
g appsdg gr
owby orgr
owt
o 100GB appsv
ol (
or)
#v
xresi
ze -
g appsdg +100GB appsv
ol al
l
oc=<di
skname>

Rat
nakar
Page252
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
ii
)Wecanshr
inkt
hev
olume/
fi
lesy
stem by
,
#v
xassi
st -
g appsdg shr
inkby 20GB appsv
ol
#v
xassi
st -
g appsdg shr
inkt
o 20GB appsv
ol (
or)
#v
xresi
ze -
g appsdg -
10GB appsv
ol (
toshr
inkbyt
hesi
ze10GB)
#v
xresi
ze -
g appsdg 10GB appsv
ol (
toshr
inkt
othesi
ze10GB)
Meani
ngs:
gr
owby :
Thi
swi
l
lbeusedt
ogr
owt
hef
il
esy
stem byaddi
ngnewsi
zet
otheex
ist
ingf
il
e
sy
stem.
gr
owt
o:
Thi
swi
l
lbeusedt
ogr
owt
hef
il
esy
stem upt
othespeci
fi
ednewsi
ze.Thi
swi
l
lnotbe
addedt
henewsi
zet
o t
heex
ist
ingone.
shr
inkby:
Thi
swi
l
lbeusedt
oshr
inkt
hef
il
esy
stem byr
educi
ngt
henewsi
zef
rom t
heex
ist
ing
f
il
esy
stem si
ze.
shr
inkt
o:
Thi
swi
l
lbeusedt
oshr
inkt
hef
il
esy
stem upt
othespeci
fi
ednewsi
ze.Thi
swi
l
lnot
ber
educedt
hef
il
esy
stem newsi
zef
rom t
heexi
sti
ngone.
14.I
fvxdi
skl
i
stcommandgi
vesy
oudi
skst
atusas"er
ror"
.Whatar
ethest
epsy
ou
f
oll
owt
omaker
espect
ive di
skonl
ine?
Thi
sissuei
smai
nlybecauseoff
abr
icdi
sconnect
ion.So,
execut
e #v
xdi
sk scandi
sks
command.Ot
her
wise unset
upt
hedi
sksusi
ng #/
etc/
vx/
bin/
vxdi
skunset
up and
set
upt
hedi
sksagai
nusi
ng #/
etc/
vx/
bin/
vxdi
skset
up command.
Not
e:/
etc/
vx/
bin/
vxdi
skunset
up wi
l
lremov
ethepr
ivat
eregi
onf
rom t
hedi
skanddest
royt
he
dat
a.So, backupt
hedat
abef
oreusi
ngt
hiscommand.

15.Whi
char
ethedi
ff
erentl
ayout
sforv
xvm?
(
i)
mir
ror (
ii
)st
ri
pe(
def
aul
t)
(
ii
i)concat
e (
iv)r
aid5
(
v)st
ri
pe-
mir
ror (
vi) mi
rr
or-
str
ipe
16.Howwi
lly
ouset
upandunset
updi
sksexpl
ici
tl
ysui
ngv
xvm?
#/
etc/
vx/
bin/
vxdi
skset
up (
toset
upt
hedi
sks)
#/
etc/
vx/
bin/
vxdi
skunset
up (
tounset
upt
hedi
sks)
17.Howwi
lly
oul
istt
hedi
skswhi
char
eindi
ff
erentdi
skgr
oups?
#v
xdi
sk l
i
st or #v
xpr
int (
tol
i
stf
rom cur
rentdi
skgr
oupor
i
mpor
teddi
skgr
oup)
#v
xdi
sk -
o al
l
dgs (
tol
i
stal
lthedi
skswhi
char
eindi
ff
erent
di
skgr
oups)

18.Def
ineLLT and GAB.Whatar
ethecommandst
ocr
eat
ethem?

Rat
nakar
Page253
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

LLT:
(
i)LLTmeansLowLat
encyTr
anspor
tpr
otocol
(
ii
)Itmoni
tort
heker
nelt
oker
nelcommuni
cat
ion.
(
ii
i)I
tmai
ntai
nanddi
str
ibut
ethenet
wor
ktr
aff
icwi
thi
nthecl
ust
er.
(
iv)I
tuseshear
tbeatbet
weent
hei
nter
faces.
GAB:
(
i)GABmeansGl
obalAt
omi
cBr
oadcast
ing.
(
ii
)Itmai
ntai
nanddi
str
ibut
etheconf
igur
ati
oni
nfor
mat
ionoft
hecl
ust
er.
(
ii
i)I
tuseshear
tbeatbet
weent
hedi
sks.
Commands:
#gabconf
ig -
a (
tocheckt
hest
atusoft
heGAB,
ie.
,GAB
i
srunni
ngornot
)
I
fpor
t'a'i
sli
steni
ng,meansGAB i
srunni
ng,
other
wiseGAB i
snot
r
unni
ng.
I
fpor
t'b'i
sli
steni
ng,
meansI
/Of
enci
ngi
senabl
ed,
other
wiseI
/Of
enci
ng
i
sdi
sabl
ed.
I
fpor
t'h'i
sli
steni
ngmeanshaddeamoni
swor
king,
other
wisehad
deamoni
snotwor
king.
#gabconf
ig -
cn2 (
tost
artt
heGAB i
n2sy
stemsi
nthecl
ust
er,
wher
e2i
sseedno.
)
#gabconf
ig -
u (
tost
opt
heGAB)
#cat/
etc/
gabt
ab (
toseet
heGABconf
igur
ati
oni
nfor
mat
ionand
t
hei
tcont
ainsas,
)
gabconf
ig -
c nx (
wher
exi
sano.i
e.,1,
2,3,
..
..
etc.
,
)
#l
l
tconf
ig -
a (
toseet
hest
atusoft
hel
l
t)
#l
l
tconf
ig -
c (
tost
artt
hel
l
t)
#l
l
tconf
ig -
u (
tost
opt
hel
l
t)
#l
l
tst
at -
nvv (
toseet
het
raf
fi
cst
atusbet
weent
hei
nter
faces)
#l
l
ttab -
a (
toseet
hecl
ust
erI
D)
#hacl
us -
displ
ay (
toseeal
lthei
nfor
mat
ionont
hecl
ust
er)
#cat/
etc/
ll
tt
ab (
toseet
hel
l
tconf
igur
ati
onandt
heent
ri
esar
e
as,
)
Cl
ust
erI
D,hostI
D,i
nter
faceMAC addr
ess,
..
.et
c.,
#cat/
etc/
ll
thost
s (
toseet
heno.ofnodespr
esenti
nthecl
ust
er)
19.Howt
ocheckt
hest
atusoft
heVer
it
asCl
ust
er?
#hast
atus -
summar
y
20.Whi
chcommandi
susedt
ocheckt
hesy
ntaxoft
hemai
n.cf
?
#hacf -
ver
if
y /
etc/
VRTSv
cs/
conf
/conf
ig
21.Howwi
lly
oucheckt
hest
atusoft
hei
ndi
vi
dualr
esour
cesofVer
it
asCl
ust
er(
VCS)
?
#har
es -
stat
e <r
esour
cename>

Rat
nakar
Page254
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

22.Whati
stheuseof #hagr
p command?
#hagr
p commandi
suseddoi
ngadmi
nist
rat
iveact
ionsonser
vicegr
oupsl
i
ke,
on-
li
ne
ser
vicegr
oup,of
f-
li
ne ser
vicegr
oupandswi
tch,
..
.et
c.,
23.Howt
oswi
tchov
ert
heser
vicegr
oup?
#hagr
p -
swi
tch <Sy
stem A><Sy
stem B>
24.Howt
oonl
inet
heser
vicegr
oupi
nVCS?
#hagr
p -
onl
i
ne <ser
vicegr
oupname> -
sys <Sy
stem A>
25.Whatar
ethest
epst
ofol
lowf
orswi
tchov
ert
heappl
i
cat
ionf
rom Sy
stem A t
o
Sy
stem B?
(
i)Fi
rstunmountt
hef
il
esy
stem onSy
stem A.
(
ii
)St
opt
hev
olumeonSy
stem A.
(
ii
i) Depor
tthedi
skgr
oupf
rom Sy
stem A.
(
iv) I
mpor
tthedi
skgr
oupt
oanot
herSy
stem B.
(
v)St
artt
hev
olumeonSy
stem B.
(
vi)Fi
nal
l
ymountt
hef
il
esy
stem onSy
stem B.
26.Howmanyt
ypesofcl
ust
ersav
ail
abl
e?
(
i)Hy
bri
dCl
ust
er.
(
ii
)Par
all
elCl
ust
er.
(
ii
i)Fai
l
overCl
ust
er.
27.Whati
smeantbyseedi
ng?
Nor
mal
l
y,wewi
l
ldef
inehowmanynodest
ost
arti
nacl
ust
erwhi
l
eboot
ingorex
pli
cit
ly
byexecut
ing
#gabconf
ig -
c n2 command.Her
e2means2seedst
ost
arti
nacl
ust
er.Thi
s
no.i
scal
l
edseedi
ng.
28.Whati
sSpl
itbr
aini
ssuei
nVCS andhowt
oresol
vet
his?
A Spl
i
tbr
aini
ssuemeans,
mul
ti
plesy
stemsuset
hesameex
clusi
ver
esour
cesand
usual
l
yresul
ti
ngi
ndat
a cor
rupt
ion.
Nor
mal
l
yVCSi
sconf
igur
edwi
thmul
ti
plenodesandar
ecommuni
cat
eswi
theach
ot
her
.Whenpowerl
ossor sy
stem cr
ashed,t
heVCSassumest
hesy
stem hasf
ail
edand
t
ryi
ngt
omov
eser
vicegr
oupt
oot
hersy
stem t
o mai
ntai
nhi
ghav
ail
abi
l
ity
.Howev
er
communi
cat
ion(
hear
tbeat
)canal
sof
ail
edduet
onet
wor
kfai
l
ures.
I
fnet
wor
ktr
aff
ic(
connect
ion)bet
weenanyt
wogr
oupsofsy
stemsf
ail
simul
taneousl
y,
anet
wor
kpar
ti
ti
on occur
s.Whent
hishappen,
syst
emsonbot
hsi
desoft
hepar
ti
ti
oncan
r
est
artt
heappl
i
cat
ionsf
rom t
heot
her si
de,
ie.
,resul
ti
ngi
ndupl
i
cat
eser
vices.So,
the
mostser
iouspr
obl
em causedbyt
hisandef
fect
sthedat
aon shar
eddi
sks.
Thi
sspl
i
tbr
aini
ssuenor
mal
l
yoccur
sinVCS3.
5toVCS4.
0ver
sions.But
,fr
om VCS
5.
0onwar
dst
heI
/O f
enci
ng(
newf
eat
ure)i
sint
roducedt
omi
nimi
zet
hespl
i
tbr
aini
ssue.I
f
I
/Of
enci
ngi
senabl
edi
nacl
ust
er,
then wecanav
oidt
hespl
i
tbr
aini
ssue.
29.Whati
sAdmi
nwai
tand St
aleAdmi
nwai
t?
ADMI
N-WAI
T:

Rat
nakar
Page255
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

I
fVCSi
sst
art
edonsy
stem wi
thav
ali
dconf
igur
ati
onf
il
eandot
hersy
stemsar
eint
he
ADMI
N-WAI
T st
ate,
The newsy
stem t
ransi
ti
ont
otheADMI
N-WAI
T st
ate (
or)
I
fVCSi
sst
art
edonsy
stem wi
thast
aleconf
igur
ati
onf
il
eandi
fot
hersy
stemsar
ein
t
heADMI
N-WAI
T st
ate, t
henewsy
stem t
ransi
ti
ont
otheADMI
N-WAI
T st
ate.
STALE-
ADMI
N-WAI
T:
Theconf
igur
ati
onf
il
esar
einr
ead-
onl
ymode.I
fanychangeswant
stomaket
hatf
il
eas
r
ead-
wri
temode.I
fany changesoccur
sin'
mai
n.cf'f
il
eincl
ust
er,
thent
hechanges
ar
ein'
.st
ale'hi
ddenf
il
eunderconf
igur
ati
on di
rect
ory
.Whi
l
echangesoccur
ri
ng,i
f
t
hesy
stem r
est
art
ed orr
eboot
ed,
thent
hecl
ust
erwi
l
lst
artwi
th' .
stal
e'f
il
e.So,
t
heVCSi
sst
art
edonasy
stem wi
thast
aleconf
igur
ati
onf
il
e,t
hesy
stem st
atuswi
l
lbe
STALE- ADMI
N-WAI
T unt
ilanot
hersy
stem i
nthecl
ust
erst
art
swi
thav
ali
d
conf
igur
ati
onf
il
e orot
her
wiseexecut
e
#hasy
s -
stal
e -
for
ce <sy
stem name> (
or) #hasy
s -
for
ce <sy
stem name>
t
ost
artt
hesy
stem f
orcef
ull
ywi
tht
hecor
rectorv
ali
dconf
igur
ati
onf
il
e.
30.Whati
smeantbyr
esour
ce andhowmanyt
ypes?
Resour
ce i
sasof
twar
e orhar
dwar
ecomponentmanagedbyt
heVCS.
Mountpoi
nts,di
skgr
oups,v
olumes,I
Paddr
esses,
..
..
etc.
,ar
etheSof
twar
e
component
s.
Di
sks,I
nter
faces(
NICcar
ds)
,..
..
etc.
,ar
etheHar
dwar
ecomponent
s.
Ther
ear
etwot
ypesofr
esour
cesandt
heyar
e,
(
i)Per
sist
entResour
ces (
wecanputt
hem ei
theron-
li
ne orof
f-
li
ne)
(
ii
)Non-
Per
sist
entResour
ces (
wecanputof
f-
li
neonl
y)
I
fther
esour
cei
sinf
aul
tedst
ate,
thencl
eart
heser
vicegr
oupst
ate.Resour
cescabbe
cr
it
icalornon-
cri
ti
cal
. I
fther
esour
cei
scr
it
ical
,theni
taut
omat
ical
l
yfai
l
overi
fthe
r
esour
cei
sfai
l
ed.I
fther
esour
cei
sNon-
cri
ti
cal
,theni
tswi
tchov
erandwehav
eto
manual
l
yswi
tchov
ert
her
esour
cegr
oupt
oanot
herav
ail
abl
esy
stem.
31.Whatar
ethedependenci
esbet
weenr
esour
cesi
naCl
ust
er?
I
foner
esour
cedependsonot
herr
esour
ce,
thent
her
eisadependencybet
weent
hose
r
esour
ces.
Exampl
e:NI
C(Net
wor
kInt
erf
aceCar
d)i
shar
dwar
ecomponentnot
hingbuthar
dwar
e
r
esour
ce.TheI
P addr
essi
sasof
twar
ecomponentnot
hingbutsof
twar
eresour
ce
andi
tdependsonNI
Ccar
d.Ther
elat
ionshi
p bet
weenNI
C and I
Paddr
essi
s
Par
ent-Chi
ldr
elat
ionshi
p.Ther
esour
cewhi
chonei
sst
art
sfi
rst
,thatonei
s cal
l
ed
Par
ent
resour
ceand t
her
emai
ningdependencyr
esour
cesar
ecal
l
edChi
ldr
esour
ce.
32.Whatar
ethemi
nimum r
equi
rement
sforori
nVCS?
(
i)Mi
nimum t
woi
dent
ical
(sameconf
igur
ati
on)sy
stems.
(
ii
)Twoswi
tches(
Opt
icalFi
breChannel
).
(
ii
i)Mi
nimum t
hreeNI
C car
ds.(
TwoNI
Csf
orpr
ivat
enet
wor
kandoneNI
Cfor
publ
i
cnet
wor
k).
(
iv) Onecommonst
orage.

Rat
nakar
Page256
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
v)Ver
it
asVol
umeManagerwi
thl
i
cense.
(
vi)Ver
it
asCl
ust
erwi
thl
i
cense.
33.Whatar
etheVer
it
asCl
ust
erdeamons?
(
i)had:
(
a)I
tist
hemai
ndeamoni
nVer
it
asCl
ust
erf
orhi
ghav
ail
abi
l
ity
.
(
b)I
tmoni
tor
sthecl
ust
erconf
igur
ati
onandwhol
ecl
ust
erenv
ironment
.
(
c)I
tint
eract
swi
thal
ltheagent
sandr
esour
ces.
(
ii
)hashadow:
(
a)I
tal
way
smoni
tort
hehaddeamon.
(
b)I
t'
smai
nfunct
ional
i
tyi
sloggi
ngaboutt
hecl
ust
er.
35.Whatar
ethemai
nconf
igur
ati
onf
il
esi
naCl
ust
er?
*/
etc/
VRTSv
cs/
conf
/conf
ig/
mai
n.cf and
*/
etc/
VRTSv
cs/
conf
/conf
ig/
types.
cf ar
ethemai
nconf
igur
ati
onf
il
esi
nCl
ust
er.
36.Whatar
ethemai
nlogf
il
esi
naCl
ust
er?
(
i)/
var
/VRTSv
cs/
log/
Engi
ne_
A.l
og (
loggi
ngaboutwhent
hecl
ust
erst
art
ed,
whenf
ail
ed,whenf
ail
over
occur
s,whenswi
tchov
erf
orcef
ull
y,.
..
etc.
,
)
(
ii
)/v
ar/
VRTSv
cs/
log/
hashadow_
A.l
og(
loggi
ngaboutt
hehashadow deamon)
(
ii
i) /
var
/VRTSv
cs/
log/
agent
_A.
log (
loggi
ngboutagent
s)
37.Whatar
etheCl
ust
ercomponent
s?
(
i)Cl
ust
er.
(
ii
)Ser
vicegr
oups.
(
ii
i) Resour
ces.
(
iv)Agent
s.
(
v)Ev
ent
s.
38.Whati
syourr
olei
ntheCl
ust
er?
Nor
mal
l
ywewi
l
lgetr
equest
sli
ke,
(
i)Addanode.
(
ii
)Addar
esour
ce.
(
ii
i)Addaser
vicegr
oup.
(
iv) Addar
esour
cet
otheexi
sti
ngser
vicegr
oup.
(
v)Addmountpoi
nts.
Andsomet
imeswegetsomet
roubl
eshoot
ingi
ssuesl
i
ke,
(
i)haddeamoni
snotr
unni
ng.
(
ii
)Spl
i
tbar
ini
ssue.
(
ii
i) I
fther
esour
cesar
efaul
ted,
thenr
est
artt
heser
vicegr
oupsandmov
ing
ser
vicegr
oupsf
rom onenodet
o anot
her
.
(
iv) Cl
ust
eri
snotr
unni
ng.
(
v)Communi
cat
ionf
ail
edbet
weent
wonodes.
(
vi) GAB andLLT ar
enotr
unni
ng.

Rat
nakar
Page257
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
vii
)Resour
cenotst
art
ed.
(
vii
i
)mai
n.cfand t
ypes.
cff
il
escor
rupt
ed.
(
ix) I
/Of
enci
ng(
alocki
ngmechani
sm t
oav
oidt
hespl
i
tbr
aini
ssue)i
snot
enabl
ed(
atdi
skl
evel
/SAN l
evel
).
(
x)Andt
hel
ocksar
e,
(
a)engi
ne.
lock
(
b)ha.
lock
(
c)agent
.l
ock
39.Whatar
ethest
atusesofaser
vicegr
oup?
(
i)onl
i
ne
(
ii
)of
fl
ine
(
ii
i) par
ti
al
*I
fthenon-
cri
ti
calr
esour
cei
sfai
l
ed,t
hent
hest
atusoft
he ser
vicegr
oup maybe
i
npar
ti
alst
atus.
*I
fthecr
it
ical
resour
cei
sfai
l
ed,t
hent
hest
atusoft
he ser
vicegr
oup maybei
n
of
fl
inest
atus.
40.Howt
omov
etheser
vicegr
oupf
rom onenodet
oanot
hernodemanual
l
y?
(
i)St
opt
heappl
i
cat
ion.
(
ii
)St
opt
hedat
abase.
(
ii
i) Unmountt
hef
il
esy
stem.
(
iv)St
opt
hev
olume.
(
v)Depor
tthedi
skgr
oup.
(
vi) I
mpor
tthedi
skgr
oup.
(
vii
)St
artt
hev
olume.
(
vii
i
)Mountt
hef
il
esy
stem.
(
ix) St
artt
hedat
abase.
(
x)St
artt
heappl
i
cat
ion.
41.Howt
orenameadi
skgr
oupi
nVxVM i
nst
epwi
se?
(
i)St
opt
heappl
i
cat
ion.
(
ii
)St
opt
hedat
abase.
(
ii
i) Unmountt
hef
il
esy
stem.
(
iv) St
opt
hev
olume.
(
v)Depor
tthedi
skgr
oup.
(
vi) Renamet
hedi
skgr
oup.
(
vii
)Impor
tthedi
skgr
oup.
(
ix) St
artt
hev
olume.
(
x)Mountt
hef
il
esy
stem.
(
xi) St
artt
hedat
abase.
(
xii
)St
artt
heappl
i
cat
ion.
42.Howt
ocr
eat
eav
olumewi
th4di
sks?

Rat
nakar
Page258
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Br
ingt
hedi
skst
oO/
Scont
rolbyscanni
ngt
heLunsusi
ngt
hef
oll
owi
ngt
he
command,
#echo "
--
-" > /
sys/
class/
scsi
_host
/<l
unno.>/
scan (
toscant
hel
unno.
)
(
ii
)Br
ingt
hosedi
skf
rom O/
Scont
rolt
oVxVM cont
rol
.
(
a)I
fwewantt
opr
eser
vet
hedat
a,t
henbr
ingt
hedi
skst
oVxVM cont
rol
usi
ng
encapsul
ati
onmet
hodby
#v
xdi
skadm (
her
ewegett
heopt
ionst
odot
hisandsel
ect2ndopt
ioni
e.,
Encapsul
ati
on)
(
b)I
fwedon'
twantt
opr
eser
vet
hedat
a,t
henbr
ingt
hedi
skst
oVxVM cont
rol
usi
ngi
nit
ial
i
zat
ionmet
hod by#v
xdi
skset
up-
i <di
sk1 name> (
for
exampl
e #v
xdi
skset
up -
i/dev
/sda)
#v
xdi
skset
up-
i <di
sk2 name> (
forexampl
e #v
xdi
skset
up -
i
/
dev
/sdb)
#v
xdi
skset
up-
i <di
sk3 name> (
forexampl
e #v
xdi
skset
up -
i
/
dev
/sdc)
#v
xdi
skset
up-
i <di
sk4 name> (
forexampl
e #v
xdi
skset
up -
i
/
dev
/sdd)
#v
xdi
sk l
i
st (
toseeVxVM cont
rol
l
eddi
sks)
(
ii
i) Cr
eat
eadi
skgr
oup.
#v
xdg i
nit <di
skgr
oupname> di
sk01=/
dev
/sda (
forexampl
edi
skgr
oup
name as appsdg)
(
iv) Addi
ngr
emai
ningt
hreedi
skst
otheabov
edi
skgr
oup.
#v
xdg -
g appsdgadddi
sk di
sk02=/
dev
/sdb
#v
xdg -
g appsdgadddi
sk di
sk02=/
dev
/sdc
#v
xdg -
g appsdgadddi
sk di
sk02=/
dev
/sdd
#v
xdg l
i
st <di
skgr
oupname> (
toseeal
lthedi
sksbel
ongst
othatdi
skgr
oup
f
orexampl
eappsdg)
(
v)Cr
eat
etheVol
ume(
fort
her
equest
edsi
ze and r
equest
edl
ayout
).
#v
xassi
st -
g appsdg make <v
olumename><si
ze> (
forexampl
e
v
olumenamei
sappsv
oland
si
zei
nTB/
GB.
..et
c)
(
vi)Cr
eat
ea f
il
esy
stem ont
hatv
olume.
#mkf
s -
Fvxf
s /
dev
/vx
/rdsk/
appsdg/
appsv
ol
(
vii
)Cr
eat
ethemountpoi
ntandpr
ovi
det
her
equest
edper
missi
onst
othatmountpoi
nt.
#mkdi
r /
mnt
/apps
(
vii
i
)St
artt
hev
olume.
#v
xvol -
g appsdg st
art appsv
ol
(
ix) Mountt
hef
il
esy
stem ont
heabov
emountpoi
nt.
#mount -
F v
xfs -
o <opt
ionsl
i
ker
w,r
e> /
dev
/vx/
dsk/
appsdg/
appsv
ol
(
wher
e r
w means r
ead-
wri
te and r
emeans r
ead-
onl
y)

Rat
nakar
Page259
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
x)Putt
heent
ryi
ntot
he "
/et
c/f
stab" f
il
eforper
manentmount
.
* I
fthev
olumei
scr
eat
edf
orcl
ust
er,don'
tputt
heent
ryi
n/et
c/f
stab f
il
e.
(
xi) Andf
inal
l
ysendt
hemai
ltocl
i
entorr
equest
edper
son
43.Whati
sthedi
ff
erencebet
weenGl
obalCl
ust
erandLocalCl
ust
er?Hav
eyou
conf
igur
edt
heGl
obalCl
ust
er?
LocalCl
ust
er:
I
fal
lthenodesi
naCl
ust
erar
epl
acedi
nasamel
ocat
ion,t
hatCl
ust
eri
scal
l
ed Local
Cl
ust
er.
Gl
obalCl
ust
er:
I
fal
lthenodesi
naCl
ust
erar
epl
acedi
ndi
ff
erentGeol
ogi
call
ocat
ions,t
hatCl
ust
eri
s
cal
l
edGl
obal
Clust
er. Themai
nadv
ant
ageofgl
obal
clust
eri
shi
ghav
ail
abi
l
itywhen
Nat
uralCal
ami
ti
es ordi
sast
ersoccur
s.

* No,Ihav
en'
tconf
igur
etheGl
obalCl
ust
er.
44.Howt
ost
artandst
opt
heCl
ust
er?
#hast
art (
tost
artt
hel
ocal
nodei
nthe
Cl
ust
er)
#hast
art al
l (
tost
artal
lthenodesi
ntheCl
ust
er)
#hast
art -
sys <sy
stem ornode name> (
tost
artaspeci
fi
edsy
stem ornode
i
ntheCl
ust
er)
#hasy
s -
for
ce <sy
stem ornodename> (
tof
orcef
ull
yst
artt
hesy
stem i
nthe
Cl
ust
er)
#hast
op (
tost
opt
hel
ocal
nodei
ntheCl
ust
er)
#hast
op al
l (
tost
opal
lthesy
stemsi
ntheCl
ust
er)
#hast
op -
sys <sy
stem ornodename> (
tost
opt
hespeci
fi
edsy
stem ornode
i
ntheCl
ust
er)
45.Whati
stheSer
vicegr
oupandResour
ce?
Ser
vicegr
oup:
(
i)A col
l
ect
ionorgr
oupofphy
sicalandl
ogi
cal
resour
cesi
scal
l
edt
heSer
vicegr
oup.
(
ii
)Mov
ingser
vicegr
oupf
rom onesy
stem t
oanot
hersy
stem means,
mov
ingr
esour
ces
f
rom onesy
stem t
o anot
hersy
stem.
Resour
ces:
(
i)I
tisasof
twar
eorhar
dwar
ecomponent
sli
ke,
diskgr
oup,v
olume,I
Paddr
ess,
mountpoi
ntar
esof
twar
e r
esour
cesanddi
sk,NI
Ccar
dsar
ehar
dwar
e
r
esour
ces.
(
ii
)Thev
alueofr
esour
cei
sknownasAt
tri
but
e.
Exampl
e:(
a)Sy
stem l
i
sti
sat
tri
but
eofaSy
stem A orSy
stem B.
(
b)Aut
ost
arti
stheat
tri
but
eofSy
stem.
Resour
ce At
tri
but
e Val
ue

Rat
nakar
Page260
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

NI
C I
P addr
ess 192.
168.
1.1
Di
skgr
oup di
skgr
oupname appsdg
Di
sk di
skname di
sk01
I
nter
face I
nter
facename et
h0

(
ii
i)Ther
ear
etwot
ypesofr
esour
ces.
(
a)Per
sist
entResour
ce:
Thoser
esour
ceswhi
chwecannotst
artorst
opar
ecal
l
edPer
sist
entr
esour
ces.
` Somer
esour
ceswecanst
art
/st
opandsomeot
herr
esour
ceswecannotst
opor
st
art
.
Exampl
e:Wecannotst
artorst
opt
heNI
Ccar
d.
(
b)Non-Per
sist
entResour
ce:
Thoser
esour
ceswhi
chwecanst
art
/st
opar
ecal
l
edNon-Per
sist
ent
Resour
ces.
(
iv)Resour
cesmaybecr
it
icalornon-
cri
ti
cal
.Weneedt
odesi
gnt
her
esour
cesas
cr
it
ical
ornon-
cri
ti
cal
.i
e.,
the cust
omerwi
l
linsi
stswhi
chi
scr
it
icaland
whi
chi
snon-
cri
ti
cal
.
(
v)I
fcr
it
ical
resour
cei
sfai
l
ed,
thenonl
ytheser
vicegr
oupmov
edaut
omat
ical
l
yfr
om
onesy
stem t
oanot
her sy
stem.i
e.,f
ail
over
,ot
her
wisei
fnon-
cri
ti
cal
resour
ce
i
sfai
l
ed,
thenweneedt
othemanual
mov
ementof ser
vicegr
oupf
rom one
sy
stem t
oanot
hersy
stem.i
e.,swi
tchov
er.
46.Whatar
ethest
epsy
ouf
oll
owt
oputt
hev
olumei
naCl
ust
er?
(
i)Fi
rstcr
eat
ethedi
skgr
oup,v
olumeandcr
eat
ethef
il
esy
stem andmountand
unmountbef
oreputt
he v
olumei
nacl
ust
erbecauset
est
ingoft
hatv
olumei
s
wor
kingornot
.
(
ii
)Cr
eat
etheser
vicegr
oupandaddt
heAt
tri
but
est
oit
.
#hagr
p -
add <ser
vicegr
oup>
Exampl
e:#hagr
p -
add appssg

At
tri
but
es:
#hagr
p-modi
fy appssg sy
stem l
i
st={sy
sA0,sy
sB0} (
toaddsy
sA andsy
sB
at
tri
but
est
oser
vicegr
oup)
#hagr
p -
modi
fy appssg aut
ost
artl
i
st={sy
sA} (
tost
artt
hesy
sA
at
tri
but
esaut
omat
ical
l
y)
#hagr
p -
modi
fy appssg enabl
ed 1 or0(
1meansst
artand0meansnott
o
st
artaut
omat
ical
l
y)
(
ii
i) Cr
eat
ingr
esour
cesandaddi
ngt
hem t
otheser
vicegr
oupandspeci
fy
t
hei
rat
tri
but
es.
Forf
il
esy
stem :
(
a)/
mnt
/apps (
themountpoi
nt)

Rat
nakar
Page261
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
b)/
appsv
ol (
thev
olumename)
(
c)/
appsdg (
thedi
skgr
oup)
#har
es -
add dg-
apps di
skgr
oup appssg (
toaddt
hedi
skgr
oup
r
esour
cet
oaser
vicegr
oup)
(
wher
e dg-
appsi
sresour
cename,di
skgr
oup i
sakey
wor
d andappssg i
sa
ser
vicegr
oupname)
#har
es -
modi
fy dg-
apps di
skgr
oup appsdg (
toaddt
hedi
skgr
oupat
tri
but
eto
aser
vicegr
oup)
#har
es -
modi
fy dg-
apps enabl
e1 (
toenabl
ether
esour
ce)
#har
es -
add dg-
vol
ume v
olume appssg (
toaddt
hev
olume
r
esour
cet
oaser
vicegr
oup)
#har
es -
modi
fy dg-
vol
ume v
olume appsv
ol (
toaddt
hev
olumeat
tri
but
etoa
ser
vicegr
oup)
#har
es -
modi
fy dg-
vol
ume di
skgr
oup appsdg(
toaddt
hedi
skgr
oupt
othe
v
olume)
#har
es -
modi
fy dg-
vol
ume enabl
e1 (
toenabl
ethev
olumer
esour
ce)
#har
es -
modi
fy dg-
vol
ume cr
it
ical1 (
tomaket
her
esour
ceascr
it
ical
)
#har
es -
add dg-
mnt mount appssg (
toaddt
hemountpoi
ntr
esour
ce
t
oaser
vicegr
oup)
#har
es -
modi
fy dg-
mnt bl
ockdev
ice=/
dev
/vx/
rdsk/
appsdg/
appsv
ol (
toadd
t
hebl
ockdev
icer
esour
ce
t
oaser
vicegr
oup)
#har
es -
modi
fy dg-
mnt f
sty
pe=v
xfs (
toaddt
hemountpoi
ntat
tri
but
es
t
oaser
vicegr
oup)
#har
es -
modi
fy dg-
mnt mount
=/mnt
/apps (
toaddt
hemountpoi
nt
di
rect
oryat
tri
but
etoa
ser
vicegr
oup)
#har
es -
modi
fy dg-
mnt f
sckopt
=%y or %n(
toaddt
hef
sckat
tri
but
eei
ther
y
esornot
o
ser
vicegr
oup)
(
iv)Cr
eat
eli
nksbet
weent
heabov
edi
skgr
oup,v
olume and mountpoi
ntr
esour
ces.
#har
es -
li
nk par
ent
-r
es chi
l
d-r
es
#har
es -
li
nk dg-
appdg dg-
vol
ume
#har
es -
li
nk dg-
vol
ume dg-
mnt
47.Whati
smeantbyf
reezi
ng andunf
reezi
ngaser
vicegr
oupwi
thper
sist
entand
ev
acuat
eopt
ions?
Fr
eezi
ng:
I
fwewantt
oappl
ypat
chest
othesy
stem i
nacl
ust
er,
thenwehav
etof
reezet
he
ser
vicegr
oupbecausef
ir
st st
opt
heser
vicegr
oup,i
fiti
scr
it
ical
,theser
vicegr
oupwi
l
l
mov
eaut
omat
ical
l
ytoanot
hersy
stem i
nCl
ust
er. So,
wedon'
twantt
omov
etheser
vice

Rat
nakar
Page262
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

gr
oupf
rom onesy
stem t
oanot
hersy
stem,wehav
etof
reezet
he ser
vicegr
oup.
Unf
reeze:
Af
tercompl
eti
ngt
het
ask,
theser
vicegr
oupshoul
dbeunf
reez
edbecause,i
fthei
s
cr
ashedordownandt
he r
esour
cesar
ecr
it
ical
,thent
heser
vicegr
oupcannotmov
e
f
rom sy
stem 1 t
o sy
stem 2duet
ofr
eezedt
he ser
vicegr
oupandr
esul
tsi
nnot
av
ail
abl
eofappl
i
cat
ion.I
funf
reezedt
heser
vicegr
oupaf
termai
ntenance,t
he ser
vice
gr
oupcanmov
efr
om sy
stem 1t
osy
stem 2.So,i
fsy
stem 1f
ail
ed,
thesy
stem2i
s
av
ail
abl
eand appl
i
cat
ional
soav
ail
abl
e.
Per
sist
entopt
ion:
I
ftheser
vicegr
oupi
sfr
eezedwi
thper
sist
entopt
ion,t
henwecanst
opordownor
r
est
artt
hesy
stem.So, t
her
eisnol
ossofdat
aandaf
terr
est
art
edt
hesy
stem,
the
ser
vicegr
oupi
sremai
nsi
nfr
eezedst
ateonl
y.
Exampl
e:#hasy
s -
fr
eeze -
per
sist
ent <sy
stem name>
#hasy
s -
unf
reeze -
per
sist
ent <sy
stem name>
Ev
acuat
e:
I
fthi
sopt
ioni
susedi
nfr
eezedser
vicegr
oupsy
stem,i
fthesy
stem downorr
est
art
ed
t
heper
sist
ed i
nfor
mat
ioni
sev
acuat
ed,i
e.,bef
oref
reezeal
ltheser
vicegr
oupsshoul
dbe
mov
edf
rom sy
stem 1t
oanot
her sy
stem 2.
48.Whatar
ethel
ayout
sar
eav
ail
abl
einVxVM andhowt
heywi
l
lwor
kandhowt
o
conf
igur
e?
(
i)Ther
ear
e5l
ayout
sav
ail
abl
einVxVM.Theyar
eRAI
D-0,RAI
D-1,RAI
D-5,RAI
D-0+1
andRAI
D-1+0.
RAI
D-0:
Wecanconf
igur
eRAI
D-0i
ntwoway
s.
(
a)St
ri
pped(
def
aul
t)
.
(
b)Concat
enat
ion.
St
ri
pped:
(
i)I
nthi
smi
nimum t
wodi
sksr
equi
redt
oconf
igur
e.
(
ii
)Int
hist
hedat
awi
l
lwr
it
eonbot
hthedi
skspar
all
ell
y.i
e.,
onel
i
nei
nonedi
skand2nd
l
i
neon2nddi
sk,
..
.et
c.,
(
ii
i)I
nthi
sthedat
awr
it
ingspeedi
sfast
.
(
iv)I
nthi
sther
eisnor
edundancyf
ordat
a.
Concat
enat
ion:
(
i)I
nthi
smi
nimum onedi
ski
srequi
redt
oconf
igur
e.
(
ii
)Int
hist
hedat
awi
l
lwr
it
einf
ir
stdi
skandaf
terf
il
li
ngoff
ir
stdi
skt
heni
twi
l
lwr
it
eon
2nddi
sk.
(
ii
i) I
nthi
sthedat
awr
it
ingspeedi
sless.
(
iv) I
nthi
sal
sot
her
eisnor
edundancyf
ordat
a.
RAI
D-1:
(
I)I
tisnot
hingbutmi
rr
ori
ng.

Rat
nakar
Page263
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
ii
)Int
hismi
nimum 4di
sksar
erequi
redt
oconf
igur
e.
(
ii
i) I
nthi
ssamedat
awi
l
lbewr
it
tenondi
sk1anddi
sk3,di
sk2anddi
sk4.
(
iv) I
fdi
sk1f
ail
ed,
thenwecanr
ecov
ert
hedat
afr
om di
sk3andi
fdi
sk2f
ail
ed,
t
henwecanr
ecov
ert
hedat
a f
rom di
sk4.So,t
her
eisnodat
alossorwecan
mi
nimi
zet
hedat
aloss.
(
v)I
nthi
shal
foft
hedi
skspacemaybewast
ed.
RAI
D-5:
(
i)I
tisnot
hingbutst
ri
ppedwi
thdi
str
ibut
edpar
it
y.
(
ii
)Int
hismi
nimum 3di
sksr
equi
redt
oconf
igur
e.
(
ii
i) I
nthi
sonel
i
newi
l
lwr
it
eondi
sk1 and 2ndl
i
newr
it
eondi
sk2andt
he
par
it
ybi
twi
l
lwr
it
eondi
sk3.The par
it
ybi
twi
l
lwr
it
eon3di
sksi
mul
taneousl
y.I
f
di
sk1f
ail
edt
henwecanr
ecov
ert
hedat
afr
om di
sk2and par
it
ybi
tfr
om di
sk3.So,
i
nthi
sdat
awi
l
lbemor
esecur
ed.
(
iv) I
nthi
sdi
skut
il
iz
ati
oni
smor
ewhencompar
edt
oRAI
D-1,
ie.
,1/
3rdofdi
sk
spacemaybewast
ed.
(
v)Thi
sRAI
D-5wi
l
lbeconf
igur
edf
orcr
it
ical
appl
i
cat
ionsl
i
keBanki
ng,Fi
nanci
al,SAX
and I
nsur
ance.
..
etc.
, becauset
hedat
amustbemor
esecur
ed.
Cr
eat
ingav
olumewi
thl
ayout:
#v
xassi
st -
g <di
skgr
oupname> make <v
olumename><si
zei
nGB/
TB>
l
ayout
=<mi
rr
or/
rai
d5/
rai
d1>
Exampl
e:#v
xassi
st -
g appsdg make appsv
ol 50GB l
ayout
=rai
d5 (
the
def
aul
tisRAI
D-5i
nVxVM)

Logs:
*I
fthel
ayouti
smi
rr
or,
thenl
ogi
sDRL.
*I
fthel
ayouti
sRAI
D-5,
thent
hel
ogi
sRAI
D-5l
og.
* Themai
npur
poseoft
hel
ogi
sfastr
ecov
eryoper
ati
on.
* Wehav
etospeci
fywhet
hert
hel
ogi
srequi
redornoti
nal
lty
pesofl
ayout
sexcept
RAI
D-5becauset
he l
oggi
ngi
sdef
aul
tinRAI
D-5.
*I
fwewantt
oconf
igur
eRAI
D-5wi
thoutl
oggi
ngt
hen,
#v
xassi
st -
g <di
skgr
oupname> make <v
olumename> 50GB,nol
og
l
ayout
=rai
d5
*I
fthel
ayouti
sot
hert
hanRAI
D-5t
hen,
#v
xassi
st -
g <di
skgr
oupname> make <v
olumename> 50GB,l
og
l
ayout
=mi
rr
or
*I
fwewantt
oaddt
hel
ogt
otheex
ist
ingv
olumet
hen,
#v
xassi
st -
g <di
skgr
oupname> addl
og l
ogt
ype=dr
lorr
aid5
*I
fwewantt
oremov
ethel
ogf
rom t
heexi
sti
ngv
olumet
hen,
#v
xassi
st -
g <di
skgr
oupname> r
mlog <v
olumename>
49.Whati
sreadpol
icyandhowmanyt
ypesofr
eadpol
ici
esav
ail
abl
e?

Rat
nakar
Page264
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

Readpol
i
cymeans,
howt
hedi
skorv
olumeshoul
dber
eadwhenaccessi
ngt
hedat
a.
Ty
pesofr
eadpol
ici
es:
(
i)Sel
ect
(
ii
)Pr
efer
(
ii
i) RoundRobi
n
* Bydef
aul
tther
eadpol
i
cyi
sRoundRobi
n.
#v
xvol -
g <di
skgr
oupname> r
dpol
=<sel
ect
/pr
efer
/roundr
obi
n <v
olume
name>
50.Whati
syourr
olei
nVxVM?
Nor
mal
l
y,wegetr
equest
sfr
om appl
i
cat
ion,
dev
elopment
,pr
oduct
ionand QA peopl
e
l
i
ke,
(
i)Cr
eat
eav
olume.
(
ii
)Incr
easet
hev
olume.
(
ii
i) Decr
easet
hev
olume.
(
iv) Pr
ovi
deRedundancybyi
mpl
ement
ingRAI
D-1 orRAI
D-5.
(
v)Pr
ovi
det
her
equi
redper
missi
ons.
(
vi)Putt
hev
olumei
ntheVi
rt
ual
machi
ne.
(
vii
)Putt
hev
olumei
ntheCl
ust
er.
(
vii
i
)Pr
ovi
dehi
ghav
ail
abi
l
ityt
otheappl
i
cat
ionsanddat
abases.
(
ix)Somet
imesdest
royorr
emov
ethev
olume.
(
x)Backupandr
est
oret
hedat
awhenev
ernecessar
y.
Andsomet
imeswegetsomet
roubl
eshoot
ingi
ssuesl
i
ke,
(
i)Vol
umei
snotst
art
ed.
(
ii
)Vol
umei
snotaccessi
ble.
(
ii
i)Mountpoi
ntdel
eted.
(
iv) Fi
l
esy
stem cr
ashed.
(
v)Onedi
skf
ail
edi
nav
olume.
(
vi)Vol
umemanagerdeamonsar
enotr
unni
ng.
(
vii
)Vol
umemanagerconf
igur
ati
onf
il
esmi
ssedordel
eted.
(
vii
i
)VxVM l
i
censi
ngi
ssues.
(
ix) Di
skgr
oupnotdepor
ti
ngandnoti
mpor
ti
ng.
(
x)Vol
umei
sst
art
ed,deamonsar
erunni
ngbutuser
scannotaccessi
ngt
hedat
a.
(
xi)Di
skar
enotdi
tect
ed.
(
xii
)Har
dwar
eandsof
twar
eer
ror
s.
51.Whati
smeantbysnapbackupandhowt
otaket
hesnapbackup?
(
i)Snapbackupmeans,t
aki
ngbackupusi
ngsnapshot
s.
(
ii
)In24X7/
365day
srunni
ngser
ver
snor
mal
l
ywet
akesnapbackup.
ie.
,nodownt
ime
al
l
owed.
(
ii
i)Theabov
esai
dser
ver
sar
ecal
l
edBCV(
Busi
nessCont
inui
tyVol
umes)
.
Backup:

Rat
nakar
Page265
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Fi
rstst
opt
heAppl
i
cat
ion.
(
ii
) St
opt
heDat
abase.
(
ii
)Unmountt
hef
il
esy
stem.
(
ii
i) St
opt
hev
olume.
(
iv) Depor
tthedi
skgr
oup.
(
v)I
mpor
tthedi
skgr
oup.
(
vi) Joi
nthesnapdi
skgr
oup.
(
vii
)Sy
nci
ngt
hedat
a.
(
vii
i
)Taket
hebackup.
(
ix)Spl
i
tthesnapdi
skgr
oup.
(
x)Depor
tthedi
skgr
oup.
(
xi) I
mpor
tthedi
skgr
oup.
(
xii
)St
artt
hev
olume.
(
xii
i
)Mountt
hef
il
esy
stem.
(
xiv
)St
artt
heDat
abase.
(
xv)St
artt
heAppl
i
cat
ion.
52.Whatar
ethest
epsy
ouf
oll
owt
orenameadi
skgr
oup?
(
i)St
opt
heAppl
i
cat
ion.
(
ii
)St
opt
heDat
abase.
(
ii
i)Unmountt
hef
il
esy
stem.
(
iv) St
opt
hev
olume.
(
v)Depor
tthedi
skgr
oup.
(
vi)Renamet
hedi
skgr
oup.
(
vii
)Impor
tthedi
skgr
oupby
#v
xdg -
n <new di
skgr
oupname> i
mpor
t <ol
ddi
skgr
oupname>
command.
(
vii
i
)St
artt
hev
olume.
(
ix)Mountt
hef
il
esy
stem.
(
x)St
artt
heDat
abase.
(
xi)St
artt
heAppl
i
cat
ion.
53.Howt
oinst
allVxVM?Whatv
ersi
onofVer
it
asy
ouar
eusi
ngandhowt
oknowt
he
v
eri
tasv
ersi
on?
(
i)I
nst
all
thev
eri
tassuppl
i
edpackagesusi
ng#r
pm or#y
um commands.
(
ii
)Execut
ethecommand #v
xinst
allt
oinst
allVxVM i
e.,enabl
ethesy
stem t
ouse
v
olumemanager
.
(
ii
i)#v
xinst
allwi
l
lal
l
owust
oencapsul
ateornotencapsul
atet
her
ootdi
sk.
(
iv)Al
way
suseopt
ion2i
e.,
Cust
om i
nst
all
ati
onbecause,
ifopt
ion1i
susedi
e.,Qui
ck
i
nst
all
ati
on,i
ttakesal
l t
hedi
sksf
orr
oot
dg.

Li
cense:

Rat
nakar
Page266
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

(
i)Al
lthel
i
censesar
est
oredi
n/et
c/v
x/l
icenses di
rect
oryandwecant
akebackup
oft
hisdi
rect
oryand r
est
orei
tback,
ifweneedr
einst
all
theser
ver
.
(
ii
)Remov
ing VxVM packagewi
l
lnotr
emov
ethei
nst
all
edl
i
cense.
(
ii
i) Toi
nst
alll
i
cense#v
xli
cinstcommandi
sused.
(
iv)Toseet
heVxVM l
i
censei
nfor
mat
ionby #v
xli
crep command.
(
v)Tor
emov
etheVxVM l
i
censeby #v
xkey
less setNONE command.
(
vi)
Thel
i
censepackagesar
einst
all
edi
n/opt
/VRTSv
li
c/bi
n/v
xli
crep di
rect
ory
.
(
vii
)Thel
i
censekey
sar
est
oredi
n/et
c/v
x/l
i
censes/
li
c di
rect
ory
.
(
vii
i
)Wecanseet
hel
i
censesbyexecut
ingt
hebel
owcommands,
#cat/
etc/
vx/
li
censes/
li
c/key or
#cat/
opt
/VRTSv
li
c/bi
n/v
xli
crep|gr
ep "
Licensekey
"
(
ix)Toseet
hef
eat
uresofl
i
censekeyby #v
xdct
lli
cense command.
Ver
sion:
(
i)Wear
eusi
ngVxVM6.
2ver
sion.
(
ii
)toknowt
hev
ersi
onofVxVM by#r
pm -
qa VRTSv
xvm command.
54.Whatar
etheav
ail
abl
efor
mat
stot
aket
hecont
rolofdi
sksf
rom O/
Stov
eri
tasi
n
VxVM?
Wecant
aket
hecont
rol
ofdi
sksf
rom O/
Stov
eri
tasi
n3f
ormat
s.
(
i)CDS(
Crosspl
atf
orm Dat
aShar
ing andt
hedef
aul
tfor
mati
nVx
VM)
.
(
ii
)Sl
i
ced.
(
ii
i)Si
mpl
e.
(
i)CDS:
(
a)Wecanshar
ethedat
abet
weendi
ff
erentUni
xfl
avour
s.
(
b)Thepr
ivat
eandpubl
i
cbot
hregi
onsar
eav
ail
abl
ein7t
hpar
ti
ti
on.
(
c)Theent
ir
espacei
sin7t
hpar
ti
ti
on.
(
d)So,
ther
eisachancet
olosst
hedat
abecause,
ift
hedi
ski
sfai
l
edi
e.,
par
ti
ti
on7
i
scor
rupt
edordamaged t
hent
hedat
amaybel
ost
.
(
e)Thi
sist
hedef
aul
tinv
eri
tasv
olumemanager
.
(
ii
)Sl
iced:
(
a)I
tisal
way
susedf
orr
ootdi
skonl
y.
(
b)I
nthi
sfor
matwecannotshar
ethedat
abet
weendi
ff
erentUni
xfl
avour
s.
Nor
mal
l
ysl
i
cedi
susedf
orr
oot di
sk and cdsi
susedf
ordat
a.
(
c)Pr
ivat
eregi
oni
sav
ail
abl
eat4t
hpar
ti
ti
onandpubl
i
cregi
oni
sav
ail
abl
eat3r
d
par
ti
ti
on.
(
d)So,
ifpubl
i
cregi
oni
sfai
l
ed,wecanr
ecov
ert
hedat
afr
om pr
ivat
eregi
oni
e.,
mi
nimi
zi
ngt
hedat
aloss.
(
ii
i)Si
mpl
e:
(
a)Thi
sfor
mati
snotusi
ngwi
del
ynowbecause,i
tisav
ail
abl
einol
dVxVM 3.
5
(
b)I
nthi
spr
ivat
eandpubl
i
cregi
onsar
eav
ail
abl
eat3r
dpar
ti
ti
on.
Speci
fyi
ngt
hef
ormatwhi
leset
up:

Rat
nakar
Page267
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#v
xdi
skset
up -
i/dev
/sda (
toset
upt
hedi
skandt
hisi
sdef
aul
tfor
mati
e.,
CDSf
ormat
)
#v
xdi
skset
up -
i /
dev
/sdb f
ormat=<sl
i
ced/si
mpl
e> (
tospeci
fy
sl
i
cedorsi
mpl
efor
mat
)
55.I
nhowmanyway
scanwemanageVxVM?
(
I)Commandl
i
net
ool
.
(
ii
)GUI(
vea t
ool
)
(
ii
i)#v
xdi
skadm command(
itgi
vest
heopt
ionst
omanaget
hedi
sks)
30.RedHatCl
ust
er

1. Howcany
oudef
ineacl
ust
erandwhatar
eit
sbasi
cty
pes?
Acl
ust
eri
stwoormor
ecomput
ers(
cal
l
ed 
nodes 
ormember
s)t
hatwor
ktoget
hert
o
per
for
m at
ask.Ther
ear
e f
ourmaj
ort
ypesofcl
ust
ers:
 St
orage
 Hi
ghav
ail
abi
l
ity
 Loadbal
anci
ng
 Hi
ghper
for
mance
2. Whati
sSt
orageCl
ust
er?
 St
oragecl
ust
erspr
ovi
deaconsi
stentf
il
esy
stem i
mageacr
ossser
ver
sinacl
ust
er,
al
l
owi
ngt
heser
ver
stosi
mul
taneousl
yreadandwr
it
etoasi
ngl
eshar
edf
il
e
sy
stem.
 
 Ast
oragecl
ust
ersi
mpl
i
fiesst
orageadmi
nist
rat
ionbyl
i
mit
ingt
hei
nst
all
ati
onand
pat
chi
ngofappl
i
cat
ionst
oonef
il
esy
stem.
 
 TheHi
ghAv
ail
abi
l
ityAdd-
Onpr
ovi
desst
oragecl
ust
eri
ngi
nconj
unct
ionwi
thRed
HatGFS2
3. Whati
sHi
ghAv
ail
abi
li
tyCl
ust
er?
 Hi
ghav
ail
abi
l
itycl
ust
erspr
ovi
dehi
ghl
yav
ail
abl
eser
vicesbyel
i
minat
ingsi
ngl
e
poi
ntsof
 f
ail
ureandbyf
ail
i
ngov
erser
vicesf
rom onecl
ust
ernodet
oanot
heri
n
caseanodebecomesi
noper
ati
ve.
 
 Ty
pical
l
y,ser
vicesi
nahi
ghav
ail
abi
l
itycl
ust
err
eadandwr
it
edat
a(v
iar
ead-
wri
te
mount
edf
il
esy
stems)

 Ahi
ghav
ail
abi
l
itycl
ust
ermustmai
ntai
ndat
aint
egr
it
yasonecl
ust
ernodet
akes
ov
ercont
rol
ofaser
vicef
rom anot
hercl
ust
ernode.
 
 Nodef
ail
uresi
nahi
ghav
ail
abi
l
itycl
ust
erar
enotv
isi
blef
rom cl
i
ent
sout
sidet
he
cl
ust
er.
 
 Hi
ghav
ail
abi
l
itycl
ust
ersar
esomet
imesr
efer
redt
oasf
ail
overcl
ust
ers.
4. Whati
sLoadBal
anci
ngCl
ust
er?
 Load-
bal
anci
ngcl
ust
ersdi
spat
chnet
wor
kser
vicer
equest
sto 
mul
ti
ple 
clust
er
nodest
obal
ancet
her
equestl
oadamongt
hecl
ust
ernodes.
 
 Loadbal
anci
ngpr
ovi
descost
-ef
fect
ivescal
abi
l
itybecausey
oucanmat
cht
he

Rat
nakar
Page268
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

numberofnodesaccor
dingt
oloadr
equi
rement
s.I
fanodei
nal
oad-
bal
anci
ng
cl
ust
erbecomesi
noper
ati
ve,
thel
oad-
bal
anci
ngsof
twar
edet
ect
sthef
ail
ureand
r
edi
rect
srequest
stoot
hercl
ust
ernodes.
 
 Nodef
ail
uresi
nal
oad-
bal
anci
ngcl
ust
erar
enotv
isi
blef
rom cl
i
ent
sout
sidet
he
cl
ust
er.
 
 Loadbal
anci
ngi
sav
ail
abl
ewi
tht
heLoadBal
ancerAdd-
On.
5. Whati
saHi
ghPer
for
manceCl
ust
er?
 Hi
gh-
per
for
mancecl
ust
ersusecl
ust
ernodest
oper
for
m concur
rentcal
cul
ati
ons.
 
 Ahi
gh-
per
for
mancecl
ust
eral
l
owsappl
i
cat
ionst
owor
kinpar
all
el,
ther
efor
e
enhanci
ngt
heper
for
manceoft
heappl
i
cat
ions.
 
 Hi
ghper
for
mancecl
ust
ersar
eal
sor
efer
redt
oascomput
ati
onal
clust
ersorgr
id
comput
ing.
6. Howmanynodesar
esuppor
tedi
nRedhat6Cl
ust
er?
Acl
ust
erconf
igur
edwi
thqdi
skdsuppor
tsamaxi
mum of16nodes.Ther
easonf
ort
he
l
i
miti
sbecauseof scal
abi
l
ity
;incr
easi
ngt
henodecounti
ncr
easest
heamountof
sy
nchr
onousI
/Ocont
ent
ionont
heshar
ed quor
um di
skdev
ice.
7. Whati
sthemi
nimum si
zeoft
heQuor
um Di
sk?
Themi
nimum si
zeoft
hebl
ockdev
icei
s10Megaby
tes.

8. Whati
stheor
deri
nwhi
chy
ouwi
llst
artt
heRedHatCl
ust
erser
vices?
I
nRedHat4:
#ser
viceccsdst
art
#ser
vicecmanst
art
#ser
vicef
encedst
art
ser
vicecl
vmdst
art(
IfCLVM hasbeenusedt
ocr
eat
ecl
ust
eredv
olumes)
#ser
vicegf
sst
art
#ser
vicer
gmanagerst
art
I
nRedHat5:
#ser
vicecmanst
art
#ser
vicecl
vmdst
art
#ser
vicegf
sst
art
#ser
vicer
gmanagerst
art
I
nRedHat6:
#ser
vicecmanst
art
#ser
vicecl
vmdst
art
#ser
vicegf
s2st
art
#ser
vicer
gmanagerst
art
9. Whati
stheor
dert
o st
op 
theRedHatCl
ust
erser
vices?
I
nRedHat4:
#ser
vicer
gmanagerst
op

Rat
nakar
Page269
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
vicegf
sst
op
#ser
vicecl
vmdst
op
#ser
vicef
encedst
op
#ser
vicecmanst
op
#ser
viceccsdst
op
I
nRedHat5:
#ser
vicer
gmanagerst
op
#ser
vicegf
sst
op
#ser
vicecl
vmdst
op
#ser
vicecmanst
op
I
nRedHat6:
#ser
vicer
gmanager
stop
#ser
vicegf
s2st
op
#ser
vicecl
vmdst
op
#ser
vicecmanst
op
10.Whatar
etheper
for
manceenhancement
sinGFS2ascompar
edt
oGFS?
 Bet
terper
for
mancef
orheav
yusagei
nasi
ngl
edi
rect
ory
 Fast
ersy
nchr
onousI
/Ooper
ati
ons
 Fast
ercachedr
eads(
nol
ocki
ngov
erhead)
 Fast
erdi
rectI
/Owi
thpr
eal
l
ocat
edf
il
es(
prov
idedI
/Osi
zei
sreasonabl
ylar
ge,
such
as4M bl
ocks)
 Fast
erI
/Ooper
ati
onsi
ngener
al
 Fast
erExecut
ionoft
hedfcommand,
becauseoff
ast
erst
atf
scal
l
s
 I
mpr
ovedat
imemodet
oreducet
henumberofwr
it
eI/
Ooper
ati
onsgener
atedby
at
imewhencompar
edwi
thGFS
 GFS2suppor
tst
hef
oll
owi
ngf
eat
ures.
 ext
endedf
il
eat
tri
but
es(
xat
tr
)
 t
he 
l
sat
tr
() 
and 
chat
tr
() 
att
ri
but
eset
ti
ngsv
iast
andar
d i
oct
l(

cal
l
s
 nanosecondt
imest
amps
 GFS2usesl
essker
nel
memor
y.
 GFS2r
equi
resnomet
adat
agener
ati
onnumber
s.
 Al
l
ocat
ingGFS2met
adat
adoesnotr
equi
rer
eads.Copi
esofmet
adat
abl
ocksi
n
mul
ti
plej
our
nal
sar
emanagedbyr
evoki
ngbl
ocksf
rom t
hej
our
nal
bef
ore 
l
ock 
rel
ease.
 GFS2i
ncl
udesamuchsi
mpl
erl
ogmanagert
hatknowsnot
hingaboutunl
i
nked
i
nodesorquot
achanges.
 Thegf
s2_
growandgf
s2_
jaddcommandsusel
ocki
ngt
o pr
event
 mul
ti
plei
nst
ances
r
unni
ngatt
hesamet
ime.
 TheACLcodehasbeensi
mpl
i
fiedf
orcal
l
sli
kecr
eat
()andmkdi
r(
).
 Unl
i
nkedi
nodes,
quot
achanges,
andst
atf
schangesar
erecov
eredwi
thout

Rat
nakar
Page270
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

r
emount
ingt
hej
our
nal
.
11.Whati
sthemaxi
mum f
il
esy
stem suppor
tsi
zef
orGFS2?
 GFS2i
sbasedon64bi
tar
chi
tect
ure,
whi
chcant
heor
eti
cal
l
yaccommodat
ean8EB
f
il
esy
stem.
 
 However
,thecur
rentsuppor
tedmaxi
mum si
zeofaGFS2f
il
esy
stem f
or64-
bit
har
dwar
eis100TB.
 
 Thecur
rentsuppor
tedmaxi
mum si
zeofaGFS2f
il
esy
stem f
or32-
bithar
dwar
efor
RedHatEnt
erpr
iseLi
nuxRel
ease5.
3andl
ateri
s16TB.
 
NOTE:
 
Iti
sbet
tert
ohav
e101TBf
il
esy
stemst
hanone10TBf
il
esy
stem.
12.Whati
sthej
our
nal
ingf
il
esy
stem?
 Aj
our
nal
i
ngf
il
esy
stem i
saf
il
esy
stem t
hatmai
ntai
nsaspeci
alf
il
ecal
l
edaj
our
nal
t
hati
susedt
orepai
ranyi
nconsi
stenci
est
hatoccurast
her
esul
tofani
mpr
oper
shut
downofacomput
er.
 I
njour
nal
i
ngf
il
esy
stems,
ever
yti
meGFS2wr
it
esmet
adat
a,t
hemet
adat
ais
commi
tt
edt
othej
our
nal
bef
orei
tisputi
ntopl
ace.
 
 Thi
sensur
est
hati
fthesy
stem cr
ashesorl
osespower
,youwi
l
lrecov
eral
loft
he
met
adat
awhent
hej
our
nal
isaut
omat
ical
l
yrepl
ayedatmountt
ime.
 GFS2r
equi
resonej
our
nal
foreachnodei
nthecl
ust
ert
hatneedst
omountt
hef
il
e
sy
stem.Forexampl
e,i
fyouhav
ea16-
nodecl
ust
erbutneedt
omountonl
ythef
il
e
sy
stem f
rom t
wonodes,
youneedonl
ytwoj
our
nal
s.I
fyouneedt
omountf
rom a
t
hir
dnode,
youcanal
way
saddaj
our
nal
wit
hthegf
s2_
jaddcommand.
13.Whati
sthedef
aul
tsi
zeofj
our
nal
sinGFS?
Wheny
our
unmkf
s.gf
s2wi
thoutt
hesi
zeat
tri
but
eforj
our
nal
tocr
eat
eaGFS2par
ti
ti
on,
bydef
aul
ta128MB si
zej
our
nal
iscr
eat
edwhi
chi
senoughf
ormostoft
heappl
i
cat
ions
I
ncasey
oupl
anonr
educi
ngt
hesi
zeoft
hej
our
nal
,i
tcansev
erel
yaf
fectt
he
per
for
mance.
 Suppose 
your
educe t
hesi
zeoft
hej
our
nal
to32MBi
tdoesnott
akemuch
f
il
esy
stem act
ivi
tyt
ofi
l
lan32MBj
our
nal
,andwhent
he j
our
nal
isf
ull
,per
for
mancesl
ows
becauseGFS2hast
owai
tforwr
it
est
othest
orage.
14.Whati
saQuor
um Di
sk?
 Quor
um Di
ski
sadi
sk-
basedquor
um daemon,
qdi
skd,
thatpr
ovi
dessuppl
ement
al
heur
ist
icst
odet
ermi
nenodef
it
ness.
 Wi
thheur
ist
icsy
oucandet
ermi
nef
act
orst
hatar
eimpor
tantt
otheoper
ati
onoft
he
nodei
ntheev
entofanet
wor
kpar
ti
ti
on
Fora3nodecl
ust
eraquor
um st
atei
spr
esentunt
il2oft
he3nodesar
eact
ivei
.e.mor
e
t
hanhal
f.Butwhati
fduet
osomer
easonst
he2ndnodeal
sost
opscommuni
cat
ingwi
th
t
he3r
dnode?I
nthatcaseundera nor
mal
archi
tect
uret
hecl
ust
erwoul
ddi
ssol
veandst
op
wor
king.Butf
ormi
ssi
oncr
it
ical
env
ironment
sandsuch scenar
iosweusequor
um di
ski
n
whi
chanaddi
ti
onal
diski
sconf
igur
edwhi
chi
smount
edonal
lthenodeswi
th qdi
skd
ser
vicer
unni
ngandav
otev
aluei
sassi
gnedt
oit
.
Sosupposei
nabov
ecaseIhav
eassi
gned1v
otet
oqdi
sksoev
enaf
ter2nodesst
ops

Rat
nakar
Page271
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

communi
cat
ingwi
th3r
d node,
thecl
ust
erwoul
dhav
e2v
otes(
1qdi
sk+1f
rom 3r
d
node)whi
chi
sst
il
lmor
ethanhal
fofv
otecountf
ora 3nodecl
ust
er.Nowbot
hthe
i
nact
ivenodeswoul
dbef
encedandy
our3r
dnodewoul
dbest
il
lupandr
unni
ng bei
nga
par
toft
hecl
ust
er.
15.Whati
srgmanageri
nRedHatCl
ust
erandi
tsuse?
 Thi
sisaser
vicet
ermedasResour
ceGr
oupManager
 RGManagermanagesandpr
ovi
desf
ail
overcapabi
l
iti
esf
orcol
l
ect
ionsofcl
ust
er
r
esour
cescal
l
edser
vices,
resour
cegr
oups,
orr
esour
cet
rees
 i
tal
l
owsadmi
nist
rat
orst
odef
ine,
conf
igur
e,andmoni
torcl
ust
erser
vices.I
nthe
ev
entofanodef
ail
ure,
rgmanagerwi
l
lrel
ocat
ethecl
ust
eredser
vicet
oanot
her
nodewi
thmi
nimal
ser
vicedi
srupt
ion.
16.Whati
s l
uci
 andr
iccii
nRedHatCl
ust
er?
 l
uci
 
ist
heser
vercomponentoft
heCongaadmi
nist
rat
ionut
il
it
y
 Congai
sani
ntegr
atedsetofsof
twar
ecomponent
sthatpr
ovi
descent
ral
i
zed
conf
igur
ati
onandmanagementofRedHatcl
ust
ersandst
orage
 l
uci
isaser
vert
hatr
unsononecomput
erandcommuni
cat
eswi
thmul
ti
plecl
ust
ers
andcomput
ersv
iar
icci

 r
icci
 i
sthecl
i
entcomponentoft
heCongaadmi
nist
rat
ionut
il
it
y
 r
icci
isanagentt
hatr
unsoneachcomput
er(
eit
heracl
ust
ermemberora
st
andal
onecomput
er)managedbyConga
 Thi
sser
viceneedst
ober
unni
ngonal
lthecl
i
entnodesoft
hecl
ust
er.
17.Whati
scmani
nRedHatCl
ust
er?
 Thi
sisanabbr
evi
ati
onusedf
orCl
ust
erManager

 CMANi
sadi
str
ibut
edcl
ust
ermanagerandr
unsi
neachcl
ust
ernode.
 
 I
tisr
esponsi
blef
ormoni
tor
ing,
hear
tbeat
,quor
um,
vot
ingandcommuni
cat
ion
bet
weencl
ust
ernodes.
 CMANkeepst
rackofcl
ust
erquor
um bymoni
tor
ingt
hecountofcl
ust
ernodes.
18.Whatar
ethedi
ff
erentpor
tno.usedi
nRedHatCl
ust
er?
I
PPor
tno. Pr
otocol Component
5404,
5405 UDP cor
osy
nc/
cman
11111 TCP r
icci
21064 TCP dl
m(Di
str
ibut
edLockManager
)
16851 TCP Modcl
ust
ered
8084 TCP l
uci
4196,
4197 TCP r
gmanager

19.HowdoesNet
wor
kManagerser
viceaf
fect
sRedHatCl
ust
er?
 TheuseofNet
wor
kManageri
snotsuppor
tedoncl
ust
ernodes.I
fyouhav
einst
all
ed
Net
wor
kManagerony
ourcl
ust
ernodes,
youshoul
dei
therr
emov
eitordi
sabl
eit
.

Rat
nakar
Page272
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

#ser
viceNet
wor
kManagerst
op
#chkconf
igNet
wor
kManagerof
f
 Thecmanser
vicewi
l
lnotst
arti
fNet
wor
kManageri
sei
therr
unni
ngorhasbeen
conf
igur
edt
orunwi
tht
hechkconf
igcommand
20.Whati
sthecommandusedt
orel
ocat
easer
vicet
oanot
hernode?
#cl
usv
cadm -

ser
vice_
name 
-m 
node_
name
21.Whati
sspl
it
-br
aincondi
ti
oni
nRedHatCl
ust
er?
 Wesayacl
ust
erhasquor
um i
famaj
ori
tyofnodesar
eal
i
ve,
communi
cat
ing,
and
agr
eeont
heact
ivecl
ust
ermember
s.Forexampl
e,i
nat
hir
teen-
nodecl
ust
er,
quor
um i
sonl
yreachedi
fsev
enormor
enodesar
ecommuni
cat
ing.I
fthesev
ent
h
nodedi
es,
thecl
ust
erl
osesquor
um andcannol
ongerf
unct
ion.
 Acl
ust
ermustmai
ntai
nquor
um t
opr
eventspl
i
t-br
aini
ssues.
 I
fquor
um wasnotenf
orced,
quor
um,
acommuni
cat
ioner
roront
hatsamet
hir
teen-
nodecl
ust
ermaycauseasi
tuat
ionwher
esi
xnodesar
eoper
ati
ngont
heshar
ed
st
orage,
whi
l
eanot
hersi
xnodesar
eal
sooper
ati
ngoni
t,i
ndependent
ly.Becauseof
t
hecommuni
cat
ioner
ror
,thet
wopar
ti
al-
clust
erswoul
dov
erwr
it
ear
easoft
hedi
sk
andcor
ruptt
hef
il
esy
stem.
 Wi
thquor
um r
ulesenf
orced,
onl
yoneoft
hepar
ti
alcl
ust
erscanuset
heshar
ed
st
orage,
thuspr
otect
ingdat
aint
egr
it
y.
 Quor
um doesn'
tpr
eventspl
i
t-br
ainsi
tuat
ions,
buti
tdoesdeci
dewhoi
sdomi
nant
andal
l
owedt
ofunct
ioni
nthecl
ust
er.
 quor
um canbedet
ermi
nedbyacombi
nat
ionofcommuni
cat
ingmessagesv
ia
Et
her
netandt
hroughaquor
um di
sk.
22.Whatar
eTi
e-br
eaker
sinRedHatCl
ust
er?
 Ti
e-br
eaker
sar
eaddi
ti
onal
heur
ist
icst
hatal
l
owacl
ust
erpar
ti
ti
ont
odeci
de
whet
herornoti
tisquor
atei
ntheev
entofanev
en-
spl
i
t-pr
iort
ofenci
ng.
 
 Wi
thsuchat
ie-
breaker
,nodesnotonl
ymoni
toreachot
her
,butal
soanupst
ream
r
out
ert
hati
sont
hesamepat
hascl
ust
ercommuni
cat
ions.I
fthet
wonodesl
ose
cont
actwi
theachot
her
,theonet
hatwi
nsi
stheonet
hatcanst
il
lpi
ngt
heupst
ream
r
out
er.
Thati
swhy
,ev
enwhenusi
ngt
ie-
breaker
s,i
tisi
mpor
tantt
oensur
ethat
f
enci
ngi
sconf
igur
edcor
rect
ly.
 CMANhasnoi
nter
nal
tie-
breaker
sforv
ari
ousr
easons.Howev
er,
tie-
breaker
scan
bei
mpl
ement
edusi
ngt
heAPI
.
23.Whati
sfenci
ngi
nRedHatCl
ust
er?
 Fenci
ngi
sthedi
sconnect
ionofanodef
rom t
hecl
ust
er'
sshar
edst
orage.
 
 Fenci
ngcut
sof
fI/
Ofr
om shar
edst
orage,
thusensur
ingdat
aint
egr
it
y. 
 Thecl
ust
eri
nfr
ast
ruct
ureper
for
msf
enci
ngt
hrought
hef
encedaemon,
 
fenced.
 WhenCMANdet
ermi
nest
hatanodehasf
ail
ed,
itcommuni
cat
est
oot
hercl
ust
er-
i
nfr
ast
ruct
urecomponent
sthatt
henodehasf
ail
ed.
 
 f
enced,
whennot
if
iedoft
hef
ail
ure,
fencest
hef
ail
ednode.
 

Rat
nakar
Page273
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

24.Whatar
ethev
ari
oust
ypesoff
enci
ngsuppor
tedbyHi
ghAv
ail
abi
li
tyAddOn?
Powerf
enci
ng 
—Af
enci
ngmet
hodt
hatusesapowercont
rol
l
ert
opowerof
fan
i
noper
abl
enode.
st
oragef
enci
ng 
—Af
enci
ngmet
hodt
hatdi
sabl
est
heFi
breChannel
por
tthatconnect
s
st
oraget
oani
noper
abl
e node.
Ot
herf
enci
ng 
—Sev
eral
otherf
enci
ngmet
hodst
hatdi
sabl
eI/
Oorpowerofan
i
noper
abl
enode,
incl
udi
ngI
BM Bl
adecent
ers,
PAP,
DRAC/
MC,
HPI
LO,
IPMI
,I
BM RSAI
I,
andot
her
s.
25.Whatar
ethel
ockst
atesi
nRedHatCl
ust
er?
Al
ockst
atei
ndi
cat
est
hecur
rentst
atusofal
ockr
equest
.Al
ocki
sal
way
sinoneof
t
hreest
ates:
Gr
ant
ed 
—Thel
ockr
equestsucceededandat
tai
nedt
her
equest
edmode.
Conv
ert
ing 
—Acl
i
entat
tempt
edt
ochanget
hel
ockmodeandt
henewmodei
s
i
ncompat
ibl
ewi
thanex
ist
ing l
ock.
Bl
ocked 
—Ther
equestf
oranewl
ockcoul
dnotbegr
ant
edbecauseconf
li
cti
ngl
ocks
exi
st.
Al
ock'
sst
atei
sdet
ermi
nedbyi
tsr
equest
edmodeandt
hemodesoft
heot
herl
ockson
t
hesamer
esour
ce.
26.Whati
sDLM l
ockmodel
?
 DLMi
sashor
tabbr
evi
ati
onf
orDi
str
ibut
edLockManager
.
 Al
ockmanageri
sat
raf
fi
ccopwhocont
rol
saccesst
oresour
cesi
nthecl
ust
er,
suchasaccesst
oaGFSf
il
esy
stem.
 GFS2usesl
ocksf
rom t
hel
ockmanagert
osy
nchr
oni
zeaccesst
ofi
l
esy
stem
met
adat
a(onshar
edst
orage)
 CLVM usesl
ocksf
rom t
hel
ockmanagert
osy
nchr
oni
zeupdat
est
oLVM v
olumes
andv
olumegr
oups(
alsoonshar
edst
orage)
 I
naddi
ti
on,
rgmanagerusesDLM t
osy
nchr
oni
zeser
vicest
ates.
 wi
thoutal
ockmanager
,ther
ewoul
dbenocont
rol
overaccesst
oyourshar
ed
st
orage,
andt
henodesi
nthecl
ust
erwoul
dcor
rupteachot
her
'sdat
a.

Rat
nakar
Page274
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

31.Exampl
esoft
opcommand

t
opi
soneoft
het
ool
formoni
tor
ingsy
stem usageandal
sot
omakeanychangef
or
i
mpr
ovi
ngsy
stem 
per
for
mance.
I
ntr
oduct
ion:
The 
top 
progr
am  
prov
idesady
nami
creal
-t
imev
iewofar
unni
ngsy
stem. 
Itcandi
spl
ay
sy
stem summar
yinf
ormat
ionaswel
lasal
i
stoft
askscur
rent
lybei
ngmanagedbyt
heLi
nux
ker
nel
. Thet
ypesofsy
stem summar
yinf
ormat
ionshownandt
het
ypes,
orderandsi
zeof
i
nfor
mat
iondi
spl
ayedf
ort
asksar
eal
luserconf
igur
abl
eandt
hat 
conf
igur
ati
oncanbemade
per
sist
entacr
ossr
est
art
s.
1. Wi
thoutanyar
gument
s:
#t
op
t
op-17:
51:
07up1day
, 2:
56,
27user
s, 
l
oad 
aver
age:
5.33,
29.
71,
28.
33
Tasks:
1470t
otal
, 1r
unni
ng,
1469sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
1%sy
, 0.
0%ni
,99.
9%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 264114424kt
otal
,253006956kused,
11107468kf
ree,
  66964kbuf
fer
s
Swap:
33554424kt
otal
,  3260kused,
33551164kf
ree,
245826024kcached

  PI
D USER   
PR 
NI 
VIRT 
RES 
SHRS%CPU%MEM   
TIME+ 
COMMAND
 
1960 deepak 
15 03045232201540R 
2.3 
0.0 0:
00.
78t
op
  2457 r
oot   
11 
-5 
 0  
0  
0S 
2.3 
0.0 
11:
36.
93kacpi
d

Rat
nakar
Page275
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

  2493 pmar
tpr
d 16 01397m 289m 9.
8m S 
0.3 
0.1 
18:
36.
07pmr
epagent
  4639 pmar
tpr
d 15 0 
787m  
54m 4080S 
0.3 
0.0 5:
19.
55pmser
ver
14402 r
oot 
  RT 0 
151m 52562872S 
0.3 
0.0 1:
41.
40mul
ti
pat
hd
17886 r
oot 
  10 
-5 
 0  
0  
0S 
0.3 
0.0 0:
07.
41kondemand/
11
Gener
all
yweuset
opwi
thoutanyar
gument
s,butt
hemagi
cismost
lydonef
rom t
het
op
commandl
i
newhi
ch mustofusski
p.Wel
lbef
oret
aki
ngy
out
othatpar
tletmeexpl
ainy
ou
t
hev
ari
oussy
stem r
elat
edf
eat
ureswhi
ch ar
eshownbyt
opcommand.

NOTE:
 Youcanenabl
eordi
sabl
ethemar
ked 
blue 
l
inebypr
essi
ng"
l"oncet
opi
srunni
ng.

t
op-17:
51:
07up1day
, 2:
56,
27user
s, 
loadav
erage:
5.33,
29.
71,
28.
33
Tasks:
1470t
otal
, 1r
unni
ng,
1469sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
1%sy
, 0.
0%ni
,99.
9%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 264114424kt
otal
,253006956kused,
11107468kf
ree,
  66964kbuf
fer
s
Swap:
33554424kt
otal
,  3260kused,
33551164kf
ree,
245826024kcached

Expl
anat
ion:
 
Thi
sli
net
ell
syouaboutt
heupt
imeofy
oursy
stem al
ongwi
thl
oadav
erage
v
alue.
NOTE:
 Youcanenabl
e/di
sabl
e t
hemar
ked 
blue 
l
inebypr
essi
ng"
t"
.

t
op-17:
51:
07up1day
, 2:
56,
27user
s, 
l
oadav
erage:
5.33,
29.
71,
28.
33
Tasks:1470t
otal
, 1r
unni
ng,
1469sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
1%sy
, 0.
0%ni
,99.
9%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 264114424kt
otal
,253006956kused,
11107468kf
ree,
  66964kbuf
fer
s
Swap:
33554424kt
otal
,  3260kused,
33551164kf
ree,
245826024kcached

Expl
anat
ion:
 
 Thi
sli
negi
vesusabr
iefdet
ail
ofal
lthet
asksr
unni
ng/
sleepi
ng/
stopped
cur
rent
lyi
nthesy
stem al
ongwi
tht
heCPUUsage

Val
u
Meani
ng
e
us usercput
ime(
or)%CPUt
imespenti
nuserspace
sy sy
stem cput
ime(
or)%CPUt
imespenti
nker
nel
space
ni userni
cecput
ime(
or)%CPUt
imespentonl
owpr
ior
it
ypr
ocesses
i
d i
dlecput
ime(
or)%CPUt
imespenti
dle
wa i
owai
tcput
ime(
or)%CPUt
imespenti
nwai
t(ondi
sk)
hi har
dwar
eir
q(or
)%CPUt
imespent
 ser
vici
ng/
handl
i
nghar
dwar
eint
err
upt
s
si sof
twar
eir
q(or
)%CPUt
imespentser
vici
ng/
handl
i
ngsof
twar
eint
err
upt
s
st
eal
time--%CPUt
imei
ninv
olunt
arywai
tbyv
irt
ual
cpuwhi
l
ehy
per
visori
sser
vici
ng
st
anot
herpr
ocessor(
or)%CPUt
imest
olenf
rom av
irt
ual
machi
ne

NOTE:
 Youcanenabl
e/di
sabl
e t
hemar
ked 
blue 
l
inebypr
essi
ng"
m".

Rat
nakar
Page276
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
op-17:
51:
07up1day
, 2:
56,
27user
s, 
l
oadav
erage:
5.33,
29.
71,
28.
33
Tasks:
1470t
otal
, 1r
unni
ng,
1469sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
1%sy
, 0.
0%ni
,99.
9%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 264114424kt
otal
,253006956kused,
11107468kf
ree,
  66964kbuf
fer
s
Swap:33554424kt
otal
,  3260kused,
33551164kf
ree,
245826024kcached

Expl
anat
i  
on:
 Thenextl
i
neshowsy
ourmemor
y(RAM andswap)usageandcapaci
ty.
  PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
13916 st
mpr
d  
18 0 
903m 129m 9936S51.
4 0.
1 3:
07.
01 j
ava
13921 st
mpr
d  
18 0 
901m 128m 9936S49.
8  0.
0 3:
02.
92 j
ava
13825 st
mpr
d  
18 0 
951m 190m 9932S49.
5  0.
1 3:
07.
13 j
ava
13856 st
mpr
d  
20 0 
978m 197m 9936S49.
2  0.
1 3:
05.
89 j
ava
13853 st
mpr
d  
18 0 
921m 150m 9932S48.
5  0.
1 3:
09.
14 j
ava
13875 st
mpr
d  
18 0 
907m 132m 9940S48.
5  0.
1 3:
09.
49 j
ava
13937 st
mpr
d  
25 0 
926m 165m 9936S48.
2  0.
1 3:
10.
31 j
ava
13919 st
mpr
d  
18 0 
917m 153m 9936S47.
5  0.
1 3:
05.
92 j
ava
13879 st
mpr
d  
25 0 
921m 160m 9936S47.
2  0.
1 3:
08.
43 j
ava
13908 st
mpr
d  
25 0 
901m 131m 9932S47.
2  0.
1 3:
12.
23 j
ava
13905 st
mpr
d  
25 0 
907m 137m 9932S46.
6  0.
1 2:
59.
85 j
ava
Thel
eftsect
ionsshowsy
out
hedet
ail
soft
hepr
ocessr
unni
ngal
ongwi
tht
hebel
ow
det
ail
s.
Fi
elds/
Col
um
Descr
ipt
ion
n
PI
D Pr
ocessI
d
USER Theef
fect
iveusernameoft
het
ask'
sowner
PR Thepr
ior
it
yoft
het
ask
Theni
cev
alueoft
het
ask.
 Anegat
iveni
cev
aluemeanshi
gherpr
ior
it
y,
NI wher
easaposi
ti
veni
cev
aluemeansl
owerpr
ior
it
y. Zer
oint
hisf
iel
dsi
mpl
y
meanspr
ior
it
ywi
l
lnotbeadj
ust
edi
ndet
ermi
ningat
ask'
sdi
spat
chabi
l
ity
Thet
ask'
sshar
eoft
heel
apsedCPUt
imesi
ncet
hel
astscr
eenupdat
e,
%CPU
expr
essedasaper
cent
ageoft
otal
CPUt
ime.
%MEM At
ask'
scur
rent
lyusedshar
eofav
ail
abl
ephy
sical
memor
y
TI
ME+ Tot
alCPUt
imet
het
askhasusedsi
ncei
tst
art
ed
Thest
atusoft
het
askwhi
chcanbeoneof
:
 
  
  
  
 
  
  '
D'=uni
nter
rupt
ibl
esl
eep
 
  
  
  
 
  
  '
R'=r
unni
ng
S
 
  
  
  
 
  
  '
S'=sl
eepi
ng
 
  
  
  
 
  
  '
T'=t
racedorst
opped
 
  
  
  
 
  
  '
Z'=z
ombi
e

Rat
nakar
Page277
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

RES Thenon-
swappedphy
sical
memor
yat
askhasused
SHR Theamountofshar
edmemor
yusedbyat
ask
Di
spl
ayt
hecommandl
i
neusedt
ost
artat
askort
henameoft
heassoci
ated
Command
pr
ogr
am

2. Ar
rangeTaskswi
thHi
ght
oLowCPUUsage:
Pr
ess"
P"or"
shi
ft
+p"
 oncet
opi
srunni
ngt
oar
rangeal
lthet
askswi
th 
Hight
oLowCPU
Usage 
asshownbel
ow.
t
op-18:
03:
00up1day
, 3:
08,
27user
s, 
l
oadav
erage:
12.
54,
32.
34,
32.
75
Tasks:
1485t
otal
, 3r
unni
ng,
1482sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
41.
2%us,
 0.
8%sy
, 0.
0%ni
,56.
6%i
d, 
1.4%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 264114424kt
otal
,258863028kused,
 5251396kf
ree,
  76308kbuf
fer
s
Swap:
33554424kt
otal
,  3256kused,
33551168kf
ree,
250950544kcached
  PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
 
9663 st
mpr
d  
22 0  902m 301m 9888 S 
2578.
3   0.
1 2:
27.
04
j
ava
32117 et
lpr
d  
18 
-1324165908 1716 R  6.
2   0.
0  0:
04.
84
cl
eanup_
dir
fi
le
10053 r
oot 
   18 
-1 271001936 1460 S  4.
9   
0.0  0:
00.
15
ps
  5456 pmar
tpr
d 16 0 1182m 130m 8560 S 
3.9 
 0.
1  38:
39.
72
pmser
ver
17492 deepak 
16 0305923388 1544 R  3.
6   0.
0  0:
17.
11 t
op
 
2843 pmar
tpr
d 15 0  730m  
48m 4052 S  3.
3   
0.0  4:
40.
33
pmser
ver
 
2457 r
oot 
   11 
-5   0   0   0 S  2.
9   0.

11:
42.
39 kacpi
d
 
3731 t
dmspr
d 15 0  370m  
49m  32m S  2.
3   0.
0  0:
00.
64
pmdt
m.or
ig 
3. Ar
rangeTaskswi
thHi
ght
oLowMemor
yUsage.
Pr
ess"
M"or"
shi
ft
+m"
oncet
opi
srunni
ngt
oar
rangeal
lthet
askswi
th 
Hight
oLow
Memor
yUsage 
asshown bel
ow.

t
op-18:
04:
26up1day
, 3:
09,
27user
s, 
l
oadav
erage:
37.
12,
34.
56,
33.
44
Tasks:
1676t
otal
, 1r
unni
ng,
1675sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 2.
3%us,
76.
7%sy
, 0.
0%ni
,19.
7%i
d, 
1.3%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 264114424kt
otal
,262605184kused,
 1509240kf
ree,
  77924kbuf
fer
s
Swap:
33554424kt
otal
,  3256kused,
33551168kf
ree,
252198368kcached
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   

Rat
nakar
Page278
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

TI
ME+  COMMAND
1852 pmar
tpr
d 18 0 2005m 319m 4776 S  6.
9  4.
1  
28:
34.
32 j
ava
2493 pmar
tpr
d 16 0 1397m 289m 9.
8m S  0.
0  4.
0  
18:
37.
79pmr
epagent
20557 et
lpr
d  
15 0 
911m 201m 3024 S  0.
0  3.
0   17:
09.
02
pmdt
m.or
ig
18778 r
oot 
  RT 0 
286m 188m 156m S  0.
0  2.
1   13:
24.
98
ai
sexec
  5456 pmar
tpr
d 15 0 1182m 130m 8560 S  6.

1.
1  
38:
40.
58pmser
ver
16004 et
lpr
d  
14 
-1 
179m 83m 2636 S  0.
0  0.
1  
9:41.
36 db2bp
11272 st
mpr
d  
25 0  906m  
67m 9736 S 99.
7 0.
0   0:
48.
11
j
ava
4. Changet
heni
cev
alue(
pri
ori
ty)ofanyt
ask
Tounder
standwhati
sni
cev
aluef
oll
owt
hebel
owl
i
nk
Whati
sni
ceandhowt
ochanget
hepr
ior
it
yofanypr
ocessi
nLi
nux?
Pr
ess"
r"whent
opi
srunni
ngont
het
ermi
nal
.Youshoul
dgetapr
omptasshownbel
ow
i
n bl
ue 
col
or.

t
op-18:
08:
38up115day
s, 
8:44,
 4user
s, 
l
oadav
erage:
0.03,
0.03,
0.00
Tasks:
325t
otal
, 2r
unni
ng,
323sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
1%us,
 6.
4%sy
, 0.
0%ni
,93.
3%i
d, 
0.3%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2063848kused,
47368880kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,    
0kused,
 2097144kf
ree,
 1297572kcached
PI
Dtor
eni
ce:
 
1308 
[Hi
tEnt
er]
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
5359 r
oot 
 39  19 0 0   0 R 100.
1 0.
0  94:
31:
35
ki
pmi
0
1308  deepak 
16 
 0 
294922292 1512 S  0.
7  0.
0 0:
00.
33 t
op
6116 r
oot 
  15 0 369m  
30m  11m S  0.
7  0.
1 77:
24.
97 ci
mser
ver

Gi
vet
he 
PID 
whoseni
cev
aluehast
obechangedandhi
t"Ent
er"
.Thengi
vet
he 
nice
v
alue 
fort
hePI
D
t
op-18:
08:
38up115day
s, 
8:44,
 4user
s, 
l
oadav
erage:
0.03,
0.03,
0.00
Tasks:
325t
otal
, 2r
unni
ng,
323sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
1%us,
 6.
4%sy
, 0.
0%ni
,93.
3%i
d, 
0.3%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2063848kused,
47368880kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,    
0kused,
 2097144kf
ree,
 1297572kcached
Reni
cePI
D1308t
oval
ue:
 
-1 
[Hi
tEnt
er]

Rat
nakar
Page279
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
 
5359 r
oot 
   39  19 0 0 0 R 100.
1 0.

9431:
35 ki
pmi
0
  1308 deepak 
16 
 0 
294922292 1512 S  0.
7  0.
0  0:
00.
33 t
op
  6116 r
oot 
   15 0 369m  
30m  11m S  0.
7  0.
1  77:
24.
97
ci
mser
ver

Ver
if
ythechanges:
t
op-18:
09:
06up115day
s, 
8:45,
 4user
s, 
l
oadav
erage:
0.13,
0.06,
0.01
Tasks:
325t
otal
, 1r
unni
ng,
324sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
1%sy
, 0.
0%ni
,99.
8%i
d, 
0.1%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2063276kused,
47369452kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,   
 0kused,
 2097144kf
ree,
 1297588kcached
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
1308 deepak 
15 
-1 
294922292 1512 S  0.
7  0.
0  0:
00.
42 t
op
5359 r
oot 
   34  19 0   0   0 S  0.
7  0.

9431:
42 ki
pmi
0
1 r
oot 
   15 0 10352  692  580 S  0.
0  0.

0:
02.
16 i
nit
2 r
oot 
   RT 
-5   0   0   0 S  0.
0  0.

0:
02.
37mi
grat
ion/
0
3 r
oot 
   34 
19   0  
0  
0 S  0.
0  0.
0 0:
00.
00
ksof
ti
rqd/

5.Ki
llanyt
ask
Pr
ess"
k"ont
het
ermi
nal
whent
opi
srunni
ng.Youshoul
dgetapr
omptasshownbel
ow
i
n bl
ue 
col
or
t
op-18:
09:
31up115day
s, 
8:45,
 4user
s, 
l
oadav
erage:
0.08,
0.05,
0.01
Tasks:
325t
otal
, 1r
unni
ng,
324sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
1%us,
 0.
1%sy
, 0.
0%ni
,99.
8%i
d, 
0.1%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2062036kused,
47370692kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,    
0kused,
 2097144kf
ree,
 1297596kcached
PI
Dtoki
l
l:
1308
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
5359 r
oot 
   34  19  0   0 
  0 S 1.
3  0.
0 9431:
42
ki
pmi
0
6460 r
oot    24  0  179m  30m 3976 S 1.
0  0.
1  79:
04.
77
j
ava

Rat
nakar
Page280
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

1308 deepak  15  -


1 29492 2292 1512 S 0.
7  0.
0  0:
00.
49
t
op
1434 r
oot 
   15  0 29492 2288 1516 R 0.
7 0.
0  0:
00.
13
t
op

t
op-18:
09:
31up115day
s, 
8:45,
 4user
s, 
l
oadav
erage:
0.08,
0.05,
0.01
Tasks:
325t
otal
, 1r
unni
ng,
324sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
1%us,
 0.
1%sy
, 0.
0%ni
,99.
8%i
d, 
0.1%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2062036kused,
47370692kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,    
0kused,
 2097144kf
ree,
 1297596kcached
Ki
l
lPI
D1308wi
thsi
gnal
[15]

[Hi
tEnt
erf
ordef
aul
t]
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
 
5359 r
oot 
   34  19  0   0 
  0 S 1.
3  0.
0  9431:
42
ki
pmi
0
 
6460 r
oot 
   24  0 179m  30m 3976 S 1.
0  0.
1  79:
04.
77
j
ava
1308 deepak  15  -
1 29492 2292 1512 S 0.
7  0.
0  0:
00.
49
t
op
6. Vi
ewal
lthepr
ocessesr
unni
ngbyauser
Pr
ess"
u"ont
het
ermi
nal
whent
opi
srunni
ng.Youshoul
dgetapr
omptasshownbel
ow
i
n bl
ue 
col
or
t
op-18:
12:
24up115day
s, 
8:48,
 4user
s, 
l
oadav
erage:
0.06,
0.05,
0.00
Tasks:
328t
otal
, 1r
unni
ng,
327sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
4%sy
, 0.
0%ni
,99.
6%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2063268kused,
47369460kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,    
0kused,
 2097144kf
ree,
 1297660kcached
Whi
chuser(
blankf
oral
l
): 
deepak 
[Hi
tEnt
er]
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
 
1729 r
oot 
   15  0 294882196 1432 R  2.
0  0.
0  0:
00.
01
t
op
   1 r
oot    15  0 10352  692  580 S  0.
0  0.

0:
02.
16 i
nit
   2 r
oot 
   RT  -
5  0   0 
  0 S  0.
0  0.
0  0:
02.
37
mi
grat
ion/
0
   3 r
oot 
   34  19  0   0 
  0 S  0.
0  0.
0  0:
00.
00
ksof
ti
rqd/
0
   4 r
oot 
   RT  -
5  0   0 
  0 S  0.
0  0.
0  0:
00.
00
wat
chdog/
0

Rat
nakar
Page281
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

t
op-18:
12:
41up115day
s, 
8:48,
 4user
s, 
l
oadav
erage:
0.04,
0.05,
0.00
Tasks:
328t
otal
, 1r
unni
ng,
327sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
1%sy
, 0.
0%ni
,99.
9%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2062356kused,
47370372kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,    
0kused,
 2097144kf
ree,
 1297672kcached
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
  1561  deepak  17  0  3984 780  468 S  0.
0  0.
0  0:
00.
00
man
1564  deepak  19  0  8704 964  816 S  0.
0  0.
0  0:
00.
00
sh
1566  deepak  23  0  8704 464  316 S  0.
0  0.
0  0:
00.
00
sh
  1571  deepak  16  0  8452 892  712 S  0.
0  0.
0  0:
00.
01
l
ess
31328  deepak  15  0  110m 2348 1264 S  0.
0  0.
0  0:
00.
20
sshd
31329  deepak  16  0 276762564 1816 S  0.
0  0.
0  0:
00.
02
bash
31422  deepak  15  0  109m 2360 1260 S  0.
0  0.
0  0:
00.
14
sshd
31423  deepak  15  0 275482500 1784 S  0.
0  0.
0  0:
00.
02
bash
7. Changedel
aybet
weent
ermi
nal
ref
resh
Bydef
aul
tthet
opt
ermi
nal
issetf
or 
aut
oref
resh 
aft
erev
ery
 3seconds 
buti
fyouwant
y
oucanchangei
tasper y
ourr
equi
rement
.
Pr
ess"
d"whent
opi
srunni
ng.Youshoul
dgetapr
omptasshownbel
owi
n bl
ue 
col
or.
t
op-18:
14:
55up115day
s, 
8:50,
 4user
s, 
l
oadav
erage:
0.01,
0.04,
0.00
Tasks:
328t
otal
, 1r
unni
ng,
327sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
1%sy
, 0.
0%ni
,99.
9%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2063828kused,
47368900kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,   
 0kused,
 2097144kf
ree,
 1297728kcached
Changedel
ayf
rom 3.
0to:
 
2.0 
[Hi
tEnt
er]
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
5359 r
oot 
   34  19  0 
  0 
  0 S  0.
7  0.
0  9431:
58
ki
pmi
0
  1795 r
oot 
   15  02949223001524R  0.
3 0.
0  0:
00.
20
t
op
   1 r
oot 
   15  010352 
692  580 S  0.
0  0.
0  0:
02.
16

Rat
nakar
Page282
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

i
nit
Ver
if
ythechanges.Youmustseet
hescr
eenbuf
ferget
ti
ngr
efr
eshmuchear
li
erorj
ust
t
over
if
yyoucanpr
ovi
de ahi
gherv
alueofdel
ayandobser
vert
her
efr
eshr
ateont
he
t
ermi
nal
8. No.oft
askt
obedi
spl
ayed
Bydef
aul
tthi
sopt
ioni
ssett
ounl
i
mit
edt
hati
sther
easony
ourt
ermi
nal
isf
ull
ycov
ered
wi
thl
i
stoft
askswhen y
our
unt
het
opcommand.Anyhowy
oucanl
i
stt
henooft
askst
o
bev
isi
bleoncey
our
unt
opcommand.
Pr
ess"
n"whent
opi
srunni
ng.Youshoul
dgetapr
omptasshownbel
owi
n bl
ue 
col
or
t
op-18:
18:
07up115day
s, 
8:54,
 4user
s, 
l
oadav
erage:
0.01,
0.03,
0.00
Tasks:
328t
otal
, 1r
unni
ng,
327sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
2%sy
, 0.
0%ni
,99.
7%i
d, 
0.1%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2063348kused,
47369380kf
ree,
 310072kbuf
fer
s
Swap:
 2097144kt
otal
,   
 0kused,
 2097144kf
ree,
 1297804kcached
Max
imum t
asks=0,
changet
o(0i
sunl
i
mit
ed)

2[Hi
tEnt
er]
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
  5359 r
oot 
   34  19  0 
  0 
  0 S  2.
3  0.
0  9432:
08
ki
pmi
0
  1795 r
oot 
   15  0294922304 1528 R  0.
7  0.
0  0:
00.
65
t
op
   1 r
oot 
   15  010352 
692  580 S  0.
0  0.
0  0:
02.
16
i
nit
   2 r
oot 
   RT 
-5   0 
  0 
  0 S  0.
0  0.
0  0:
02.
37
mi
grat
ion/
0

t
op-14:
48:
40up116day
s, 
5:24,
 3user
s, 
l
oadav
erage:
0.05,
0.04,
0.00
Tasks:
318t
otal
, 1r
unni
ng,
317sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu(
s):
 0.
0%us,
 0.
1%sy
, 0.
0%ni
,99.
9%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal

2051952kused,
47380776kf
ree,
 310176kbuf
fer
s
Swap:
 2097144kt
otal
,    
0kused,
 2097144kf
ree,
 1293800kcached
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
  5359 r
oot 
   34 
19   0 
  0 
  0 S  1.
0  0.
0  9502:
15
ki
pmi
0
25009pr
asadee  15 02949222801516 R  0.
3 0.
0  0:
01.
88
t
op

9. Vi
ewl
iv
eindi
vi
dualCPUpr
ocessorper
for
mance:
Bydef
aul
ttopcommandshowsy
out
heav
erageofal
ltheav
ail
abl
eCPUsi
nthemachi
ne.

Rat
nakar
Page283
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

I
ncasey
ouwantt
oseer
epor
tofal
lthei
ndi
vi
dual
CPUspr
ess"
1"oncey
ouar
erunni
ng
t
opcommandandy
ou wi
l
lgett
oseesomet
hingl
i
kebel
ow
t
op-00:
00:
58up215day
s,13:
36,
 5user
s, 
l
oadav
erage:
4.07,
4.04,
4.00
Tasks:
339t
otal
, 5r
unni
ng,
334sl
eepi
ng,
 0st
opped,
 0zombi
e
Cpu0 

0.0%us,
 0.
2%sy
, 0.
0%ni
,99.
8%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Cpu1 

0.0%us,
 0.
4%sy
, 0.
0%ni
,99.
6%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Cpu2 

0.0%us,
 0.
1%sy
, 0.
0%ni
,99.
5%i
d, 
0.4%wa,
 0.
0%hi

0.0%si

0.0%st
Cpu3 

0.1%us,
 0.
2%sy
, 0.
0%ni
,99.
8%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Cpu4 

0.5%us,
 0.
1%sy
, 0.
0%ni
,99.
4%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Cpu5 

0.2%us,
 0.
4%sy
, 0.
0%ni
,99.
4%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Cpu6 

0.0%us,
 0.
5%sy
, 0.
0%ni
,99.
5%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Cpu7 

0.1%us,
 1.
4%sy
, 0.
0%ni
,98.
5%i
d, 
0.0%wa,
 0.
0%hi

0.0%si

0.0%st
Mem:
 49432728kt
otal
,11891852kused,
37540876kf
ree,
 7996596kbuf
fer
s
Swap:
 2097144kt
otal
,    
0kused,
 2097144kf
ree,
 1850540kcached
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
23102 r
oot 
   25  0 23724 2024 1168 R 100.
1  0.
0  64446:
36
pv
s
23338 r
oot 
   25  0 23724 2028 1168 R 100.
1  0.
0  64444:
22
pv
s
23959 r
oot 
   25  0 23724 2016 1168 R 100.
1  0.
0
135691:
00 pv
s
28698 r
oot 
   25  0 23724 2024 1168 R 99.
3  0.
0
128828:
38 pv
s
 
5359 r
oot 
   34  19 0   0 
  0 S  0.
8  0.
0  17610:
33 ki
pmi
0
10.Addanewf
iel
dint
opout
put:
Bydef
aul
tyouseel
i
mit
edsetofout
putwheny
ouuset
het
opcommand.Butapar
tfr
om
t
hoset
her
ear
eaot
her l
i
stoff
iel
dwhi
chcanbeaddedt
othet
opout
put
.Tov
iewal
l
t
hel
i
stff
iel
dwhi
chcanbeaddedf
oll
owt
hebel
ow st
eps.
Run 
top 
commandandt
hen,
Pr
ess"
f"whi
chwi
l
ltakey
out
hel
i
stofav
ail
abl
efi
eldsundert
opcommand.
Al
lthef
iel
dini
ti
alsst
atedi
nBLOCKl
ett
ersar
evi
sibl
ebydef
aul
twheny
oui
ssuet
op
command.Toaddanew f
iel
dpr
esst
hef
iel
dini
ti
alasshowni
nthef
ir
stcol
umn.
 
*A:
PID    = Pr
ocessI
d      
  0x00000001  PF_
ALI
GNWARN
*E:
USER  
  = UserName  
    
   
    
0x00000002 
PF_
STARTI
NG
*H:
PR  
  = Pr
ior
it
y     
    
    
    0x00000004 
PF_
EXI
TING
*I
:NI     = Ni
cev
alue      
    
   0x00000040
PF_
FORKNOEXEC
*O:
VIRT  
 = Vi
rt
ual
Image(
kb) 0x00000100  PF_
SUPERPRI
V

Rat
nakar
Page284
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]

*Q:
RES    
= Resi
dentsi
ze(
kb)  
    
  0x00000200 
PF_
DUMPCORE
*T:
SHR    
= Shar
edMem si
ze(
kb)   
0x00000400 PF_
SIGNALED
*W:
S  
   = Pr
ocessSt
atus   
   
    
0x00000800 PF_
MEMALLOC
*K:
%CPU    = CPUusage   
   
    
   0x00002000 
PF_
FREE_
PAGES(
2.5)
*N:
%MEM = Memor
yusage(
RES) 0x00008000  debugf
lag(
2.5)
*M:
TIME+ = CPUTi
me,
hundr
edt
hs  0x00024000 speci
alt
hreads(
2.5)
  b:
PPI
D   = Par
entPr
ocessPi
d    
   0x001D0000  speci
al
st
ates(
2.5)
  c:
RUSER   
= Real
username       
  0x00100000 
PF_
USEDFPU(
thr
u2.
4)
  d:
UID   
  = UserI
d
  f
:GROUP   
= Gr
oupName
  g:
TTY    = Cont
rol
l
ingTt
y
j
:P 
     = Lastusedcpu(
SMP)
*P:
SWAP    = Swappedsi
ze(
kb)
l
:TI
ME   = CPUTi
me
r
:CODE  
 = Codesi
ze(
kb)
s:
DATA   = Dat
a+St
acksi
ze(
kb)
u:
nFLT   = PageFaul
tcount
v
:nDRT  
 = Di
rt
yPagescount
y
:WCHAN 
  = Sl
eepi
ngi
nFunct
ion
z:
Flags  
 = TaskFl
ags<sched.
h>
*X:
COMMAND 
 = Commandname/
li
ne
Forexampl
etoadd"
swap"f
iel
dpr
ess"
p"(
insmal
ll
ett
ers)
.Assoonasy
oupr
ess"
p"i
t
shoul
dtur
nint
obl
ock l
ett
ernot
if
yingt
hati
thasbeenaddedt
otopout
put
.Oncedone
hi
tent
erandi
twi
l
ltakey
oubackt
otopout
put
Youshoul
dseesomet
hingl
i
kebel
owscr
een
PI
D USER    PR  NI  VI
RT  RES  SHR S %CPU %MEM   
TI
ME+  COMMAND
20472pr
asadee  15  03074824121620 R  0.
8 0.
0  0:
00.
43 
27m 
top
22568 r
oot 
   17  0 
296m 53003536 S  0.
4 0.

3:
00.
30 
291m 
event
logd
   1 r
oot 
   15  010348 
644 
544 S  0.
0 0.
0  2:
28.
66 
9704 
i
nit
   2 r
oot 
   RT  -
5   0   0   0 S  0.
0  0.
0  0:
38.
59  

migr
ati
on/
0
   3 r
oot 
   34  19   0   0   0 S  0.
0  0.
0  0:
00.
43  

Rat
nakar
Page285
[
Pickt e] [
hedat LINUXNOTESFORLEVEL2]


ksof
ti
rqd/
0
   4 r
oot 
   RT  -
5   0   0   0 S  0.
0  0.
0  0:
00.
00  

wat
chdog/
0
   5 r
oot    RT  -
5   0   0   0 S  0.
0  0.
0  0:
28.
64  

migr
ati
on/
1
   6 r
oot    34  19   0   0   0 S  0.
0  0.
0  0:
00.
67  

ksof
ti
rqd/
1
   7 r
oot 
   RT  -
5   0   0   0 S  0.
0  0.
0  0:
00.
00  

wat
chdog/
1
   8 r
oot    RT  -
5   0   0   0 S  0.
0  0.
0  0:
28.
00  

migr
ati
on/
2
   9 r
oot    34  19   0   0   0 S  0.
0  0.
0  0:
00.
73  

ksof
ti
rqd/
2

Rat
nakar
Page286

You might also like