You are on page 1of 10

1.

Download Appropriate Software Packages from


http://rhcert.domain10.example.com/pub/rhel/server

Answer:

#cd /etc/yum.repos.d
#vim example.repo
[example]
name=Redhat Linux
baseurl=http://rhcert.domain10.example.com/pub/rhel/server
enabled=1
gpgcheck=0
:wq!
#yum clean all
#yum list all

2. One logical volume is created named as home under vgsrv volume group and is mounted.
The initial size of that logical volume is 250MB. Make successfully that the size of logical volume 184 MB
with out losing any data. The size of logical volume 150 MB to 200 MB will be acceptable.

Answer: (Given details)
vgname = vgsrv
lvname = lvhome is mounted under /home
Initial size of lv = 250 MB
Final size of lv = 184 MB
In this scenario, we have to reduce file system size and lv size.

#df -h
#vgdisplay
#lvdisplay
#umount /home
#e2fsck -f /dev/vgsrv/lvhome
#resize2fs -f /dev/vgsrv/lvhome 184M
#lvreduce -L 184M /dev/vgsrv/lvhome
#lvs OR #lvdisplay --- To check the resized volume
#vgs OR #vgdisplay --- To check Space created in that Volume Group
#mount -a
#df -h
#reboot --- This is very important step, we need to reboot here.

In case of lvextend, follow the procedure:
#lvextend -L 300M /dev/vgsrv/lvhome
#resize2fs /dev/vgsrv/lvhome
#df -h
#lvdisplay or #lvs


3.Add a group sysadmin
Add a User Natasha such that user secondary group is sysadmin
Add a user JAne such that users secondary group is sysadmin
Add a user Eric who has no interactive shell and not belongs to the group sysadmin
Set passwd of Natasha, Jane and Eric to Ericsson

Answer:
#groupadd sysadmin
#useradd -G sysadmin Natasha
#useradd -G sysadmin Jane
#useradd -s /sbin/nologin Eric
#passwd Natasha
#passwd Jane
#passwd Eric

(OR)

#groupadd sysadmin
#useradd Natasha
#useradd Jane
#useradd Eric
#usermod -G sysadmin Natasha
#usermod -G sysadmin Jane
#usermod -s /sbin/nologin Eric
#passwd Natasha
#passwd Jane
#passwd Eric

OR

#groupadd sysadmin
#useradd Natasha
#useradd Jane
#useradd Eric
#gpasswd -M Natasha,Jane sysadmin
#usermod -s /sbin/nologin Eric
#passwd Natasha
#passwd Jane
#passwd Eric

To Verify:
#cat /etc/groups
#id Natasha
#id Jane
#su - Natasha
#su - Jane
#su - Eric

4.Configure FTP access on your Virtual Machine to allow permission for Anonomous User.

Answer:

#yum install -y vsftpd*
#yum install -y ftp*
#vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES
:wq!
#vim /etc/vsftpd/ftpusers
Remove complete line if anonymous user is present
:wq!
#vim /etc/vsftpd/user_list
Remove complete line if anonymous user is present
:wq!
#service vsftpd restart
#chkconfig vsftpd on
#chkconfig --list vsftpd

To Verify :
#ftp 192.168.0.101
Username: anonymous
Password: -null-
ftp>bye
#

5.Make a collaborative directory /redhat/cms and set the permissions as:
Group ownership of /redhat/cms is sysadmin. The directory should be readable, writable, and accessible
to members of sysadmin, but not to any other user.(it is undershould that root has to all files and
directories on the system)Files created in redhat/cms automatically have group ownership set to
sysadmin.

Answer:
#mkdir -p /redhat/cms
#ls -ld /redhat/cms
#groupadd sysadmin
#chown .sysadmin /redhat/cms OR #chgrp sysadmin /redhat/cms
#chmod 770 /redhat/cms
#chmod g+s /redhat/cms (OR) #chmod 2770 /redhat/cms

6. Copy the file /etc/fstab to /var/tmp. Configure the permissions of /var/tmp/fstab so that ;
The file /var/tmp/fstab is owned by the root user
The file /var/tmp/fstab is belongs to group root
The file /var/tmp/fstab should not be executable by anyone
The user natasha is able to read and write /var/tmp/fstab
The user jane can neither write nor read /var/tmp/fstab
All other users (current or future) have the ability to read /var/tmp/fstab

Answer:
#cp /etc/fstab /var/tmp/
#chown root:root /var/tmp/fstab
#chmod u-x,g-x,o-x /var/tmp/fstab
#setfacl -m u:natasha:rw- /var/tmp/fstab
#setfacl -m u:jane:--- /var/tmp/fstab
#getfacl /var/tmp/fstab
#ls -l ----To check the permissions

7. The user Natasha must configure a cronjob that runs daily at 14:23 and executes /bin/echo ciao

Answer:
#su - natasha
#crontab -e
23 14 * * * /bin/echo ciao
:wq!
OR
#crontab -u natasha -e
23 14 * * * /bin/echo ciao
:wq!

#service crond restart
#chkconfig crond on

To Verify:
#crontab -l
#mail

8. host.domain10.example.com shares remote users
Configure ldap such that ldapusers has no home directory until we do automounting.
baseDN: dc=domain70,dc=example,dc=com
Certificate: http://host.domain70.example.com/pub/exam.cert
Username: ldapuserX
Password: password

Answer:
#yum groupinstall directory-client (1.krb5-workstation 2.pam-krb5 3.sssd)
#system-config-authentication
1.User Account Database: LDAP
2.LDAP Search Base DN:dc=domain10,dc=example,dc=com
3.LDAP Server: ldap://host.domain10.example.com (In domain form, not write IP)
4.Download CA Certificate http://host.domain70.example.com/pub/exam.cert
5.Authentication Method: LDAP password
6.Apply
#chkconfig sssd on
#getent passwd ldapuserX
ldapuserX:*:1701:1701:LDAP Test User 1:/home/guests/ldapuser1:/bin/bash
ldapuserX dont have home directory set so we will get bash prompt.

OR

#yum install -y openldap nss_ldap
#authconfig-tui
Check "USE LDAP" and "USE LDAP Authentication"
Press NEXT
Specify the correct domain settings
check "USE TLS"
Server: ldap://instructor.example.com
base DN: dc=domain70,dc=example,dc=com
Press OK
Then it will ask you for a TLS certificate in a location. Remember that location and download certificate
file from desired ftp location provided by examiner and put in that location.
press ok.
#cd /etc/openldap/cacerts
#wget http://host.domain70.example.com/pub/exam.cert
#chkconfig sssd on
#getent passwd ldapuserX
ldapuserX dont have home directory set so we will get bash prompt.

9. Configure autofs to automount the home directories of ldapusers host.domain70.example.com NFS-
exports /home/guests to your machine ldapuser70's home directory should be automounted locally
/home/guests as /home/guests/ldapuser70 Home directories must be writable by their users
User: ldapuser70, Password: password

Answer:
#yum install -y autofs*
#chkconfig autofs on
#showmount -e host.domain10.example.com
output of the above commandd will be like this
Export list for host.domain70.example.com
/home/guests 192.168.0.0/255.255.255.0
/var/nfs 192.168.0.0/255.255.255.0
/kickstart 192.168.0.0/255.255.255.0
/var/ftp/pub 192.168.0.0/255.255.255.0
#getent passwd ldapuser70
#vi /etc/auto.master
:set nu
Line 7: /misc /etc/auto.misc --Dont Modify anything
Line 8: /home/guests /etc/auto.ldap --Add this entry
:wq!

#cp auto.misc auto.ldap
#vi /etc/auto.ldap
ldapuser70 -rw,soft,intr host.domain70.example.com:/home/guests/ldapuser70
:wq!

# service autofs reload
# service autofs start
#chkconfig autofs on

Testing:
# su ldapuser70 (you will get correct prompt once it is configuredcorrectly.)

10.Configure your system so that it is an NTP client of rhcert.domain70.example.com

Answer:
#service ntpd status -- check ntpd is running or not
#system-config-date -- Add NTP Server
In Advanced option, check "Speed up Initial Synchronization" option.

11. Implement a web server for the site http://station.domain70.example.com, and then perform the
following steps: Download ftp://rhcert.domain70.example.com/pub/rhcsa/station.html
Rename the downloaded file to index.html.Copy this index.html to the Document root of your web
server. DO NOT make any modifications to the content of index.html

Answer:
#yum install -y httpd*
#service httpd restart
#chkconfig httpd on
#cp /etc/httpd/conf/http.conf /etc/httpd/conf/httpd.conf.back
#vim /etc/httpd/conf/httpd.conf
:set nu
Line 990 NameVirtualHost 192.168.0.106:80
<shift+g> come to last line
copy last 7 lines (7yy) and press p
Line 1010: <VirtualHost 192.168.0.106:80>
Line 1011: # ServerAdmin webamster@dummy-host.example.com
Line 1012: DocumentRoot /var/www/html
Line 1013: ServerName station.domain70.example.com
Line 1014: # ErrorLog logs/dummy-host.example.com-error_logs
Line 1015: # CustomLog logs/dummy-host.example.com-access_log common
Line 1016: </VirtualHost>
:wq!
# cd /var/www/html
# wget ftp://rhcert.domain70.example.com/pub/rhcsa/station.html
# mv station.html index.html
# ls lZ /var/www/html/index.html
httpd_sys_content_t (if show this index then ok)
# httpd -t
# Service httpd restart
# elinks station.domain70.example.com -- check weather the webpage available or not





12. Install the appropriate Kernel update from ftp://rhcert.domain70.example.com/pub/updates
The following criteria must also be met:
The updated kernel is the default Kernel when the system is rebooted
The original Kernel remains available and bootable on the system

