Professional Documents
Culture Documents
RHCE EXAM Solution PDF
RHCE EXAM Solution PDF
Fill the form with your name / address / email Agree with the rules and accept it
* login in runlevel 5 with GUI with root:
- change the root password to "V2nCda10".
- assign the static ip
Ip : 192.168.0.X (X is your station number)
Netmask : 255.255.255.0
Gateway : 192.168.0.1
DNS : 192.168.0.254
Ans.
root@station1 ~]#echo "V2nCda10" | passwd --stdin root
root@station1 ~]#vim /etc/sysconfig/network-scripts/ifcfg-eth0
- & do following changes:
BOOTPROTO="static"
IPADDR="192.168.0.X"
NETMASK="255.255.255.0"
Gateway="192.168.0.1"
:wq
root@station1 ~]# vim /etc/resolv.conf
search example.com
nameserver 192.168.0.254
:wq
Q.1 Once Your System is installed the distribution is available via YUM:
YUM ftp://instructor.example.com/pub/rhel6/dvd
Ans.
root@station1 ~]# vim /etc/yum.repos.d/client.repo
[Client]
name=yum client
baseurl=ftp://instructor.example.com/pub/rhel6/dvd
gpgcheck=0
:wq
root@station1 ~]# yum list all
( Note: Your New Grub file look like below after install the new kernel )
Q.5 Set up the default local print queue to forward jobs to the IPP (CUPS) print
queue stationX on instructor.example.com, where X is your station number.
Configure the printer as a "Generic-text-only" print queue.
Ans.
root@station1 ~]#system-config-printer
--> Click New Printer
--> Type stationX
--> select ipp ( Internet Printing Protocol )
--> Type Hostname --> instructor.example.com
--> Type printername --> stationX
--> select Generic --> Text Only Printer Type
& than click your stationX under local printer at the left hand-side
after that click make default printer tab at the right hand-side
Q.6 The user andrew must configure a cron job that runs daily at 15:25 local time
and executes
- /bin/echo hello >>/dev/tty1
Ans.
root@station1 ~]#crontab -u paula -e
25 15 * * * /bin/echo hello >>/dev/tty1
root@station1 ~]#service crond restart; chkconfig crond on
Q.7 Configure your machine as LDAP client. LDAP server and LDAP directory tree
information will be given in the exam.
- ldapuserX should be able to log into your system, where X is your station
number, but will not have
a home directory until you have completed the autofs requirement.
- All ldapuser users have a password of password
Ans.
root@station1 ~]#system-config-authentication
--> On the Identity & Authentication tab, select User A/C Configuration
check box, choose LDAP for User A/C
Database
--> Configure LDAP Search Base DN with: dc=example,dc=com
--> Configure LDAP Server with the URI: ldap://instructor.example.com
--> Select Use TLS to encrypt connections and Click Download CA Certificate
--> Enter Certificat URL: http://instructor.example.com/pub/EXAMPLE-CA-CERT
& click ok
--> Enable LDAP under Authentication Configuration & Click Apply button.
root@station1 ~]#getent passwd ldapuserX [ To check client & server mapping ]
* Now check by logging through ldapuserX (Suppose you are sitting at station2
then your user will be ldapuser2)
* the password of ldapuser2 is password
Q.8 Configure autofs to automount the home directories of LDAPUSER users. Note the
following:
- server1.example.com (192.168.0.254) NFS-exports /home/guests for ldapuser,
- ldapuserX's home directory is server1.example.com:/home/guests/ldapuserX,
where X is your station number
- ldapuserX's home directory should be automounted locally beneath
/home/guests as /home/guests/ldapuserX
- home directories must be writable by their users.
- while you are able to log in as any of the user ldapuser1 through
ldapuser20, the only home directory that is
accessible from your system is ldapsuserX
* Example: station2 would configure the automounter such that ldapuser2's home
directory /home/guests/ldapuser2 gets mounted
automatically upon login. The NFS share would be:
- instructor.example.com:/home/guests/ldapuser2.
Ans.
root@station1 ~]# vim /etc/auto.master
/home/guests /etc/auto.guests
Q.12 Your system has a new 100MB physical partition mounted under /mnt/new with a
100MB ext4 filesystem. Note: because partition sizes are seldom exactly what is
specified when they are created, anything within the range of 90MB to 110MB is
acceptable.
Q.14 Resize the LVM using the GUI tool by the PE value.
Q.16 Configure Internet web server for your domain. Download the index.html from
the server
(IP and location will be specified in the exam) into the default
document root of the server
- Download ftp://instructor.example.com/pub/rhce/station.html
- Rename the downloaded file to index.html
- Copy this index.html file to the DocumentRoot of your web server
- Do NOT make any modifications to the content of index.html
Ans.
root@station1 ~]#yum install httpd -y
root@station1 ~]#cd /var/www/html
root@station1 ~]#lftp instructor.example.com/pub/rhce
root@station1 ~]#lftp instructor.example.com:/pub/rhce> get station.html
root@station1 ~]#lftp instructor.example.com:/pub/rhce> bye
root@station1 ~]#mv station.html index.html
root@station1 ~]#vim /etc/httpd/conf/httpd.conf
* than press shift + g ( to go End of the file )
<VirtualHost 192.168.0.X:80>
ServerAdmin root@stationX.example.com
DocumentRoot /var/www/html
ServerName stationX.example.com
DirectoryIndex index.html
</VirtualHost>
* NOTE:- When we download the file directly into the default DocumentRoot then
there is no need to change the security context of the index.html file
Q.17 Find a file created by a user susan and copy it into a directory some
directory.
Ans.
root@station1 ~]# find / -user susan -exec cp -rpf {} /root/data/ \; 2> /dev/null
Q.18 Find a string from a file and copy that string in a different file (name and
location will be specified).
Ans.
root@station1 ~]#grep root /etc/passwd --color > /root/Desktop/newfile
NOTE: You will note that some requirements specify that a service should not be
available from the DNS domain
my133t.org (172.24.0.0/255.255.0.0). All system in that domain are in the
192.168.0.0/255.255.255.0 subnet.
Ans.
Simply edit it's configuration file set the enfocing mode infront of SELINUX
directive like that, & to make it permanenet reboot your system.
Ans-
root@station1 ~]#vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
:wq
root@station1 ~]#sysctl -w
root@station1 ~]#sysctl -p
Ans-
root@station1 ~]#yum install dovecot
root@station1 ~]#vim /etc/dovecot/dovecot.conf
protocols = imap pop3
:x
root@station1 ~]#/etc/init.d/dovecot restart;chkconfig dovecot on
root@station1 ~]#iptables -F
root@station1 ~]#iptables -A INPUT ! -s 192.168.0.0/24 -p tcp --dport 22 -j REJECT
root@station1 ~]#iptables -A INPUT ! -s 192.168.0.0/24 -p udp --dport 22 -j REJECT
root@station1 ~]#service iptables save
Ans-
root@station1 ~]#yum install vsftpd
root@station1 ~]#getsebool -a |grep ftp
root@station1 ~]#setsebool -P allow_ftpd_full_access on
root@station1 ~]#vim /etc/hosts.deny
vsftpd,sshd:ALL EXCEPT .example.com
:wq
Ans-
root@station1 ~]# mkdir /shared
root@station1 ~]#chcon -R -t samba_share_t /shared
root@station1 ~]#getsebool -a |grep samba
root@station1 ~]#setsebool -P samba_enable_home_dirs on
root@station1 ~]#vim /etc/samba/smb.conf
workgroup = SMBGROUP
interface lo eth0 192.168.0.12/24
host allow 127. 192.168.0.
[shared]
comment = shared
path = /shared
browseable = yes
valid users = susan
:wq
Q.7 Configure Internet web server for your domain. Download the index.html from
the server.
(IP and location will be specified in the exam) into the default document root of
the server
- Download ftp://instructor.example.com/pub/rhce/station.html
- Rename the downloaded file to index.html^M
- Copy this index.html file to the DocumentRoot of your web server
- Do NOT make any modifications to the content of index.html
Ans-
root@station1 ~]#yum install httpd
root@station1 ~]#cd /var/www/html
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost 192.168.0.17:80> (again enter your ip address before port 80)
ServerAdmin root@desktop17.example.com
DocumentRoot /var/www/html (Define here your document root)
ServerName desktop17.example.com (Define here your website name)
DirectoryIndex index.html (Define here directory index)
</VirtualHost>
:wq
Q.8 Export your /shared directory via NFS to the example.com domain only:
- You can check your shared directory but shoumount will not allow becuse you
login from local user
- You may check by using /net directory
Ans-
root@station1 ~]#vim /etc/exports
/shared *.example.com(rw,sync)
:wq
root@station1 ~]#chkconfig nfs on
root@station1 ~]#service nfs restart
root@station1 ~]#cd /net/192.168.0.17
root@station1 ~]#ll
total 0
dr-xr-xr-x. 3 root root 0 Jul 28 19:44 shared
Q.9 Configure an email alias for your MTA such that mail sent to acctmgr is
received by the local user paula.
Ans-
Q.11 Extend your web server to include a virtual host for the site
http://wwwX.example.com, where X is your station
number, then perform the following steps:
- Set the DocumentRoot to /var/www/virtual
- Download ftp://instructor.example.com/pub/rhce/www.html
- Rename the downloaded file to index.html^M
- Place this index.html in the DocumentRoot of the virtual host
- Do NOT make any modifications to the content of index.html
- Ensure that susan is able to create content in /var/www/virtual
* NOTE: The original web site http://stationX.example.com must still be
accessable, DNS resolution for the hostname
wwwX.example.com is already provided bye NameServer on instructor.example.com.
Ans-
root@station1 ~]#mkdir /var/www/virtual
root@station1 ~]#cd /var/www/virtual
Q.12 Pass the kernel argument sysctl=1 to the kernel and make sure that the
argument is available across the reboot.
Ans-
root@station1 ~]#vim /etc/grub.conf
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.32-71.el6.x86_64.debug)
root (hd0,0)
kernel /vmlinuz-2.6.32-71.el6.x86_64 ro root=/dev/mapper/vol0-root
rd_LVM_LV=vol0/root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8
SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto
sysctl=1 rhgb quiet
initrd /initramfs-2.6.32-71.el6.x86_64.img
:wq
Q.13 Create a script that should print foo or bar when user input foo or bar
otherwise show something else.
Ans-
vim script.sh
#!/bin/bash
F1=$1
if [ $F1 == foo ];then
echo "bar"
elif [ $F1 == bar ];then
echo "foo"
else
echo "Please Type foo or bar"
fi
:wq
Now list your target to check it's name, use the following command & create a
partition of 1200MB & mount it on /mnt/data1
root@station1 ~]#fdisk -l
root@station1 ~]#fdisk /dev/sdb
#WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Q.16 The user paula should not have permission to schedule a cron job.
Ans-
Q.17 Extend your website. Create a directory in document root name as secret.
Placed document root in configuration file as
/var/www/html/secret. This web-site should be access on your local host
and should be acces on others.
Ans-
root@station1 ~]#mkdir /var/www/html/secret
root@station1 ~]#vim /var/www/html/secret/index.html
local wesite
:wq
root@station1 ~]#vim /etc/httpd/conf/httpd.conf
<VirtualHost 192.168.0.17:80>
ServerAdmin root@desktop17.example.com
DocumentRoot /var/www/html/secret (Define here your document root)
ServerName desktop17.example.com (Define here your website name)
DirectoryIndex index.html (Define here directory index)
</VirtualHost>
:wq
root@station1 ~]#/etc/init.d/httpd restart ;chkconfig httpd on
root@station1 ~]#elinks http://desktop17.example.com/secret
BEST OF LUCK