Вы находитесь на странице: 1из 20

RHCEQuestions

Youwillnotethatsomerequirementsspecifythataserviceshouldnotbeavailablefromthe
DNS
domaincracker.org.Allsystemsinthatdomainareinthe
172.24.0.0/255.255.0.0subnet,andallsystemsinthatsubnetareincracker.org.
1. Createarepositaryfor
http://station.domain254.example.com/pub/rhel6/dvd
Ans:
[root@krishna~]#vi/etc/yum.repo.d/sample.repo
[rhec]
baseurl=http://station.domainx.example.com/pub/rhel6/dvd
gpgckeck=0
save&quit
[root@krishna~]#yumcleanall
[root@krishna~]#yumlistall
2.ConfigureSELINUX
Themachineshouldberunninginenforcingmode
[root@krishna~]#vi/etc/selinux/config
[root@krishna~]#cat/etc/selinux/config
#ThisfilecontrolsthestateofSELinuxonthesystem.
#SELINUX=cantakeoneofthesethreevalues:
#enforcingSELinuxsecuritypolicyisenforced.
#permissiveSELinuxprintswarningsinsteadofenforcing.
#disabledNoSELinuxpolicyisloaded.
SELINUX=enforcing
#SELINUXTYPE=cantakeoneofthesetwovalues:
#targetedTargetedprocessesareprotected,
#mlsMultiLevelSecurityprotection.
SELINUXTYPE=targeted

3.CronfigureCrondeny
[root@krishna~]#yuminstallcron*y
Loadedplugins:fastestmirror,refreshpackagekit,security
Loadingmirrorspeedsfromcachedhostfile
*base:centosmirror.go4hosting.in
*extras:mirrors.digipower.vn
*updates:centosmirror.go4hosting.in
SettingupInstallProcess
Packagecrontabs1.1033.el6.noarchalreadyinstalledandlatestversion
Packagecronieanacron1.4.47.el6.x86_64alreadyinstalledandlatestversion
Packagecronie1.4.47.el6.x86_64alreadyinstalledandlatestversion
ResolvingDependencies
TransactionTestSucceeded
RunningTransaction
Installing:cronienoanacron1.4.47.el6.x86_641/1
Verifying:cronienoanacron1.4.47.el6.x86_641/1
Installed:
cronienoanacron.x86_640:1.4.47.el6
Complete!
[root@krishna~]#vi/etc/cron.deny
[root@krishna~]#cat/etc/cron.deny
Lason
root@krishna~]#chkconfigcrondon
[root@krishna~]#servicecrondrestart
Stoppingcrond:[OK]
Startingcrond:[OK]
ConfigureacronaccessLasonshouldnotbeallowedtousecron
Note:Thisrestrictionmustnotaffectanyotheruser


4.ConfigureBootParameter
Modifyyoursystem,sothatwhenitbootstheparameter.kernstackissettovalueof[1].
[root@krishna~]#cat/etc/grub.conf
#grub.confgeneratedbyanaconda
#
#Notethatyoudonothavetorerungrubaftermakingchangestothisfile
#NOTICE:Youhavea/bootpartition.Thismeansthat
#allkernelandinitrdpathsarerelativeto/boot/,eg.
#root(hd0,0)
#kernel/vmlinuzversionroroot=/dev/mapper/vg_krishnalv_root
#initrd/initrd[generic]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
titleCentOS(2.6.32358.23.2.el6.x86_64)
root(hd0,0)
kernel/vmlinuz2.6.32358.23.2.el6.x86_64roroot=/dev/mapper/vg_krishnalv_root
rd_NO_LUKSrd_LVM_LV=vg_krishna/lv_swaprd_NO_MDSYSFONT=latarcyrhebsun16
crashkernel=autoKEYBOARDTYPE=pcKEYTABLE=usrd_LVM_LV=vg_krishna/lv_root
rd_NO_DMLANG=en_US.UTF8rhgbquiet
initrd/initramfs2.6.32358.23.2.el6.x86_64.img
titleCentOS(2.6.32358.el6.x86_64)
root(hd0,0)
kernel/vmlinuz2.6.32358.el6.x86_64roroot=/dev/mapper/vg_krishnalv_root
rd_NO_LUKSrd_LVM_LV=vg_krishna/lv_swaprd_NO_MDSYSFONT=latarcyrhebsun16
crashkernel=autoKEYBOARDTYPE=pcKEYTABLE=uskernstack=1
rd_LVM_LV=vg_krishna/lv_rootrd_NO_DMLANG=en_US.UTF8rhgbquiet
initrd/initramfs2.6.32358.el6.x86_64.img
Note:yourchangesshouldbevisiblefrom/proc/cmdline.
[root@krishna~]#cat/proc/cmdline
roroot=/dev/mapper/vg_krishnalv_rootrd_NO_LUKSrd_LVM_LV=vg_krishna/lv_swap
rd_NO_MDSYSFONT=latarcyrhebsun16KEYBOARDTYPE=pcKEYTABLE=us
rd_LVM_LV=vg_krishna/lv_rootrd_NO_DMLANG=en_US.UTF8rhgbquietkrenstack=1


5.MountAnIMAGEFILE
[root@krishna~]#mkdir/mnt/iso
configureyoursystemsothatthefilesystemimagelocatedin
/root/test.isoisautomaticallymounton/mnt/containeratsystem
boottime
[root@krishna~]#cat/etc/fstab
#
#/etc/fstab
#CreatedbyanacondaonMonDec3119:08:362001
#
#Accessiblefilesystems,byreference,aremaintainedunder'/dev/disk'
#Seemanpagesfstab(5),findfs(8),mount(8)and/orblkid(8)formoreinfo
#
/dev/mapper/vg_krishnalv_root/ext4defaults11
UUID=013007475655408b93d266c4ced493d6/bootext4defaults12
/dev/mapper/vg_krishnalv_home/homeext4defaults12
/dev/mapper/vg_krishnalv_swapswapswapdefaults00
tmpfs/dev/shmtmpfsdefaults00
devpts/dev/ptsdevptsgid=5,mode=62000
sysfs/syssysfsdefaults00
proc/procprocdefaults00
/root/CentOS6.4x86_64binDVD1.iso/mnt/iso iso9660loop00
[root@krishna~]#mkdir/mnt/iso
[root@krishna~]#mounta
[root@krishna~]#dfh


6.ConfigureaFTPaccess
ImplementAnFTPserverforthefollowingrequirements.
(i)TheFTPserverallowsanonymousfiledownloadsfrom/var/ftp/pub
(ii)Theclientsoutsidetheexample.comshouldnothavetheanonymousFTP
accessinyourmachine
[root@krishna~]#yuminstallvsftp*y
Loadedplugins:fastestmirror,refreshpackagekit,security
Loadingmirrorspeedsfromcachedhostfile
*base:centosmirror.go4hosting.in
*extras:mirrors.digipower.vn
*updates:centosmirror.go4hosting.in
SettingupInstallProcess
ResolvingDependencies
>Runningtransactioncheck
>Packageftp.x86_640:0.1753.el6willbeinstalled
>FinishedDependencyResolution
TransactionTestSucceeded
RunningTransaction
Installing:vsftp0.1753.el6.x86_641/1
Verifying:vsftp0.1753.el6.x86_641/1
Installed:
vsftp.x86_640:0.1753.el6
Complete!
[root@krishna~]#chkconfigvsftpdon
[root@krishna~]#servicevsftpdstart
Startingvsftpdforvsftpd:[OK]
[root@krishna~]#cat/etc/vsftpd/vsftpd.conf
#Exampleconfigfile/etc/vsftpd/vsftpd.conf
#READTHIS:ThisexamplefileisNOTanexhaustivelistofvsftpdoptions.
#Pleasereadthevsftpd.conf.5manualpagetogetafullideaofvsftpd's
#capabilities.
#
#AllowanonymousFTP?(Bewareallowedbydefaultifyoucommentthisout).
anonymous_enable=YES

[root@krishna~]#getseboola|grepftp
allow_ftpd_anon_write>off
allow_ftpd_full_access>off
allow_ftpd_use_cifs>off
allow_ftpd_use_nfs>off
ftp_home_dir>off
[root@krishna~]#setseboolPallow_ftpd_full_accesson
[root@krishna~]#getseboola|grepftp
allow_ftpd_anon_write>off
allow_ftpd_full_access>on
allow_ftpd_use_cifs>off
[root@krishna~]#vi/etc/hosts.deny
#
#hosts.deny
#
#
#
#
#
#
#
#
#
#
#
vsftpd:

Thisfilecontainsaccessruleswhichareusedto
denyconnectionstonetworkservicesthateitheruse
thetcp_wrapperslibraryorthathavebeen
startedthroughatcp_wrappersenabledxinetd.
Therulesinthisfilecanalsobesetupin
/etc/hosts.allowwitha'deny'optioninstead.
See'man5hosts_options'and'man5hosts_access'
forinformationonrulesyntax.
See'mantcpd'forinformationontcp_wrappers
ALLEXCEPT

192.168.1.0/255.255.255.0


7.ConfigureanEmailalias
[root@krishna~]#yuminstallpostfix*y
Loadedplugins:fastestmirror,refreshpackagekit,security
Loadingmirrorspeedsfromcachedhostfile
*base:centosmirror.go4hosting.in
*extras:mirrors.digipower.vn
*updates:centosmirror.go4hosting.in
SettingupInstallProcess
Package2:postfix2.6.62.2.el6_1.x86_64alreadyinstalledandlatestversion
ResolvingDependencies
>Runningtransactioncheck
>Packagepostfixperlscripts.x86_642:2.6.62.2.el6_1willbeinstalled
>ProcessingDependency:perl(Date::Calc)forpackage:2:postfixperlscripts2.6.6
2.2.el6_1.x86_64
>Runningtransactioncheck
>PackageperlDateCalc.noarch0:6.32.el6willbeinstalled
>ProcessingDependency:perl(Bit::Vector)>=7.1forpackage:perlDateCalc6.3
2.el6.noarch
RunningTransaction
Installing:perlCarpClan6.032.el6.noarch1/4
Installing:perlBitVector7.12.el6.x86_642/4
Installing:perlDateCalc6.32.el6.noarch3/4
Installing:2:postfixperlscripts2.6.62.2.el6_1.x86_644/4
Verifying:perlCarpClan6.032.el6.noarch1/4
Verifying:perlBitVector7.12.el6.x86_642/4
Verifying:perlDateCalc6.32.el6.noarch3/4
Verifying:2:postfixperlscripts2.6.62.2.el6_1.x86_644/4
Installed:
postfixperlscripts.x86_642:2.6.62.2.el6_1
DependencyInstalled:
perlBitVector.x86_640:7.12.el6perlCarpClan.noarch0:6.032.el6
perlDateCalc.noarch0:6.32.el6
Complete!

[root@krishna~]#cat/etc/postfix/main.cf
#Seealsotheproxy_interfacesparameter,fornetworkaddressesthat
#areforwardedtousviaaproxyornetworkaddresstranslator.
#
#Note:youneedtostop/startPostfixwhenthisparameterchanges.
#
inet_interfaces=all
#inet_interfaces=$myhostname
#inet_interfaces=$myhostname,localhost
#inet_interfaces=localhost
#EnableIPv4,andIPv6ifsupported
inet_protocols=all
confiureanemailaliasforyourMTAsuchthatthemailsenttoglsisreceicedbythelocal
user"anand"
[root@krishna~]#cat/etc/aliases
webmaster:root
noc:root
security:root
hostmaster:root
info:postmaster
marketing:postmaster
sales:postmaster
support:postmaster
gls:anand
7.1Configureagroupemailalias
configureanemailaliasforyourMTA.suchthatmailsentto(acct)isreceivedbythelocal
users
(i)anand,sasi,Rajkumar
[root@krishna~]#cat/etc/aliases
marketing:postmaster
sales:postmaster
support:postmaster
gls:anand
acct:anand,sasi,Rajkumar

[root@krishna~]#chkconfigpostfixon
[root@krishna~]#servicepostfixrestart
Shuttingdownpostfix:[OK]
Startingpostfix:[OK]
7.1ConfigureSMTP
configureyoursystemtoprovideSMTPmailserviceaccordingtothefollowing
requirements
(i)yourmailservershouldacceptmailfromremotehostsandlocalhost.
(ii)harrymustabletoreceivemailfromremotehosts
iii)maildeliveredtoharryshouldspoolintothedefaultmail
spoolforharry,/var/spool/mail/harry
[root@krishna~]#mailsasi
Subject:hi
hru
EOT
[root@krishna~]#cat/var/spool/mail/sasi
Fromroot@krishna.localdomainMonNov1115:10:372013
ReturnPath:<root@krishna.localdomain>
XOriginalTo:sasi
DeliveredTo:sasi@krishna.localdomain
Received:bykrishna.localdomain(Postfix,fromuserid0)
idB70F01A0198;Mon,11Nov201315:10:370500(EST)
Date:Mon,11Nov201315:10:370500
To:sasi@krishna.localdomain
Subject:hi
UserAgent:Heirloommailx12.47/29/08
MIMEVersion:1.0
ContentType:text/plain;charset=usascii
ContentTransferEncoding:7bit
MessageId:<20131111201037.B70F01A0198@krishna.localdomain>
From:root@krishna.localdomain(root)
hru

