Sunteți pe pagina 1din 12

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 1 of 12

TeQ RecipeS
Your "COOKBOOK" Of Open Source And Various Technologies

HOME

ABOUT

CONTACT US

PRIVACY POLICY

RHCE Training Delhi


Best Red Hat Partner for 7 Years 10200+ Red Hat Certified Students

Posted by hemant on December 6, 2014

RHCE Lab Exam Practice Question and Answers


Posted in: Linux, RHCSA and RHCE.

Free GRE Practice Test


Online Test Series For GRE Exam. 5000+ Practice Question. Join Now !

These are some questions i faced in my RHCSA and RHCE lab exams and following steps i have
taken to clear my both exams. If you want to clear both the exams in a single attempt then i would
request you to follow these steps i have taken.
Note:- This was my Lab Scenario, in your exam the lab may be completely different i am just sharing
my lab experience with you and guiding you how i solved my both labs or you can setup your own lab
at home and try these questions for practice. For RHCSA visit here

RHCE
Note:- new virtual system will be given for RHCE Exam Paper so set the password and put ur system
on dhcp according to the exam paper.

IPADD=DHCP
DNS 192.168.0.254
YUM Repository URL ftp://instructor.example.com/pub/rhel/dvd/Server

.example.com 192.168.0.0/24 (ur n/w address)


.remote.test 192.168.1.0/24 (cracker's n/w address)

Password for all users=password

Initial Configuration :Go to single user mode and set the password.
Firewall and Selinux configuration

#lokkit --disabled
#lokkit --selinux=permissive
#setup

Setup the network configuration to dhcp and dns as specified.


Now set yum Client

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 2 of 12

#vim Server.repo
[Server]
name=Server
baseurl=ftp://192.168.0.254/pub/rhel6/dvd/Server
enabled=1
gpgcheck=0
:wq!

#init 6

Login with root


Now start checking conectivity

#ifconfig
#hostname
#ping 192.168.0.254 ////server ( instructor) ip address
#nslookup 192.168.0.[100+X] //// your ip address
# yum list all

1) Selinux
Set SELinux to enforcing mode

#lokkit --disabled
#lokkit --selinux=enforcing
#sestatus
#setenforce 1
#sestatus

2) Ip forwarding
Configure your host such that it can forward ipv4 packets

#vi /etc/sysctl.conf
Change net.ipv4.ip_forward = 0 change 0 to 1

:wq!

#sysctl -

Note:- install nmap to check the configuration later

3) SMTP
Note: check username
Configure an SMTP mail server. Your host should be able to receive remote mails.
Mail of student should be spooled to /var/spool/mail/student.

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 3 of 12

#rpm -qa postfix


#vi /etc/postfix/main.cf

Search for [ine no.113] #inet_interface=all remove # of the line


Add [Line no.116] # to the line inet_interface=localhost

:wq!

#service postfix restart


#chkconfig --level 35 postfix on
#mail student@serverX.example.com
#su - student
#mail ////you will see the mail
#q

Remote Checking go to base system

#mail student@serverX.example.com

Go to virtual system and check

#mail ////you will see the mail


#q
#logout

4)Alias
Note: check usernames
All mails sent to admin user should be directed to harry
Create user if not present and set password.

#useradd harry
#passwd harry
#useradd admin
#passwd admin

#vi /etc/aliases
At the
end
admin: harry
:wq!

#newaliases

Local testing

#mail admin@serverX.example.com

#su - harry
$mail

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 4 of 12

Remote testing

#mail admin@serverX.example.com

Now go to virtual system

$mail
$logout

4) Script
Create a script in bash /root/s1.sh such that ,If the script is run in the
following manner
# /root/s1.sh foo
o/p > bar
AND
# /root/s1.sh bar
o/p > foo
Make sure that if the no. arguement is not provided properly , then error o/p
should be displayed as
o/p > foo|bar
If wrong arguement is provided , then error o/p should be displayed as
o/p > foo|bar

#vi /root/s1.sh
#!/bin/bash
If [ $# -ne 1 ]; then
echo foo|bar >&2 ///use this if redirection is der
elif [ $1 = foo ]; then
echo bar
elif [ $1 = bar ]; then
echo foo
else
echo foo|bar >&2 ///use this if redirection is der
fi
:wq!

#chmod u+x /root/s1.sh


#/root/s1.sh
#/root/s1.sh foo
#/root/s1.sh bar
#/root/s1.sh abcd

5) FTP
Note: Check username
Configure an ftp server. User <sam> should be able to login via ftp .
anonymous user can download from your site.
This service must be accessible only over .example.com network

