RHCT 模擬題庫及答案

RHCT部分

 

本實驗環境有兩個域:example.com對應的是172.16.0.0/255.255.0.0craker.org對應的是192.168.1.0/255.255.255.0

iptables的拒絕設置一定是REJECT,不能設置爲DROP

server1.example.comIP是:172.16.254.254/16

yum源:ftp://172.16.254.254/pub

[root@localhost ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo

       [rhel-debuginfo]

       name=server

       baseurl=ftp://172.16. 254.254/pub/Server

       enabled=1

       gpgcheck=0

       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

一、破解密碼

Ø  root用戶登錄密碼爲redhat

Ø  家目錄是/root(不能進入recue模式)

開機進入grub後,按A健進入修改內核參數模式

輸入 1(空格+1)進入單用戶模式

進入後即爲root用戶,直接passwd修改root密碼。

二、設置網絡

Ø  IPADDR:172.16.0.XNETMASK:255.255.0.0

Ø  網關爲172.16.254.254

Ø  nameserver 172.16.254.254

Ø  hostname stationX.example.com

[root@cracker ~]#setup--network configuration--edit devices--eth0

       Name            eth0

       Device           eth0

       Use DHCP     [ ]                

       Static IP        172.16.0.100

       Netmask              255.255.0.0

       Default gateway IP  172.16.254.254

[root@cracker ~]# #vim /etc/resolv.conf

    ; generated by /sbin/dhclient-script
    search example.com
    nameserver 172.16. 254.254

[root@cracker ~]# #vim /etc/sysconfig/network

      NETWORKING=yes
      NETWORKING_IPV6=yes
      hostname=station100.example.com

 

三、爲默認的網卡設置一個別名叫“網卡名:1

Ø  IP:192.168.1.XNETMASK:255.255.255.0

[root@cracker ~]#setup—network configuration---edit devices--<new device>

       Name            eth0:1

       Device           eth0

       Use DHCP     [ ]                

       Static IP        192.168.1.100

       Netmask              255.255.255.0

       Default gateway IP   ____________

[root@cracker ~]#Service network restart

Ø  設置路由,指定去192.168.1.0/24的網關是192.168.1.254

[root@cracker ~]# vim /etc/sysconfig/network-scripts/route-eth0

                     192.168.1.0/24 via 192.168.1.254

 

四、172.16.254.254:/var/ftp/pub/errata目錄下有更新的kernel

Ø  可以選擇yum或者rpm工具完成kernel的更新

Ø  要保證系統啓動默認加載新的kernel

Ø  grub 設置密碼redhat

[root@cracker ~]# yum -y install kernel-PAE

[root@cracker ~]# vim /boot/grub/grub.conf

       default=0

timeout=5

splashp_w_picpath=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

       password=redhat

title Red Hat Enterprise Linux Server (2.6.18-164.el5PAE)

        root (hd0,0)

        kernel /vmlinuz-2.6.18-164.el5PAE ro root=LABEL=/ rhgb quiet

        initrd /initrd-2.6.18-164.el5PAE.img

title Red Hat Enterprise Linux Server (2.6.18-164.el5)

        root (hd0,0)

        kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet

        initrd /initrd-2.6.18-164.el5.img

 

五、分兩個分區做RAID-5,用來掛載/rhome ,大小是3G,文件系統類型是ext3

[root@station37 ~]# fdisk -l      

       /dev/sda5    1301        1313      104391   fd  Linux raid autodetect

       /dev/sda6    1314        1326      104391   fd  Linux raid autodetect

       /dev/sda7    1327        1339      104391   fd  Linux raid autodetect

[root@station37 ~]# partprobe

[root@station37 ~]# mdadm -C /dev/md0 -l5 -n3 /dev/sda{5,6,7}

       mdadm: array /dev/md0 started.

[root@station37 ~]# mke2fs -j /dev/md0

[root@station37 ~]# mkdir /rhome

[root@station37 ~]# vim /etc/fstab

       /dev/md0     /rhome        ext3    defaults        1 2

[root@station37 ~]# mount -a

[root@station37 ~]# df -h | grep md0

       /dev/md0      198M  5.8M  182M   4% /rhome

[root@station37 ~]# mdadm -D -s > /etc/mdadm.conf

 

六、創建kevin,mandy,todderien用戶,創建teacher,student

[root@cracker ~]# groupadd teacher

[root@cracker ~]# groupadd student

Ø  kevintodd屬於teacher(附加組),密碼設置成password

[root@cracker ~]# useradd -G teacher kevin

[root@cracker ~]# passwd kevin

Ø  mandy屬於student(附加組),並且指定他的家目錄是/rhome/mandy,設置密碼有效期是20, 密碼任意設置

[root@cracker ~]#mkdir /rhome

root@cracker ~]# useradd mandy -s /rhome/mandy -G student

[root@cracker ~]# chage -M 20 mandu

[root@cracker ~]# chage -l mandu

Ø  erien屬於erien組同時隸屬於teacherstudent(附加組),但指定他使用的shell/sbin/nologin, 密碼任意設置

[root@cracker ~]# useradd -G teacher,student erien -s /sbin/nologin

 

七、拷貝/etc/passwd/student

Ø  要求該文件擁有者是root,擁有組是student

[root@cracker ~]# chown root /student/passwd

[root@cracker ~]# chgrp student /student/passwd

Ø  其它人沒有任何權限

[root@cracker ~]# chmod o-rwx /student/passwd

Ø  kevin能讀寫該文件

[root@cracker ~]# setfacl -m u:kevin:rw /student/passwd

Ø  todd只能讀

[root@cracker ~]# setfacl -m u:todd:r /student/passwd

 

測試:

[root@localhost ~]# getfacl /student/passwd

八、創建/student/test目錄,要求

Ø  student組的用戶對此目錄有完全權限

[root@cracker ~]# chgrp student /student/test/

[root@cracker ~]# chmod g=rwx /student/test/

Ø  kevin對此目錄有r-x權限

[root@cracker ~]# setfacl -m u:kevin:rx /student/test/

Ø  此目錄中創建的文件,只有本人和root可以刪除

[root@cracker ~]# chmod o+t /student/test/

Ø  此目錄中創建的文件,擁有組一定是student

[root@cracker ~]# chmod g+s /student/test/

[root@www ~]#chmod 3775 /student/test/

drwxrwsr-t+ 2 root student 4096 Apr  5 05:38 test

九、todd用戶設置一個計劃任務

Ø  每週一、三、六的下午三點鐘,每兩分鐘統計一下內存的使用情況

[root@cracker ~]# crontab -e -u todd

       */2     15       *       *       1,3,6     /usr/bin/free

[root@cracker ~]# crontab -l -u todd

 

十、/home縮小到1G

[root@cracker ~]# umount /dev/vg/lv

[root@cracker ~]# e2fsck -f /dev/vg/lv

[root@cracker ~]# resize2fs /dev/vg/lv 50M

[root@cracker ~]# lvresize -L 50M /dev/vg/lv

十一、  創建用戶student1student50,指定組爲student

[root@cracker ~]# for i in $(seq 1 50);do useradd -g student student$i;echo 'redhat' | passwd --stdin student$i;done

Ø  student1student2這兩個用戶設置磁盤配額

[root@cracker student1]# vim /etc/fstab

       /dev/VolGroup00/LogVol00 /home   ext3    defaults,usrquota     1 2  

[root@cracker student1]# mount -o remount /home

[root@cracker student1]# quotacheck -mcug /home

[root@cracker student1]# quotaon /home

[root@cracker home]# edquota student1

       Disk quotas for user student1 (uid 504):

Filesystem        blocks    soft    hard     inodes     soft     hard

/dev/mapper/VG-LV  28    11000   22000      7       0          0

[root@cracker home]# edquota -p student1 student2

n  dd if=/dev/zero of=/home/studentX/filetest bs=1M count=10成功

n  dd if=/dev/zero of=/home/studentX/filetest bs=1M count=30失敗

 

十二、  172.16.254.254這個服務器上有用戶guest200X,密碼爲password,nisdomainnotexample

Ø  要求這個用戶可以通過你的機器登錄

Ø  172.16.254.254 通過nfs/rhome 共享出來了

Ø  guest200X的家目錄是server1.example.com:/rhome/guest200X

Ø  guest200X的家目錄應該能自動掛載到/home/guests/guest200X

Ø  guest200X的家目錄必須要有可寫權限

[root@cracker ~]# setup 

       Authentication configuration---à[*]Use NIS---à Domain: notexample   Server: 192.168.0.254 (按題中要求) ------>OK

[root@cracker ~]# yptest

[root@cracker ~]# rpcinfo -p 172.16.100.100   //

[root@cracker ~]# ypcat passwd  

[root@cracker ~]# vim /etc/auto.master

       /home/guests       /etc/auto.misc   //加入一行

[root@cracker ~]# vim /etc/auto.misc

Guest200X     -fstype=nfs,rw,soft,intr              172.16.100.100:/home/guests/guest200X   //加入一行

[root@cracker ~]# service autofs restart

              測試

 

 

十三、  設置一個別名date=date +%F

Ø  kevin這個用戶每次登錄系統都要能用這個別名

[root@cracker ~]# vim /home/kevin/.bashrc

              alias date="date +%F"

 

十四、  搭建時鐘服務客戶端,指定上級服務器是172.16.254.254

[root@cracker ~]# system-config-date

 

十五、  用兩種方法,打開kernel的轉發功能

1.[root@cracker ~]# echo 1 > /proc/sys/net/ipv4/ip_forward

2.[root@cracker ~]# vim /etc/sysctl.conf

              net.ipv4.ip_forward = 1

[root@cracker ~]# sysctl -p

 

十六、  添加一個默認的本地打印機

Ø  打印隊列轉發到server1.example.comIPPCUPS)的打印隊列上

Ø  IPP的打印隊列的名稱是stationX

Ø  把打印機配置成“Generic-text only"

[root@cracker ~]# System-config-printer

1.新建打印機

2.輸入打印機名稱等描述

3.選擇網絡協議並指定打印機地址和名稱

4 選擇模式

5 選擇默認打印機選項

6 設爲默認打印機

7測試打印機

[root@cracker ~]# lpr install.log

8 測試結果

試結果

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章