8.[root@krishna~]#yuminstallnfs*y
Loadedplugins:fastestmirror,refreshpackagekit,security
Loadingmirrorspeedsfromcachedhostfile
*base:centosmirror.go4hosting.in
*extras:mirrors.digipower.vn
*updates:centosmirror.go4hosting.in
SettingupInstallProcess
Packagenfsutilslib1.1.56.el6.x86_64alreadyinstalledandlatestversion
Package1:nfsutils1.2.336.el6.x86_64alreadyinstalledandlatestversion
Packagenfs4acltools0.3.36.el6.x86_64alreadyinstalledandlatestversion
ResolvingDependencies
>Runningtransactioncheck
>Packagenfsutilslibdevel.x86_640:1.1.56.el6willbeinstalled
>ProcessingDependency:pkgconfig(libgssglue)forpackage:nfsutilslibdevel1.1.5
6.el6.x86_64
>Runningtransactioncheck
>Packagelibgssgluedevel.x86_640:0.111.el6willbeinstalled
RunningTransaction
Installing:libgssgluedevel0.111.el6.x86_641/2
Installing:nfsutilslibdevel1.1.56.el6.x86_642/2
Verifying:nfsutilslibdevel1.1.56.el6.x86_641/2
Verifying:libgssgluedevel0.111.el6.x86_642/2
Installed:
nfsutilslibdevel.x86_640:1.1.56.el6
DependencyInstalled:
libgssgluedevel.x86_640:0.111.el6
Complete!
[root@krishna~]#chkconfignfson
[root@krishna~]#servicenfsrestart
ShuttingdownNFSdaemon:[FAILED]
ShuttingdownNFSmountd:[FAILED]
ShuttingdownNFSquotas:[FAILED]
StartingNFSservices:[OK]
StartingNFSquotas:[OK]
StartingNFSmountd:[OK]
StoppingRPCidmapd:[OK]
StartingRPCidmapd:[OK]
StartingNFSdaemon:[OK]


[root@krishna~]#servicenfsrestart
ShuttingdownNFSdaemon:[OK]
ShuttingdownNFSmountd:[OK]
ShuttingdownNFSquotas:[OK]
StartingNFSservices:[OK]
StartingNFSquotas:[OK]
StartingNFSmountd:[OK]
StoppingRPCidmapd:[OK]
StartingRPCidmapd:[OK]
StartingNFSdaemon:[OK]
[root@krishna~]#servicenfslockrestart
StoppingNFSlocking:[OK]
StoppingNFSstatd:[OK]
StartingNFSstatd:[OK]
(i)exportyour/commondirectoryviaNFStotheexample.comdomainorip
[root@krishna~]#mkdir/common
[root@krishna~]#vi/etc/export
/common192.168.0.0/255.255.255.0(wr)
[root@krishna~]#exportfsa
[root@krishna~]#servicenfsrestart
ShuttingdownNFSdaemon:[OK]
ShuttingdownNFSmountd:[OK]
ShuttingdownNFSquotas:[OK]
ShuttingdownNFSservices:[OK]
StartingNFSservices:[OK]
StartingNFSquotas:[OK]
StartingNFSmountd:[OK]
StoppingRPCidmapd:[OK]
StartingRPCidmapd:[OK]
StartingNFSdaemon:[OK]


