Documente Academic
Documente Profesional
Documente Cultură
Page 1 of 12
TeQ RecipeS
Your "COOKBOOK" Of Open Source And Various Technologies
HOME
ABOUT
CONTACT US
PRIVACY POLICY
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
Initial Configuration :Go to single user mode and set the password.
Firewall and Selinux configuration
#lokkit --disabled
#lokkit --selinux=permissive
#setup
http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/
2/25/2015
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
#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 -
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
Page 3 of 12
:wq!
#mail student@serverX.example.com
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
Page 4 of 12
Remote testing
#mail admin@serverX.example.com
$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!
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
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.
or
vsftpd:.my133l.org
wq!
Local testing
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!
Local testing
http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/
2/25/2015
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
wq!
#mount -
#df -!
8) SSH
Congigure ssh server.
.my133l.org (.remote.test) should be denied access to ftp server
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
Page 7 of 12
<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
#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.
Copy iqn.2010-09.com.example:rdisks.serverX
#fdisk cu /dev/sda
http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/
2/25/2015
Page 8 of 12
#mkfs.ext4 /dev/sda1
#mkdir /mnt/iscsi
#blkid /dev/sda1
Copy UUID
#vi /etc/fstab
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
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
[GLOBAL]
workgroup=MYGROUP Change it to IT
[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
#useradd jean
#passwd jean
#vi /etc.cron.deny
Jean
:wq!
http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/
2/25/2015
Page 10 of 12
#su jean
$crontab
#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
#vi /etc/grub.conf
Kernel.............................................................................auto
rhgb quiet
http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/
2/25/2015
Page 11 of 12
wq!
#init 6
#nmap 192.168.0.[100+X]
#chkconfig --list
#cat /proc/cmdline
#df !
#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
Page 12 of 12
#/root/s1.sh bar
#/root/s1.sh abcd
Like
http://teqrecipes.com/rhce-lab-exam-practice-question-and-answers/
2/25/2015