Thursday, February 16, 2012

RHCT & RHCE Exam Solution

RHCT & RHCE Exam Solution

Q1. Create the following users, groups and group membership:

#  groupadd sysusers
#  useradd -G sysusers andrew; passwd andrew
#  useradd -G sysusers susan; passwd susan
#  useradd -s /sbin/nologin brad; passwd brad

Q2. Create a collaborative directory /shared/sysusers with following 
       characteristics:

#  mkdir -p /shared/sysusers
#  chgrp sysusers /shared/sysusers
#  chmod 2770 /shared/sysusers

Q3. Install appropriate kernel update from
       ftp://server1.example.com/pub/updates.

-   First download kernel from server using ftp.
#  ftp 192.168.1.254
#  mget kernel-* name
#  rpm -ivh -aid -force kernel-*
-    Check the /etc/grub.conf in that file what is the default=0 is there or not.

Q4. Enable IP forwarding on your machine.

#  vim /etc/sysctl.conf
     (line no. 7 ) net.ipv4.ip_forward = 1
#  sysctl -p
#  service network restart

Q5. The user andrew must configure a cron job that runs daily at 15:25 local
       time and executes  "/bin/echo hello".

#  crontab -eu andrew
     25  15  *  *  * /bin/echo "hello"
#  service crond restart
#  chkconfig crond on

Q6. Bind to the NIS domain RHCE provided by 192.168.1.254 for usre
       authentication.
# authconfig-tui
    select user NIS
#  ypcat passwd
#  vim /etc/auto.master
     /rhome/stationX    /etc/auto.misc
#  vim /etc/auto.misc
     -rw,soft,intr      192.168.1.254:/rhome/nisuserX
#  service autofs restart
#  chkconfig autofs on

Q7. Copy the file /etc/fstab to /var/tmp configure the permission of /var/tmp/fstab

#  cp -prf /etc/fstab     /var/tmp
#  setfacl -m u:andrew:rw /var/tmp/fstab
#  setfacl -m u:susan:--- /var/tmp/fstab
#  getfacl /var/tmp/fstab

Q8. Configure SSH access as follows.

#  yum install openssh*
#  vim /etc/ssh/sshd_config
     allowusers susan
#  service sshd restart
#  chkconfig sshd on
#  iptables -I INPUT -s 192.168.0.0/255.255.255.0 -d 192.168.0.X -p tcp --dport
     22 -j REJECT

Q9. Configure POP3 email on your system according to these criteria

#  yum install sendmail*
#  yum install dovecot*
#  vim /etc/mail/sendmail.mc
     ( line no. 116) dnl # DAEMON_OPTIONS ('port-smtp,addr-
     127.0.0.1,Name=MTA') dnl
#  vim /etc/aliases
     brad:  brad
#  vim /etc/dovecot.conf
     Uncomment line no. 17
#   service sendmail restart
#   service dovecot restart
#   chkconfig sendmail on
#   chkconfig dovecot on
#   iptables -I INPUT -s 192.168.0.0/255.255.0.0 -d 192.168.0.X -p tcp -dport 110
      -j REJECT

Q10. Configure FTP access on your system

#  yum install vsftp*
#  vim /etc/vsftpd/vsftpd.conf
#  service vsftpd restart
#  chkconfig vsftpd on
#  iptables -I INPUT -s 192.168.0.0/255.255.255.0 -d 192.168.0.X -p tcp -dport 21
     -j REJECT

Q11. Share the /shared directory via SMB

#  yum install samba* -y
#  vim /etc/samba/smb.conf
    line 18: workgroup =  SMBGROUP
    line 41: hosts allow 192.168.0.0
    go to bottom of the file and copy last 8 lines and make them uncomment
    [shared]
    comment                 =  %m's stuff
    path                        =  /shared
    valid users              =  susan
    public                      =  no
    writable                  =  no
    printable                 =  no
    create mask            =  0765
    browseable             =  yes
#  service smb restart
#  chkconfigg smb on
#  smbpasswd -a susan
#  smbclient //192.168.0.X/shared -U susan
                      own pc IP address
#  chcon - R -t public_contect_t /shared

Q12. Implement a web server for the site http://stationX.example.com

  First download the index page from
  ftp://server1.example.com/pub/rhce/station.html
#  yum install http*
#  cp -rf stationX.html /var/www/html
#  cd /var/www/html
#  mv stationX.html index.html
#  vim /etc/httpd/conf/http.conf
     250   ServerAdmin    root@stationX
     264   ServerName     stationX.example.com:80

 The bottom of the configuration and copy last line and configure

 
      ServerAdmin  root@stationX
      DocumentRoot /var/www/html
      ServerName stationX.example.com
      ErrorLog logs/ com-error_log
      Customlog logs/ access_log common
 

Q13. Export your /shred directory via NFS to example.com domain only

#  yum install portmap*
#  yum install nfs*
#  vim /etc/exports
     /shred            *.192.168.0.0/255.255.255.0(ro,sync)
#  service portmap restart
#  service nfs restart
#  chkconfig portmap on
#  chkconfig nfs on

Q14. Configure an email alias for your MTA such that mail send to acctmgr
         is received by the local user andrew

#  vim /etc/aliases
     acctmgr:    andrew
#  newaliases
#  service sendmail restart
#  service dovecot restart

Q15. Configure SMTP mail service

#  vim /etc/mail/access
     Insert Connect:0.0.0.0/0.0.0.0     RELAY
#  service sendmail restart
#  service dovecot restart
#  chkconfig sendmail on
#  chkconfig dovecot on

ADDITIONAL RCHE QUES ANS.

Q1. Implement a web proxy server bound to port 8080

#  yum install squid*
#  vim /etc/squid/squid.conf
     Line no. 73  http_port 8080
     Line no. 2410 acl mynet src 192.168.0.0/255.255.255.0
     http_access allow mynet
#  service squid restart
#  chkconfig squid on

Q2. Extend you web server to include a virtual host for site
       http://wwwX.example.com

#  mkdir -p /var/www/virtual
#  vim /etc/httpd/conf/httpd.conf
     Once again copy last line and configure for virtual host
 
     ServerAdmin root@stationX
     DocumentRoot /var/www/virtual
     ServerName wwwX.example.com
     ErrorLog logs/ access_log common
 
#  line no. 971 NameVirtualHost 192.168.0.X:80
#  service httpd restart
#  chkconfig httpd on
#  firefox
     wwwX.example.com

 

No comments: