Exam Practice rhcsa 6 Flashcards
password recovery
- go to single usermode with the help of grub #passwd
Note:- if the command does not execute #lokkit --disabled #lokkit --selinux=permissive #passwd
set ip,dns,netmask,gateway
#setup Select network configuration and then set the IP, dns, netmask, gateway #service network restart
create yum client base url
#vi /etc/yum.repos.d/Server.repo [Server] name=Server baseurl=ftp://instructor.example.com/pub/rhel6/dvd/Server enabled=1 gpgcheck=0
\:wq #init 6 to reboot
After reboot check connectivity with Server #ping 192.168.0.254 #nslookup instructor.example.com #yum list #yum repolist
LVM Reduce
Resize your LVM /home to 150MB will range to (130M-160M)
#df -h #lvdisplay ***check the lvm partition*** #umount /home #lvdisplay ****check the name of lvm*** #e2fsck -f /dev/vgsrv/home #resize2fs /dev/vgsrv/home 150M #lvreduce -L 150M /dev/vgsrv/home #df -h **** You will not find the partition**** #mount /dev/vgsrv/home /home #df -h
LVM Extend
Resize your LVM /home to 250 will range to (230M-260M)
#lvextend -L 250M /dev/vgsrv/home #resize2fs /dev/vgsrv/home #df -h
LDAP
Example
Configure an ldap client, where your ldap server is instructor.example.com
LDAP Base DN: (dc=example,dc=com).
Authenticate your ldap server using the certificate
(ftp://instructor.example.com/pub/EXAMPLE-CA=CERT)
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.
#yum groupinstall directory-client #system-config-authentication
Note: dialog box will open in that
Enter details
User Account Dattabase = LDAP
LDAP Search Base DN = dc=example,dc=com
LDAP Server = ldap://instructor.example.com
Check mark TLS and then click download certificate and give the path
ftp://instructor.example.com/pub/EXAMPLE-CA-CERT
authentication Method = LDAP
Apply the setting
Check LDAP
#getent passwd ldapuserX
#su ldapuserX
$exit
NTP, configure your NTP server as instructor.example.com
system-config-date
check mark Synchronize date and time over network. Remove all the NTP SERVER and click ADD and type
Instructor.example.com
Press Enter and press OK
Automount LDAP
Configure automount in such a way that the ldapuserX’s home directory in instructor.example.com:/home/guests/ldapuserX should be mounted as local directory /home/guests/ldapuserX when ldapuserX logs in. This configuration must be persistant after restart password for ldapuser is “password”
#rpm -qa autofs #vim /etc/auto.master Below /misc add the line /home/guests /etc/auto.misc
:wq
#vim /etc/auto.misc Below CD line OR end of the script add the line: ldapuserX -rw,soft,intr instructor.example.com:/home/guests/ldapuserX
:wq!
#service autofs stop #service autofs start #su - ldapuserX #df -h
Kernel Installation update
Install new kernel from UDATE dir on Server. boot the system with the new kernel
#yum install lftp #lftp 192.168.0.254 ~>cd pub ~>cd UPDATE ~>mget *kern* ~> bye #ls #rpm -ivh kern[+TAB] #vi /etc/grub.conf
Check the position of the new kernel if it is 1st position then defaults=0 if it is in 2nd position, the default=1
Create a cron job which will run everyday at 1:30 for user harry
crontab -e -u harry
30 1 * * * /bin/ech “hiya”
FTP anonymous
Create an ftp server in such a way that anonymous user can login & download from the directory /var/ftp/pub/downloads
#yum install vsftp* #head -15 /etc/vsftpd/vsftpd.conf
Check anonymous_enable=YES
#tail -5 /etc/vsftpd/vsftpd.conf check tcp_wrappers=YES
#mkdir -p /var/ftp/pub/downloads #service vsftpd restart #chkconfig --level 35 vsftpd on #ftp 192.168.0.[100+x] check your VM IP
HTTPD Page
Host a webpage on your hostname. Download the page to be hosted from (ftp://instructor.example.com/pub/web/station.html).
Do not make any modifications or changes to this file
#yum install http* #lftp 192.168.0.254 ~>cd pub/web ~>mget stat* ~>bye #ls #mv station.html /var/www/html/index.html #service httpd restart #chkconfig --level 35 httpd on #restorecon -R /var/www/html #elinks http://serverX.example.com
Also check with firefox
Find
locate all files owned by user susan & copy them to /home/lost+found/
#find / -user susan -exec cp -vp {} /home/lost+found/ \; #cd /home/lost+found #ls
grep
Search for the text ‘strato’ in the file /usr/share/dict/words & copy this file 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
grep strator /usr/share/dict/words > /root/lines.txt
LVM
Create a logical volume wshare from the volume group wgroup
The volume group should have extents of size 8MiB. The logical volume should have 50 extents. Mount this lvm as /mnt/lvm
fdisk /dev/vda (set an lvm partition to 500M
#partx -a /dev/vda #pvcreate /dev/vda6 #vgcreate -s 8M wgroup /dev/vda6 #vgdisplay wgroup #lvcreate -l 50 -n wshare wgroup #lvdisplay /dev/wgroup/wshare #mkfs.ext4 /dev/wgroup/wshare
note use the right format based on the question
#mkdir /mnt/lvm #vi /etc/fstab
/dev/wgroup/wshare /mnt/lvm ext4 defaults 0 0
#mount -a #df -h #init 6