Exam Practice rhcsa 6 Flashcards Preview

Rhcsa > Exam Practice rhcsa 6 > Flashcards

Flashcards in Exam Practice rhcsa 6 Deck (35)
Loading flashcards...

password recovery

- go to single usermode with the help of grub

Note:- if the command does not execute
#lokkit --disabled
#lokkit --selinux=permissive


set ip,dns,netmask,gateway

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

#init 6 to reboot

After reboot check connectivity with Server
#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


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
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

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

authentication Method = LDAP

Apply the setting

Check LDAP
#getent passwd ldapuserX
#su ldapuserX


NTP, configure your NTP server as instructor.example.com


check mark Synchronize date and time over network. Remove all the NTP SERVER and click ADD and type

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


#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


#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
~>cd pub
~>mget *kern*
~> bye
#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


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*
~>cd pub/web
~>mget stat*
#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


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


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

#cat /root/lines.txt to verify


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


Set up a default configuration FTP server.
Block ftp connections from hackers.net

# yum install vsftpd
# chkconfig vsftpd on
# service vsftpd start
# vi /etc/sysconfig/iptables-config
IPTABLES_MODULES=”nf_conntrack_ftp nf_nat_ftp”
# iptables -I INPUT -m state –state NEW -m tcp -p tcp –dport 20 -j ACCEPT
# iptables -I INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT
# service iptables save
# service iptables restart
# vi /etc/hosts.deny
vsftpd: .hackers.net: DENY


expire user's account in one week

# date -d “+1week”
# usermod -e YYYY-MM-DD bob
or # chage -E YYYY-MM-DD bob
# chage -l bob


Set up a default configuration webserver. In the index file, place the sentence “This is a test.”.
Make this webserver only accessible to your machine and server1.example.com.

# yum install httpd
# chkconfig httpd on
# service httpd start
echo “This is a test.″ > /var/www/html/index.html
# iptables -I INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
# service iptables save
# vi /etc/httpd/conf/httpd.conf
Order allow,deny
Allow from server1.example.com
# service httpd reload


Add 100MB of swap space to your machine using a logical volume.

# lvcreate –name lv_swap2 –size 100M vg
# mkswap /dev/vg/lv_swap2
# swapon /dev/vg/lv_swap2
# vi /etc/fstab
/dev/vg/lv_swap2 swap swap defaults 0 0


Expand the file system on /home to 2GB in size.

# lvresize -r -L 2G /dev/vg/lv_home


Set up a new 100MB logical volume. Encrypt the volume with LUKS and set it up to automatically decrypt and mount to /crypt at boot.
Use the ext4 filesystem and place an empty file in the root of the encrypted filesystem with a name of “test”.

# lvcreate –name crypt –size 100M vg
# mkdir /crypt
# cryptsetup luksFormat /dev/vg/crypt
# cryptsetup luksOpen /dev/mapper/vg-crypt crypt
# mkfs.ext4 /dev/mapper/crypt
# vi /etc/fstab
/dev/mapper/crypt /crypt ext4 defaults 1 2
# mount -a
# cryptsetup luksAddKey /dev/vg/crypt /etc/keyfile
# chmod 400 /etc/keyfile
# vi /etc/crypttab
crypt /dev/vg/crypt /etc/keyfile
# touch /crypt/test


Set up a job to delete all of the regular files in the /home/bob directory on the second day of every month at 8:30 A.M.

# crontab -e
30 08 02 * * /bin/find /home/bob -type f -exec /bin/rm {} \;


Install the appropriate kernel update from http://mirrors.kernel.org/centos/6.4/updates/x86_64/Packages.
The following conditions 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.

# uname –r
# wget http://mirrors.kernel.org/centos/6.4/updates/x86_64/Packages/kernel*
# rpm –ivh kernel
# vi /etc/grub.conf
Check for default (0 or 1)


Set up the automounter, and configure it to read the DVD on the /misc/dvd directory.

# yum install -y autofs
# vi /etc/auto.misc
dvd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
# service autofs start


Create a file named dontcopy in the /root directory and make it impossible to back it up with the dump command.

# touch /root/dontcopy
# chattr +d /root/dontcopy


Install the vsftpd package.
Copy the TUNING file coming with the package into the /root directory.

# yum install -y vsftpd
# rpm -ql vsftpd | grep TUNING
# cd /usr/share/doc/vsftpd…
# cp TUNING /root


install a httpd server. Make it serve files from /www/html.
Write a file called index.html displaying “Hello world!“.

# yum groupinstall -y “Web server”
# yum install -y setroubleshoot-server elinks
# cp -rp /var/www/* /www
# cd /etc/httpd/conf
# sed -e “s:DocumentRoot \”/var/www/html\”:DocumentRoot \”/www/html\”:g” httpd.conf > httpd.conf2
# mv -f httpd.conf2 httpd.conf
# service httpd configtest
# echo Hello world! >/www/html/index.html
# semanage fcontext -a -t httpd_sys_content_t “/www(/.*)?”
# restorecon -r /www
# iptables -I INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
# service iptables save
# chkconfig httpd on
# service httpd start
# elinks http://localhost


Remove all the files from the /etc/yum.repos.d directory.
Set up a repository for the Base packages from (US)University of Oklahoma’s (http://mirror.oss.ou.edu/centos/) or (Germany)ATrpms’s (http://mirror.atrpms.net/centos/) or (China)Beijing Institute of Technology’s (http://mirror.bit.edu.cn/centos/) according to your geographical localization.

# cd /etc/yum.repos.d
# /bin/rm *
# vi local.repo
name=University of Oklahoma – Base
# yum clean all
# yum repolist all


Create a directory called project in /home.
Create two groups called admins and dbas with gid respectively 50001 and 50002.
Put andrew account into the admins group and steven account into the dbas group, each time as a secondary group.
Configure the project directory for group collaboration among members of the admins and dbas groups with no access for all other users.

# mkdir /home/project
# groupadd -g 50001 admins; groupadd -g 50002 dbas
# usermod -aG admins andrew
# usermod -aG dbas steven
# setfacl -m g:admins:rwx /home/project
# setfacl -m g:dbas:rwx /home/project
# setfacl -m o:— /home/project


Configure a cron job for the root user to search for files named core in the /usr directory and delete them on every sunday at 11:55pm system time.

# crontab -e
55 23 * * 0 /bin/find /usr -name core -exec /bin/rm {} \;