[root@krishna~]#servicenfslockrestart
StoppingNFSlocking:[OK]
StoppingNFSstatd:[OK]
StartingNFSstatd:[OK]
Clientside
[root@vrndavan~]#mkdir/var/ftp
[root@vrndavan~]#mounttnfs192.168.1.71:/common//var/nfs/
[root@vrndavan~]#mount
/dev/mapper/vg_vrndavanlv_rooton/typeext4(rw)
procon/proctypeproc(rw)
sysfson/systypesysfs(rw)
devptson/dev/ptstypedevpts(rw,gid=5,mode=620)
tmpfson/dev/shmtypetmpfs(rw)
/dev/sda1on/boottypeext4(rw)
/dev/mapper/vg_vrndavanlv_homeon/hometypeext4(rw)
noneon/proc/sys/fs/binfmt_misctypebinfmt_misc(rw)
sunrpcon/var/lib/nfs/rpc_pipefstyperpc_pipefs(rw)
nfsdon/proc/fs/nfsdtypenfsd(rw)
192.168.1.71:/common/on/var/nfstypenfs
(rw,vers=4,addr=192.168.1.71,clientaddr=192.168.1.70)
[root@vrndavan~]#vi/etc/fstab
[root@vrndavannfs]#cat/etc/fstab
#
#/etc/fstab
#CreatedbyanacondaonWedAug1422:46:202013
#
#Accessiblefilesystems,byreference,aremaintainedunder'/dev/disk'
#Seemanpagesfstab(5),findfs(8),mount(8)and/orblkid(8)formoreinfo
#
/dev/mapper/vg_vrndavanlv_root/ext4defaults11
UUID=638d1e1acc4c402da3dc7fbee2ecafe9/bootext4defaults12
/dev/mapper/vg_vrndavanlv_home/homeext4defaults12
/dev/mapper/vg_vrndavanlv_swapswapswapdefaults00
tmpfs/dev/shmtmpfsdefaults00
devpts/dev/ptsdevptsgid=5,mode=62000

sysfs/syssysfsdefaults00
proc/procprocdefaults00
192.168.1.71:/common/var/nfs/nfsrw,sync,hard,intr00
Note:Becauseyouwillnothaverootaccessyouwillnotbeabledirectlymountyour
exported
/commondirectoryonyourvirtualsystem,howeverautofsisrunningonyourphysical
[root@vrndavan~]#mount
/dev/mapper/vg_vrndavanlv_rooton/typeext4(rw)
procon/proctypeproc(rw)
sysfson/systypesysfs(rw)
devptson/dev/ptstypedevpts(rw,gid=5,mode=620)
tmpfson/dev/shmtypetmpfs(rw)
/dev/sda1on/boottypeext4(rw)
/dev/mapper/vg_vrndavanlv_homeon/hometypeext4(rw)
noneon/proc/sys/fs/binfmt_misctypebinfmt_misc(rw)
sunrpcon/var/lib/nfs/rpc_pipefstyperpc_pipefs(rw)
nfsdon/proc/fs/nfsdtypenfsd(rw)
192.168.1.71:/common/on/var/nfstypenfs
(rw,vers=4,addr=192.168.1.71,clientaddr=192.168.1.70)
[root@vrndavan~]#dfh
FilesystemSizeUsedAvailUse%Mountedon
/dev/mapper/vg_vrndavanlv_root
50G35G13G75%/
tmpfs1.9G900K1.9G1%/dev/shm
/dev/sda1485M93M368M21%/boot
/dev/mapper/vg_vrndavanlv_home
176G6.8G161G5%/home
192.168.1.71:/common/
50G9.5G38G21%/var/nfs
9.SAMBA
YourSMBservermustbeamemberoftheSMBGROUPworkgroup
Thesharesnamemustbecommon
Thecommonsharemustbeavailabletoexample.comdomainclientsonly
Thecommonsharemustbebrowseable
GNANAmusthavereadaccesstotheshare,authenticatingwiththesame
password