#useradd sam
#passwd sam
#yum install vsftpd*
#head -15 /etc/vsftpd/vsftpd.conf
Check anonymous_enable=yes

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 5 of 12

#tail -5 /etc/vsftpd/vsftpd.conf
Check tcp_wrapper=yes

Note:- if any of the above is no then open the file with vi editor and change to yes.

#service vsftpd restart


#chkconfig --level 35 vsftpd on
#getsebool -a | grep ftp
#setsebool -P ftp_home_dir 1
# getsebool -a | grep ftp
#vi /etc/hosts.deny

vsftpd:ALL EXCEPT .example.com /// depends on question

or

vsftpd:.my133l.org

wq!
Local testing

#yum install ftp


#ftp 192.168.0.[100+X]
Username: sam
Password: password
ftp> bye

remote testing

#ftp 192.168.0.[100+X]
Username: sam
Password: password
ftp> bye

6) NFS
Share a directory /common over a n/w ,accessable to (domainX.example.com) .example.com
network.

#mkdir /common
#rpm -qa nfs-utils

#vi /etc/exports
/common 192.168.0.0/24(sync)

wq!

#service nfs restart


#chkconfig --level 35 nfs on

Local testing

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 6 of 12

#showmount -

Remote testing

#showmount -e 192.168.0.117

7) Loop
Mount an iso file /root/boot.iso on /disks . This mount should be persistant across system restart
Note:- boot.iso file will be avalable in /root

#cd
#ls
#mkdir /disks
#vi /etc/fstab

/root/boot.iso /disks iso9660 defaults,loop 0 0

wq!

#mount -
#df -!

8) SSH
Congigure ssh server.
.my133l.org (.remote.test) should be denied access to ftp server

#yum install openssh-server


#service sshd restart
#chkconfig --level 35 sshd on
#vi /etc/hosts.deny
sshd:.my133l.org //// depends on question
OR
sshd:ALL EXCEPT .example.com
:wq!
#service sshd restart

Remote testing

#ssh sam@serverX.example.com
#logout

9) Apache

Host an apache webserver over your hostname. The webpage to be hosted is shared as
ftp://instructor.example.com/pub/web/station.html.

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 7 of 12

The name resolution is provided on your dns server.


Do not edit the webpage contents .

#yum install lftp*


#yum install http*
#lftp 192.168.0.254
~>cd /pub/web
~>mget station*
~>bye
#ls
#mv station.html /var/www/html/index.html
#vi /etc/httpd/conf/httpd.conf

Copy the 7 line and Remove #

<VirtualHost 192.168.0.[100+X]>
ServerAdmin webmaster@serverX.example.com
DocumentRoot /var/www/html
ServerName serverX.example.com
Errorlog logs/serverX.example.com.........
Customlog logs/serverX.example.com.........
</VirtualHost> /// save the file and exit
#httpd #service httpd restart
#chkconfig --level 35 httpd on
#restorecon -R /var/www/html
#elinks http://serverX.example.com

Check with firefox if needed


Remote testing

#elinks serverX.example.com

10) iSCSI
Import an iscsi disk from the server instructor.example.com(192.168.0.254)
The iscsi disk must be mounted as /mnt/iscsi .
This mount should be persistent across reboot.

#yum install iscsi-initiator-utils


#iscsiadm -m discovery -t st p instructor.example.com

Copy iqn.2010-09.com.example:rdisks.serverX

#iscsiadm -m node T iqn.2010-09.com.example:rdisks.server17 p 192.168.0.254

#fdisk cu /dev/sda

check how to create partition using fdisk here


format the partition as per the given filesystem

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 8 of 12

#mkfs.ext4 /dev/sda1
#mkdir /mnt/iscsi
#blkid /dev/sda1

Copy UUID

#vi /etc/fstab

Paste uuid without /mnt/iscsi ext4 defaults,_netdev 0 0

wq!

#mount -
#df -!
#cd /mnt/iscsi
#lftp 192.168.0.254
~>cd pub
~>get a
~>bye
#ls

