Redhat Ex.200 Q&A


 

Redhat Ex.200 Q&A


BRACK ROOT PASSWORD   

Booting promt redhat (select 1 Linux)   

Press e   

Linux ---------------------------------------------------------

-------------------------------------------------------------------- rd.break   

Ctrl+x   

Switch-root:/#mount -o remount,rw /sysroot   
Switch-root:/#chroot /sysroot   

Sh-4.2# passwd root New password:______   

Re password:_______  Sh-4.2# touch /.autorelabel  

Sh-4.2# exit   Sh-4.2# exit   

  

  

   

IP ADDRESS   

Change IP Address:-   

Change DNS   

Change HOSTNAME   

#nmtui    

As given   

#nmtui connect   

  

SELINUX   

Q.1 Set your sytem to enforcing mode permanently.  

Ans. #getenforce      #setenforce  

     #vim /etc/selinux/config  

LVM CREATE {note for exam only practice}   

Q.2 Create a logical volume name redhat from the volume group name linux. your vg size is 800MB & lv size is 300MB. Mount this lvm as /mylv. Make it as ext4 file system .  

Ans. #fdisk –l  

     #fdisk /dev/sda  

     : n  

     : first sector  

     : last sector +800M  

     : t       : 8e  

     : w  

     #partprobe  

     #pvcreate /dev/sdaX  

     #Vgcreate linux /dve/sdaX  

     #lvcreate –n redhat –L +300M linux  

     #mkfs.ext4 /dev/linux/redhat  

     #mkdir mylv   

     #vim /etc/fstab  

     :i  

     :/dev/linux/redhat(tab)/mylv(tab)ext4(tab)defaults(tab)1 2     :wq!  

    #mount –a  

    #df -h    

 LVM EXTEND   

Q.3 Resize your LVM /home to 150MB will range to (130M-160M)  

Ans. #lvdisplay  

     #umount /dev/linux/redhat  

     #e2fsck –f /dev/linux/redhat  

     #fdisk /dev/sda  

     : n  

     : Firs sector  

     : Last sector +100M  

     : t  

     : 8e  

     : w  

     #partprobe  

     #pvcreate /dev/sdaX  

     #vgextend linux /dev/sdaX  

     #lvextend –L 150M /dev/linux/redhat  

                   Or  

     #lvextend –L +60 /dev/linux/redhat  

     #e2fsck –f /dev/linux/redhat      

#resize2fs /dev/linux/redhat  

 YUM CREATE   

Q.4 create a repo file using   url=http://content.example.com/rhel7.0/x86_64/dvd  Ans. #vim /etc/yum.repose.d/station1.repo  

     [stationX]     

name=stationX      gpgcheck=0       enabled=1  

     baseurl=http://content.example.com/rhel7.0/x86_64/dvd      :wq!  

     #yum repolist  

KERNEL INSTAL   

Q.5 Install new kernal from UPDATE dir on Server. Boot the system with new kernel url  

=http://content.example.com/rhel7.0/x86_64/errata  

Ans. #yum –y install elinks.86_64  

     #uname –r  

     #elinks http://content.example.com/rhel7.0/x86_64/errata  

     #cd /home/student/download/  

     #ll  

     #rpm –ivh kernel-3.10.10.123.1.2.e17.x86_64.rpm  

     #vim /boot/grub2/grub.cfg  

     #grub2-set-default 1  

     #grub2-mkconfig /boot/grub2/grub.cfg  

     #reboot  

  

USERMGMT   

Q.6 Create a group sysmgrs .Create users susan , natasha & harry . Users susan & harry should be a part of the sysmgrs group.natasha should not be a part of that group and she is given an non interactive shell.password of all users are "linux123"  

Ans. #groupadd sysmgrs  

     #useradd susan  

     #useradd natasha  

     #useradd harry  

     #passwd susan   (give password linux123)  

               #passwd natasha (give password linux123)   

     #passwd harry   (give password linux123)  

     #usermod –aG sysmgrs susan harry  

     #cat /etc/group   

     #usermod –s /sbin/nologin natasha    

 NTP   

Q.7 Configure Your NTP server as classroom.example.com  

Ans. #yum –y install chrony*  

     #vim /etc/chrony.conf  

     :i       servre classroom.exampal.comb iburst      :wq!  

     #systemctl restart chronyd.service  

     #systemctl enable chronyd.service  

     #timedatectl  

  

DIRECT COLLABORATION   