[root@krishna~]#yuminstallsamba*y
Loadedplugins:fastestmirror,refreshpackagekit,security
Loadingmirrorspeedsfromcachedhostfile
*base:centosmirror.go4hosting.in
*extras:mirrors.digipower.vn
*updates:centosmirror.go4hosting.in
SettingupInstallProcess
Packagesambacommon3.6.9151.el6_4.1.x86_64alreadyinstalledandlatestversion
Packagesamba4libs4.0.055.el6.rc4.x86_64alreadyinstalledandlatestversion
Packagesambaclient3.6.9151.el6_4.1.x86_64alreadyinstalledandlatestversion
Packagesambawinbind3.6.9151.el6_4.1.x86_64alreadyinstalledandlatestversion
Packagesambawinbindclients3.6.9151.el6_4.1.x86_64alreadyinstalledandlatestversion
ResolvingDependencies
>Runningtransactioncheck
>Packagesamba.x86_640:3.6.9151.el6_4.1willbeinstalled
>Packagesambadoc.x86_640:3.6.9151.el6_4.1willbeinstalled
>Packagesambadomainjoingui.x86_640:3.6.9151.el6_4.1willbeinstalled
>Packagesambaswat.x86_640:3.6.9151.el6_4.1willbeinstalled
>ProcessingDependency:xinetdforpackage:sambaswat3.6.9151.el6_4.1.x86_64
>Packagesambawinbinddevel.x86_640:3.6.9151.el6_4.1willbeinstalled
>Packagesambawinbindkrb5locator.x86_640:3.6.9151.el6_4.1willbeinstalled
>Packagesamba4.x86_640:4.0.055.el6.rc4willbeinstalled
>Packagesamba4client.x86_640:4.0.055.el6.rc4willbeinstalled
>Packagesamba4common.x86_640:4.0.055.el6.rc4willbeinstalled
>Packagesamba4dc.x86_640:4.0.055.el6.rc4willbeinstalled
Totaldownloadsize:5.0M
Installedsize:18M
DownloadingPackages:
samba3.6.9151.el6_4.1.x86_64.rpm|5.0MB02:17
Runningrpm_check_debug
RunningTransactionTest
TransactionTestSucceeded
RunningTransaction
Installing:samba3.6.9151.el6_4.1.x86_641/1
Verifying:samba3.6.9151.el6_4.1.x86_641/1
Installed:
samba.x86_640:3.6.9151.el6_4.1
Complete!

[root@vrndavan~]#chkconfigsmbon
[root@vrndavan~]#chkconfignmbon
[root@vrndavan~]#servicesmbrestart
[root@vrndavan~]#servicenmbrestart
[root@vrndavan~]#vi/etc/samba/smb.conf
workgroup=SMBGROUP
serverstring=SambaServerVersion%v

;
netbiosname=MYSERVER

;
interfaces=loeth0192.168.12.2/24192.168.13.2/24
hostsallow=192.168.1.0/24

[samba]
path=/samba
browseable=yes
writelist=no
[root@krishna~]#useraddgnana
[root@krishna~]#passwdgnana
Changingpasswordforusergnana.
Newpassword:
BADPASSWORD:itistooshort
BADPASSWORD:istoosimple
Retypenewpassword:
passwd:allauthenticationtokensupdatedsuccessfully.
[root@krishna~]#smbpasswdagnana
NewSMBpassword:
RetypenewSMBpassword:
Addedusergnana.
[root@krishna~]#smbpasswdegnana
Enabledusergnana.
[root@krishna~]#
[root@krishna~]#getseboola|grepsamba
samba_create_home_dirs>off
samba_domain_controller>off
samba_enable_home_dirs>off
samba_export_all_ro>off

[root@krishna~]#setseboolPsamba_enable_home_dirson
[root@krishna~]#getseboola|grepsamba
samba_create_home_dirs>off
samba_domain_controller>off
samba_enable_home_dirs>on
samba_export_all_ro>off
samba_export_all_rw>off
samba_portmapper>off
samba_run_unconfined>off
samba_share_fusefs>off
samba_share_nfs>off
sanlock_use_samba>off
use_samba_home_dirs>off
virt_use_samba>off
[root@krishna~]#chconRtsamba_share_t/samba/
[root@krishna~]#servicesmbrestart
ShuttingdownSMBservices:[OK]
StartingSMBservices:[OK]
[root@krishna~]#servicenmbrestart
ShuttingdownNMBservices:[OK]
StartingNMBservices:[OK]
sshserver
susanhasremoteSSHaccesstoyourmachinefromwithinexample.com
Clientswithincracker.orgshouldNOThaveaccesstosshonyoursystem
[root@krishna~]#yuminstallopenssh*y
[root@krishna~]#chkconfigsshdon
[root@krishna~]#servicesshdrestart
Stoppingsshd:[OK]
Startingsshd:[OK]
[root@krishna~]#vi/etc/host
host.confhostshosts.allowhosts.deny
[root@krishna~]#vi/etc/hosts.deny
[root@krishna~]#cat/etc/hosts.deny
sshd:

172.24.0.0/255.255.255.0