Answer:
#cd /root
#ftp rhcert.domain70.example.com
Username: anonymous
passwd : -null-
ftp> ls
pub
ftp> ls
Updates
ftp> ls
kernel 2.6.32-131.0.5
kernel firmware dependency package
ftp> mget kernel*
ftp>bye
#rpm -Uvh kernel firmware
#rpm -ivh 2.6.32-131.0.5
#uname -r -- To check old kernel
#vim /etc/grub.conf
default=0
wq!

13. Create a swap partition of 500MB size, Do Not make any change to the existing swap partition

Answer:
#free -m
#fdisk -l
#fdisk -cu /dev/vda
Follow the sequence:
:p -- print
:n -- create new partition
:p -- primary partition
:3 -- partition number 3
: -- first cylinder : default press enter
:+500M last cylinder value
:p -- print
:t -- change the file system type
:3 -- partition number 3
:L -- List type of partitions available
:82-- Linux Swap
:p -- print
:w -- save
#reboot


#mkswap /dev/vda3
#swapon /dev/vda3
#blkid /dev/vda3
#vim /etc/fstab
UUID="XXXX-XXXX-XXXX-XXXX swap swap defaults 0 0
#mount a

To Verify:
#swapon s

14.Add a user necola with uid 1212, Set password as lotanecola

Answer:
#useradd -u 1212 necola
#passwd necola
Enter New Passwd: lotanecola
Reenter Passwd : lotanecola

To verify:
#cat /etc/passwd

15. Locate all files and directories of user jacob and copy it to /root/findfiles

Answer:
#find / -user jacob -exec cp -rvp {} /root/findfiles/ \;

16. Find all lines contain a string localhost in a file /etc/hosts and copy it to /root/list.
Don't leave a free line in /root/list

Answer:
#cat /etc/hosts|while read line;
do
echo $line|grep localhosts|tee -a /root/list
done

or
grep localhost /etc/hosts >root/list

17. Create a Logical Volume partition, Below mentioned the conditions:
Volume Group is 51MB and name as vol0
Logical Volume is 8MB and name as lv0
File type is vfat and permanently mounted to /cms file system

Answer:
#fdisk -l
#fdisk -cu /dev/vda

p --print for available partitions
n --create a new partition
e --extended partition
First cylinder Default: enter
Last Cylinder Value : enter
p --print for available partitions

n --create a new partition
: enter : default value for first cylinder
:+54M last cylinder value
:p -- print
:t -- change the filesystem type
:5 -- partition number 5
:L -- List type of partitions available
:8e-- Linux LVM
:p -- print
:w -- save
#reboot
w --save
#pvcreate /dev/vda5
#vgcreate vol0 /dev/vda5
#lvcreate -L 8M -n /dev/vol0/lv0 vol0
#mkfs.vfat /dev/vol0/lv0
#mkdir /cms
#blkid /dev/vol0/lv0
#vim /etc/fstab
UUID"XXXX-XXXX-XXXX-XXXX" /cms vfat defaults 0 0
wq!
#mount -a

To Verify:
#df h

18. Create a device:
Logical Volume Lvi with 60 extents
Volume Group Vgi with 16MB extent size
Mount it permenently under /record with file system ext3

Answer:

In normal conditions:
1 Extent = 4MB
But here they have given 1 Extent = 16 MB
This means 60 X 16 = 960MB + 40 MB Variable
So totally we have to create 1000MB size Lvi.



#fdisk -l
#fdisk -cu /dev/vda
p --print for available partitions
n --create a new partition
e --extended partition
First cylinder Default: enter
:+1000M last cylinder value
:p -- print
:t -- change the filesystem type
:6 -- partition number 6
:L -- List type of partitions available
:8e-- Linux LVM
:p -- print
:w -- save
#reboot
#pvcreate /dev/vda6
#vgcreate -s 16M Vgi /dev/vda6
#vgdisplay
#lvcreate -l 60 -n /dev/Vgi/Lvi Vgi
#lvdisplay
#mkfs.ext4 /dev/Vgi/Lvi
#mkdir -p /record
#blkid /dev/Vgi/Lvi
#vim /etc/fstab
UUID"XXXX-XXXX-XXXX-XXXX" /record ext4 defaults 0 0
wq!
#mount -a

To verify:
#df -h

19. Download ftp://192.168.0.254/pub/boot.iso to /root, and mounted automatically under
/media/cdrom and which take effect automatically at boot-start.

Answer:
#cd /root
#wget ftp://192.168.0.254/pub/boot.iso
#mkdir -p /media/cdrom
#vim /etc/fstab
/root/boot.iso /media/cdrom iso9660 ro,loop,auto 0 0
#mount -a

OR
#mount -t iso9660 /root/boot.iso /media/cdrom


@@@@@@

You might also like