12)Virtual Web
Host a virtual website over (wwwX.example.com) d.example.com . The webpage to be hosted
is shared asftp://instructor.example.com/pub/web/www.html .
Create a DocumentRoot /var/www/virtual for hosting this page .

#lftp 192.168.0.254
~>cd pub/web
~>mget ww*
~>bye
#ls
#mkdir /var/www/virtual
#mv www.html /var/www/virtual/index.html
#vi /etc/httpd/conf/httpd.conf

Copy the last 7 and replace serverX to wwwX and DocumentRoot to /var/www/virtual
And also remove # of NameVirtualHost *:80 and ip your ip address 192.168.0.[100+X] in place of *
wq!

#httpd
#service httpd restart
#chkconfig level 35 httpd on
#restorecon R /var/www/virtual
#elinks http://wwwX.example.com

Remote testing

#elinks http://wwwX.example.com

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 9 of 12

13) Samba
Create a samba share /common with share name common .
Your workgroup should be IT .
this share should be browseable . The natasha can access this share
as readable only .
This share is accessible only over .example.com

#yum install samba*


#mkdir /common
#vi /etc/samba/smb.conf

When you scroll down you will find

[GLOBAL]
workgroup=MYGROUP Change it to IT

go to the end of the script

[common]
path = /common
browseable = yes
read list = natasha
hosts allow = 192.168.0

wq!

#testparm
#service smb restart
#smbpasswd a natasha
#smbpasswd e natasha
#service smb restart
#chkconfig -level 35 smb on
#chcon t samba_share_t /common
#ls lZd /common
#getsebool a | grep samba
#setsebool P samba_enable_home_dir 1
#getsebool a | grep samba
#smbclient //192.168.0.[100+X]/common U natsha
Smb:\>

Remote testing

#smbclient //192.168.0.[100+X]/common U natsha


Smb:\>

14) Cron Deny


The user jean should not be able to add a cron job for herself

#useradd jean
#passwd jean
#vi /etc.cron.deny
Jean
:wq!

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 10 of 12

#su jean
$crontab

15) Secure Directory


copy the file station.html from server ( /pub/web ) OR
[ftp://instructor.example.com/pub/web/station.html] to /var/www/html/secrete/ . Secure the file & make
it available to only <serverX.example.com> over apache webserver .

#lftp 192.168.0.254
~>cd /pub/web
~>mget station*
~>bye

#mkdir /var/www/html/secure
#cp station.html /var/www/html/secrete
#vi /etc/httpd/conf/httpd.conf

<Directory /var/www/html/secrete/station.html>
AllowOverride None
Order deny,allow
Allow from serverX.example.com
Deny from all
</Directory>

wq!

#httpd
#service httpd restart
#chkconfig level 35 httpd on

Local testing

Open firefox
http://serverX.example.com/secure

remote testing

Open firefox
http://serverX.example.com/secure

16) Kernel Parameter


Pass a parameter sysvctl=1 to your kernel at boot time
. changes made should be persistant .[ /etc/cmdline output ]

#vi /etc/grub.conf

Kernel.............................................................................auto
rhgb quiet

At the end of the above line add sysvctl=1

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 11 of 12

wq!

#init 6

NOTE :- Now check all your configuration after reboot

#nmap 192.168.0.[100+X]

ftp,ssh,smtp,http,nfs port should be open

#chkconfig --list

Iscsid,nfs,smb,sshd should be runing

#cat /proc/cmdline

#df !

#smbclient //192.168.0.[100+X]/common u natasha

#mail admin@serverX.example.com

#showmount

#su harry

$mail
$logout

#ftp 192.168.0.[100+X]
Username:sam
Password:password

#elinks http://serverX.example.com
#elinks http://wwwX.example.com

Open firefox

http://serverX.example.com/secure

#/root/s1.sh
#/root/s1.sh foo

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

RHCE Lab Exam Practice Question and Answers | TeQ RecipeS

Page 12 of 12

#/root/s1.sh bar
#/root/s1.sh abcd

Best Of Luck For Your Exam

Like

RHCSA Lab Exam Practice Question and


Answers

Symantecs Backup Exec vs Netbackup

TEQRECIPES.COM All Rights Reserved.

http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/

2/25/2015

S-ar putea să vă placă și