Tag: rhce

  • rhce

    Red Hat Certified Engineer Exam Questions

    Before starting exam

    #iptables -L
    #iptables -F
    #service iptables save
    #service iptables restart
    #chkconfig iptables on
    

    1. Enable selinux as enforcing

    # setup
    firewall configuration - disabled
    # getenforce
    # lokkit --selinux=enforcing
    init6
    # cat /etc/sysconfig/system-config-firewall
    # cat /etc/stsconfig/selinux
    

    2. Enable IP forwarding on your virtual machine

    Step-01:
    
    Enable IP Forwarding permanently in your machine.
    vi /etc/sysctl.conf            (sysctl configure parameters at run level)
    change line number 7
    net.ipv4.ip_forward=1
    :wq
    
    Step-02:
    
    sysctl -p  
    

    3. Configure FTP access on your system.

    clients with in domain70.example.com should have anonymous FTP access to your machine.
    clients outside domain70.example.com should Not have access to your FTP service.

    
    Step-01:
    
    #yum install vsftpd*
    #service vsftpd restart
    #yum install ftp
    
    Step-02:
    
    #ftp 
    user:annonymous
    password: enter
    
    Step-03:
    
    #vi /etc/hosts.deny
    vsftpd: ALL EXCEPT IP/mask
    :wq!
    
    Step-04:
    
    #service vsftpd restart
    #chkconfig vsftpd on
    
    If login problem
    
    remove anonymous user from below files
    
    #vi /etc/vsftpd/vsftpd.conf
    #vi /etc/vsftpd/ftpusers
    #vi /etc/vsftpd/user_list
    

    4. Set cron service such that it can’t be accessable by mike

    Step-01:
    
    #vi /etc/cron.deny
    mike
    :wq
    
    Step-02:
    
    #service crond restart
    #chkconfig crond on
    (to check - # grep mike /etc/passwd)
    

    5. Configure ssh as follows

    natasha has remote access to your machine from with in domain70.example.com.
    client within my133t.org should not have access to ssh on your system

    
    Step-01:
    
    #vi /etc/hosts.allow
    sshd: 172.24.70.0/255.255.255.0
    :wq
    Step-02:
    
    #vi /etc/hosts.deny
    sshd:172.24.70.0/255.255.0.0
    :wq!
    
    Step-03:
    
    #service sshd restart
    #chkconfig sshd on
    #service iptables restart
    #chkconfig iptables on
    

    6. Export your /archive directory via NFS to the example.com domain only.

    or

    Export Your /common directory via NFS to the domain70.example.com domain only. (linux to linux directory sharing)

    Step-01:
    
    #vi /etc/exports
    /common 172.24.70.0/255.255.255.0(rw,sync)
    :wq
    
    Step-02:
    
    #service nfs restart
    #exportfs
    #chkconfig nfs on
    
    

    7.Share the /common directory via SMB
    Your SMB server must be a member of STAFF workgroup
    the share’s name must common
    The common share must be available to domain70.example.com clients only.
    The common share must be browseable
    natasha must have read access to the share authenticity with the password porstroll if necessary.

    
    Step-01:
    
    #yum install samba*
    
    Step-02:
    
    #vim /etc/samba/smb.conf
    Go to 74th line
    Workgroup=STAFF
    Shift+G
    copy last 7 lines using 7yy and p command
    Remove ; from all lines and edit like
    
    [common]  ( sharename
    comment=public_staff
    path=common         (path=
    valid users=natasha ( add this line)
    public=yes
    browseable=yes 
    Writable=no ( yes change to no)
    Printable=no
    :wq
    
    Step-03:
    
    #service smb restart
    
    Step-04:
    
    #smbpasswd -a natasha
    New smbpassword:postroll
    
    Step-05:
    
    #vim /etc/hosts.deny
    smb: ALL EXCEPT IP/netmask 
    :wq!
    
    Step-06:
    
    #chcon -t samba_share_t /common        (/common or share directory)
    #ls -dZ /common
    
    Step-07:
    
    #service smb restart
    #chkconfig smb on
    
    Step-08:
    
    #smbclient //ip/common -U natasha  (#smbclient //ip/ -U natasha
    
    
    

    * [[samba]]

    8 Implement a web server for the site http://serverx.example.com/ then perform the following steps:
    Download ftp://nstructor.example.com/pub/rhce/station.html
    Rename the download file to index.html
    Copy this index.html to Document root of your web server
    Do Not Make any modifications to the content of index.html

    
    Step-01:
    
    #yum install httpd
    #service httpd restart
    
    Step-02
    :
    #cd /var/www/html
    #wget ftp://instructor.example.com/pub/rhce/station.html
    mv station.html index.html
    
    Step-03:
    
    #vi /etc/httpd/conf/httpd.conf
    :set nu
    990
    remove * and add IP
    Virtual host: ip:80
    (ifconfig and take ip)
    1003 rd line
    copy 7 line 7 yy
    remove # from all line
    
    document root  /var/www/html
    server name serverx.example.com
    
    :wq
    
    Step-04:
    #service httpd restart
    #chkconfig httpd on
    
    

    9. Extend the web server include
    site http://wwwwX.example.com
    Document root /var/www/virtual
    Download ftp://instructor.example.com/pub/rhce/www.html and rename to index.html
    ensure natasha is able to create content in /var/www/virtual provided by server1.domain70.example.com

    Step-01:
    
    #service httpd start
    
    Step-02:
    
    #cd /var/www/
    #mkdir virtual
    #cd virtual
    #wget ftp......
    #mv www.html index.html
    
    Step-03:
    
    #vi /etc/httpd/conf/httpd.conf
    :set nu 1003
    copy 7yy and P
    
    remove # from all line
    
    :80>
    Document root /var/www/virtual
    Servername wwwwX.example.com
    :wq!
    
    Step-04:
    
    #service httpd restart
    #chkconfig httpd on
    
    Step-05:
    
    #setfacl -m u:natasha:rwx /var/www/virtual
    
    

    10. Create a directory limited on your document root
    download ftp://instructor.example.com/pub/rhce/station.html
    rename the downloaded file to index.html
    copy this index.html file the limited directry
    Make it such that the content of limit can be accessable to the local users only.

    
    Step-01:
    
    #cd /var/www/html
    #mkdir /limited
    #cd limited
    
    Step-02:
    
    #wget ftp://instructor.example.com/pub/rhce/station.html
    #mv station.html index.html
    
    Step-03:
    
    #vi /etc/httpd/conf/httpd.conf
    1003rd line before closing  type the following
    
    Step-04:
    
    
    allow,deny
    Allow from IP
    
    :wq!
    
    Step-05:
    
    #service httpd restart
    #chkconfig httpd on
    
    
    

    11. Export your /archive directory via NFS to the example.com domain only.

    Export Your /common directory via NFS to the domain70.example.com domain only.
    (linux to linux directory sharing)

    Step-01:
    
    #vi /etc/exports
    #/common 172.24.70.0/255.255.255.0(rw,sync)
    :wq
    
    Step-02:
    
    #service nfs restart
    #exportfs
    #chkconfig nfs on
    
    

    12. configure SMTP mail service according to the following requirements

    Your mail server should accept mail from remote hosts mail delivered paula should spool into default mail spool for paula, /var/spool/paula

    Step-01:
    #Yum install postfix*
    #chkconfig postfix on
    #service postfix restart
    
    Step-02:
    
    #vi /etc/postfix/main.cf
    #remove # from 113 th line
    #place # on the 116th line
    
    Step-03:
    
    #service postfix restart
    
    

    13. Configure an email alias for your MTA such that mail set to admin is received by the local user harry

    Step-01:
    
    #vi /etc/aliases
    admin:harry
    :wq
    
    Step-02:
    
    #newaliases
    
    

    14.Using iscsi, discover and mount a device shared by host.domain70.example.com
    create an iscsi storage device of 1100 MB size
    Download ftp://server1.domain70.example.com/pub/iscsi.txt
    and copy it to the iscsi device
    Mount the device permanently under /mnt/data as ext4 file system

    Step-01:
    
    #iscsiadm -m discovery -t st -p hostname
    copy the iqn number line
    #iscsiadm -m node  -p hostname
    #iscsiadm -m node  -p hostname -l
    (if -p error - try with -P)
    
    Step-02:
    
    #fdisk -l
    n
    p
    default
    default +1100M
    p
    w
    
    Step-03:
    
    #partprobe -s /dev/sda                (higher size than  provided, then only we can create partition)
    
    Step-04:
    
    #mkfs.ext4 /dev/sda1
    #mkdir /mnt/data
    
    Step-05:
    
    For Permanently Mount:
    
    #vi /etc/fstab
    /dev/sda1 /mnt/data ext4 default 0 0
    :wq!
    #mount -a
    
    Step-06:
    
    #cd /mnt/data
    #wget ftp://server1.domain70.example.com/pub/iscsi.txt
    
    

    15. Configure kernel such that kernstack value is 1 . kernel line should display the edited string in /proc/cmdline

    Step-01:
    
    #vi /etc/grub.conf
    go to the end of kernel line ,after word quiet, put a space and type kernstack=1
    :wq!
    
    Step-02:
    
    reboot
    #cat /proc/cmdline
    
    

    16. Write a script /root/bar.sh such that when we execute /root/bar.sh python it displays perl and when we execute /root/bar.sh perl displays python.
    And when we type some other charactoer, /root/bar.sh Perl/Python is directed to stdeer

    #vi /root/bar.sh
    
    if [ "$a == "Python" ]
    then
    echo "Perl"
    elif [ "$a == "Perl" ]
    then
    echo "Python'
    else
    echo "/root/bar.sh /Python/Perl" >> stdeer
    if
    :wq!
    /root/bar.sh
    Perl
    
    chmod 755 /root/bar.sh
    # /root/bar.sh
    dgfdg
    #vi /stdeer
    Python/Perl