RHCSA

6
change password #passwd username change ip-add #system-config-network change hostname #vim /etc/sysconfig/network set base.repo file #vim /etc/yum.repos.d/base.repo #reboot #iptables -L #lokkit –disabled #lokkit –selinux=permissive 1.LVM Resize your LVM /home to 150MB I)Reduce #umount /home #e2fsck -f /dev/vol0/home #resize2fs /dev/vol0/home 150M #lvreduce -L 150M /dev/vol0/home #mount -a #df -h II)Extend #lvextend -L 300M /dev/vol0/home #resize2fs /dev/vol0/home 2.Usermgmt Create a group sysadmin .Create users susan , natasha & harry . Users susan & harry should be a part of the sysadmin group.natasha should not be a part of that group and she is given an non interactive shell.password of all users are “password”

description

RHCSA

Transcript of RHCSA

Page 1: RHCSA

change password

#passwd username

change ip-add

#system-config-network

change hostname

#vim /etc/sysconfig/network

set base.repo file

#vim /etc/yum.repos.d/base.repo

#reboot

#iptables -L

#lokkit –disabled

#lokkit –selinux=permissive

1.LVM

Resize your LVM /home to 150MB

I)Reduce

#umount /home

#e2fsck -f /dev/vol0/home

#resize2fs /dev/vol0/home 150M

#lvreduce -L 150M /dev/vol0/home

#mount -a

#df -h

II)Extend

#lvextend -L 300M /dev/vol0/home

#resize2fs /dev/vol0/home

2.Usermgmt

Create a group sysadmin .Create users susan , natasha & harry .

Users susan & harry should be a part of the sysadmin group.natasha should not

be a part of that

group and she is given an non interactive shell.password of all users are

“password”

Page 2: RHCSA

#groupadd sysadmin

#useradd -G sysadmin harry

#useradd -G sysadmin susan

#useradd -s /sbin/nologin natasha

#echo “password”|passwd –stdin harry

#echo “password”|passwd –stdin susan

#echo “password”|passwd –stdin natasha

3.ACL

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 

#cp /etc/fstab /var/tmp

#getfacl /var/tmp/fstab

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

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

#getfacl /var/tmp/fstab

4.direct collaboration

Secure /data such that only group sysadmin can access it . Group owner should

be sysadmin &

all child directories & files by default should have group sysadmin.

(Permission)

#mkdir /data

#ls -ld /data

#chgrp sysadmin /data

#chmod 2070 /data

#ls -ld /data

5.LDAP

Configure an ldap client, where your ldap server is

rhgls.server.example.com(instructor.example.com) .

LDAP Base DN : dc=server,dc=example,dc=com (dc=example,dc=com).

Authenticate your ldap server using the certificate

ftp://rhgls.server.example.com/CA-CERT

Page 3: RHCSA

(ftp://instructor.example.com/pub/EXAMPLE-CA-CERT) ..

You should be able to login as ldapuser10 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

UserAccount-LDAP

LDAPBaseName-dc=example,dc=com

LDAPSERVER-ldap//instructor.example.com

#getent passwd ldapuser10

6.NTP

Configure Your NTP server as instructor.example.com

system->Administration->date&time

7.AUTOMOUNT 4 LDAP

Configure automount in such a way that the ldapuser10′s home directory in

instructor.example.com:/home/guests/ldapuser10 should be mounted as local

directory

/home/guests/ldapuser10 when ldapuser10 logs in .This configuration must be

persistant after restart

password for ldapuser is “password

#rpm -qa autofs

#vim /etc/auto.master

/home/guests /etc/auto.misc

:wq!

#vim /etc/auto.misc

ldapuser10 -rw,soft,intr instructor.example.com:/home/guests/ldapuser10

:wq!

#/etc/init.d/autofs stop

#/etc/init.d/autofs start

#su – ldapuser10

8.Kernel

Install the kernel from the site ftp://rhgls.server.example.com/pub/updates .

(ftp://instructor.example.com/pub/updates) ..

Page 4: RHCSA

The newly installed kernel should be default kernel .

The previous kernel should be available & bootable at grub

#yum install lftp* -y 

#lftp 192.168.0.254

cd /pub/Packages

mget kernal-*

bye

#rpm -ivh kernel-*

#vim /etc/grub.conf

defaults=0

Restart and press up n down key before extracting

9.cron

Add a cron job for the user jane /bin/echo hiya .

This job should run every day at 1:30 .

#crontab -e -u jane

30 1 * * * /bin/echo hiya

:wq!

#crontab -l -u jane

10.ftp anon

Create an ftp server in such a way that anonymous user can login &

download from the directory /var/ftp/pub/downloads

#yum install vsftpd*

#/etc/init.d/vsftpd restart

#chkconfig vsftpd on

#ftp machine ip

11.swap

Create a Swap partition of 100MB

#fdisk -cu /dev/vda

create new partition:n->+100M->t-5-82-p-w

#partx -a /dev/sda

#mkswap /dev/sda5

#vim /etc/fstab

/dev/sda5 swap swap defaults 0 0

Page 5: RHCSA

:wq!

#swapon /dev/sda5

#swapon -s

12.httpd page

Host a webpage on your hostname . download the page to be hosted from

ftp://rhgls.server.example.com/pub/web/station.html .

(ftp://instructor.example.com/pub/web/station.html) .

Do not make any modifications or changes to this file .

#lftp 192.168.0.254

get station.html

bye

#yum install httpd*

#mv station.html /var/www/html/index.html

#/etc/init.d/httpd restart

#chkconfig httpd on

#elinks http://desktop1.example.com(hostname)

13.user of Specific UID

Create a user jean .User id of this user should be 3564 .

#useradd -u 3564 jean

14.find

locate all files owned by user sasha & copy them to /home/lost+found/

# find / -user sasha -exec cp -vp {} /home/lost+found/ \;

^exc cmd ^src ^dstn ^ cmd syntax in find

15.grep

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

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

16.lvm

Create a logical volume wshare from the volume group wgroup .

Page 6: RHCSA

The volume group should have extents of size 8MiB . The logical volume

should have 100 extents . Mount this lvm as /mnt/lvm .

#fdisk /dev/sda

n-1G-p-t-6-8e-p-w

#partx -a /dev/sda

#pvcreate /dev/sda6

#vgcreate -s 8M wgroup /dev/sda6

#lvcreate -l 100 -n wshare wgroup

#lvdisplay

#mkfs.ext4 /dev/wgroup/wshare

#mkdir /mnt/lvm

#vim /etc/fstab

/dev/wgroup/wshare /mnt/lvm ext4 defaults 0 0

:wq!

#mount -a

#df -h

 

#reboot

#uname -r (check new kernal)