Q.8 Secure /netdir such that only group sysmgrs can access it . Group owner should be sysmgrs & all child directories & files by default should have group sysmgrs.  Ans. #chgrp sysmgrs /netdir  

    #ls –l /  

     #chmod 2770 /netdir  

     #ls –l /  

     #touch /netdir/1  

     #ls –l /  

  

LDAP   

Q.9 Configure an ldap client, where your ldap server is classroom.example.com. LDAP Base DN : (dc=example,dc=com).  Authenticate your ldap server using the certificate (http://classroom.example.com/pub/example-ca.crt) .  

You should be able to login as ldapuserx via LDAP . This configuration must be persistant after restart . You will get the home directory only after solving automount question.   Ans. #yum -y install authcomfig-gtk sssd   

     #authconfig-gtk  

Redhat Ex.200 Q&A

     


Redhat Ex.200 Q&A

Redhat Ex.200 Q&A


   

#systemctl  start  sssd.service                 

     #systemctl enable sssd 

     #su – ldapuser0  

    -bash-4.2$ exit  

     #  

ACL   

Q.10 Copy /etc/fstab to /var/tmp/fstab . The user & group owner of that file should be root . All users should be able to read the file . No one should be able to execute. susan should not

be able to read nor write . natasha should be able to read & write.  

Ans. #up /etc/fstab /var/tmp/  

    #cd /var/tmp  

    #setfacl –m u:natasha:rw- /var/tmp/fstab  

     #setfacl –m u:susan:--- /var/tmp/fstab  

     #getfacl fstab  

  

AUTOMOUNT 4 LDAP   

Q.11 Configure automount in such a way that the ldapuserx home directory inclassroom.example.com:/home/guests/ldapuserx should be mounted as local directory /home/guests when ldapuserx logs in  

.This configuration must be persistant after restart password for ldapuser is "password"  

Ans. #yum install –y autofs  

     #vim /etc/auto.master.d/guest.autofs  

     :i  

     /home/guests(tab)/etc/auto.guests      :wq!  

     #vim /etc/auto.guests  

     :i  

     *(tab)-rw,sync(tab)classroom.example.com:handguests      :wq!  

     #systemctl enable autofs  

     #systemctl start autofs  

     #reboot  

CRON   

Q.12 Add a cron job for the user harry /bin/echo hello . This  job should run every day at 14:50  Ans. #crontab –e –u harry  

    :i  

     :50(tab)14(tab)* (tab)* (tab)* (tab)/bin/echo hello      :wq!  

     #crontab –l –u harry  

  

SWAP   

Q.13 Create a Swap partition of 725MB  

Ans. #fdisk /dev/sda  

     : n  

     : Firs sector  

     : Last sector +725M  

     : t  

     : 82  

     : w  

     #partprobe  

     #pvcreate /dev/sdaX  

     #mkswap /dev/sdaX  

     #vim /etc/fstab  

     :i  

     :/dev/sdaX(tab)swap(tab)swap(tab)defaults(tab)0 0      :wq!  

     #Fdisk –l  

  

USER OF SPECIFIC UID   

Q.14 Create a user jean .User id of this user should be 2556 .  Ans. #useradd –u 2556 jean  

    #cat /etc/passwd  

                                              

GREP   

Q.15 Search for the text 'strato' in the file  

/usr/share/dict/words & copy this to a file /root/lines.txt .The new file should not have any blank spaces or lines . The order of the names in the new file should be same as the order in which it appears in the original file  

Ans. #grep “strato” /usr/share/dict/words > /root/lines.txt  

     #cat /root/lines.txt  

  

lVM CREATE   

Q.16 Create a logical volume name datashare from the volume group name datagroup . The volume group should have extents of size 8. The logical volume should have 50 extents . Mount this lvm as /lvm. Make it as ext4 file system .   Ans. #fdisk /dev/sda  

     :n  

     :first sector   

     :last sector +200M  

     :t  

     :8e  

     :w  

    #partprobe  

    #pvcreate /dev/sdaX  

     #vgcreate datagroup /dev/sdaX  

     #lvcreate –n datashare –l 8 datagroug  

     #lvdisplay      

  

TAR   

Q.17 Create an archive file by using extension /backup.tar.bz2 of /usr/sbin  

Ans. #tar cjf /backup.tar.bz2 /usr/sbin/  

     #ls –l /  

  

           [ commandprom to graphical ]  

    #systemctl get-default  

    #systemctl set-default graphical.target  

    #systemctl set-default multi-user.target   




No comments:

Post a Comment