10.IPForwarding
EnableIPforwarding
[root@krishna~]#vi/etc/sysctl.conf
[root@krishna~]#servicenetworkrestart
[root@krishna~]#cat/etc/sysctl.conf
#KernelsysctlconfigurationfileforRedHatLinux
#
#Forbinaryvalues,0isdisabled,1isenabled.Seesysctl(8)and
#sysctl.conf(5)formoredetails.
#ControlsIPpacketforwarding
net.ipv4.ip_forward=1
#Controlssourcerouteverification
net.ipv4.conf.default.rp_filter=1
#Donotacceptsourcerouting
net.ipv4.conf.default.accept_source_route=0
#ControlstheSystemRequestdebuggingfunctionalityofthekernel
kernel.sysrq=0
#ControlswhethercoredumpswillappendthePIDtothecorefilename.
#Usefulfordebuggingmultithreadedapplications.
kernel.core_uses_pid=1
#ControlstheuseofTCPsyncookies
net.ipv4.tcp_syncookies=1
#Disablenetfilteronbridges.
net.bridge.bridgenfcallip6tables=0
net.bridge.bridgenfcalliptables=0
net.bridge.bridgenfcallarptables=0
#Controlsthedefaultmaxmimumsizeofamesagequeue
kernel.msgmnb=65536
#Controlsthemaximumsizeofamessage,inbytes
kernel.msgmax=65536
#Controlsthemaximumsharedsegmentsize,inbytes

kernel.shmmax=68719476736

#Controlsthemaximumnumberofsharedmemorysegments,inpages
kernel.shmall=4294967296
11.HTTPSERVER
[root@krishna~]#yuminstallhttp*
Loadedplugins:fastestmirror,refreshpackagekit,security
Loadingmirrorspeedsfromcachedhostfile
*base:centosmirror.go4hosting.in
*extras:mirrors.digipower.vn
*updates:centosmirror.go4hosting.in
SettingupInstallProcess
Packagehttpd2.2.1529.el6.centos.x86_64alreadyinstalledandlatestversion
Packagehttpdtools2.2.1529.el6.centos.x86_64alreadyinstalledandlatestversion
ResolvingDependencies
>Runningtransactioncheck
>Packagehttpddevel.x86_640:2.2.1529.el6.centoswillbeinstalled
>ProcessingDependency:aprutildevelforpackage:httpddevel2.2.1529.el6.centos.x86_64
>ProcessingDependency:aprdevelforpackage:httpddevel2.2.1529.el6.centos.x86_64
Verifying:expatdevel2.0.111.el6_2.x86_645/5
Installed:
httpddevel.x86_640:2.2.1529.el6.centos
httpdmanual.noarch0:2.2.1529.el6.centos
DependencyInstalled:
aprdevel.x86_640:1.3.95.el6_2
aprutildevel.x86_640:1.3.93.el6_0.1
expatdevel.x86_640:2.0.111.el6_2
Complete!
[root@krishna~]#chkconfighttpdon
[root@krishna~]#servicehttpdrestart
Stoppinghttpd:[FAILED]
Startinghttpd:httpd:apr_sockaddr_info_get()failedforkrishna
httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using
127.0.0.1forServerName
[OK]
[root@krishna~]#servicehttpdrestart

Stoppinghttpd:[OK]
Startinghttpd:httpd:apr_sockaddr_info_get()failedforkrishna
httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using
127.0.0.1forServerName
[OK]
*WebServer
Implementawebserverforthesitehttp://station.domainX.example.com,
Thenperformthefollowingsteps:
Downloadftp://station.domain254.example.com/pub/rhce/station.html
Renamethedownloadedletoindex.html
Copythisindex.htmltotheDocumentRootofyourwebserver
DoNOTmakeanymodicationstothecontentofindex.html
*createascriptunder/root/casethatprovidesthefollowingdetails:
i)whenrunas/root/caseKERNELitproducestheoutput"USER".
ii)whenrunas/root/caseUSER,itproducestheoutput"KERNEL".
iii)whenrunwithoutargrumentoranyotherargument,otherthanKERNELorUSERitsends
thefollowing
output"KERNELUSER"
script
#!/bin/bash
Case$@in
KERNEL)echoUSER;;
USER)echoKERNEL;;
*)echoKERNELUSER;;
Casc

[root@krishna~]#chmodu+xscript

[root@krishna~]#./seript

Вам также может понравиться