RHCE 模拟题及答案最新版v2.docx
《RHCE 模拟题及答案最新版v2.docx》由会员分享,可在线阅读,更多相关《RHCE 模拟题及答案最新版v2.docx(14页珍藏版)》请在冰豆网上搜索。
![RHCE 模拟题及答案最新版v2.docx](https://file1.bdocx.com/fileroot1/2023-1/4/8af50f5a-0873-4b32-96fa-0eb91ecf2c58/8af50f5a-0873-4b32-96fa-0eb91ecf2c581.gif)
RHCE模拟题及答案最新版v2
RHCT部分
注:
1本实验环境有两个域:
域对应的是172.16.0.0/255.255.0.0craker.org对应的是192.168.1.0/255.255.255.0
2iptables的拒绝设置要使用REJECT,不要使用DROP
3你可以配置yum环境,baseurl=ftp:
//172.16.254.254/pub/Server
[root@station1~]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
一破解密码
1要求root用户登录密码为redhat
2家目录是/root(不能进入recue模式)
开机进入grub后,按A健进入修改内核参数模式
输入1(空格+1)进入单用户模式
进入后即为root用户,直接passwd修改root密码。
二
1设置网络IP172.16.25.X
2网关为172.16.254.254
3Nameserver172.16.254.254
4HostnamestationX
5设置本机默认启动是runlevel5
[root@station1~]#setup--networkconfiguration--editdevices--eth0
Nameeth0
Deviceeth0
UseDHCP[]
StaticIP172.16.25.1
Netmask255.255.0.0
DefaultgatewayIP172.16.254.254
[root@station1~]##vim/etc/resolv.conf
;generatedby/sbin/dhclient-script
search
nameserver172.16.254.254
[root@station1~]##vim/etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
hostname=
[root@station1~]#vim/etc/inittab
id:
5:
initdefault:
三配置nfsclient
1要求让系统每次启动时能自动把172.16.254.254:
/var/ftp/pub挂载到/mnt/nfs目录下,进入/mnt/nfs,能看到一个exam的文件
[root@station1~]#vim/etc/fstab
//增加以下行
172.16.254.254:
/var/ftp/pub/mnt/nfsnfsdefaults00
[root@station1~]#mkdir/mnt/nfs
[root@station1~]#serviceautofsrestart
四在172.16.254.254:
/var/ftp/pub/errata目录下有更新的kernel
1你可以选择yum或者rpm工具完成kernel的更新
2要保证系统启动默认加载更新的kernel
3原有的kernel要保留
[root@station1~]#rpm-ivh/mnt/nfs/errata/kernel-2.6.18-194.el5.i686.rpm
[root@station1~]#vim/boot/grub/grub.conf
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
#passwordredhat
titleRedHatEnterpriseLinuxServer(2.6.18-194.el5)
root(hd0,0)
kernel/vmlinuz-2.6.18-194.el5roroot=LABEL=/
initrd/initrd-2.6.18-194.el5.img
titleRedHatEnterpriseLinuxServer(2.6.18-164.el5)
root(hd0,0)
kernel/vmlinuz-2.6.18-164.el5roroot=LABEL=/rhgbquiet
initrd/initrd-2.6.18-164.el5.img
五
1分两个分区做RAID0
2用来挂载/rhome,大小是3G,文件系统类型是ext3
[root@station1~]#fdisk/dev/sda
//分2个1.5G分区fd
[root@station1~]#partprobe
[root@station1~]#mdadm-C/dev/md0-l0-n2/dev/{sda5,sda6}-ayes
[root@station1~]#mke2fs-j/dev/md0
[root@station1~]#mdadm--examine--scan>/etc/mdadm.conf
[root@station1~]#mkdir/rhome
[root@station1~]#vim/etc/fstab
//增加以下行
/dev/md0/rhomeext3defaults00
[root@station1~]#serviceautofsrestart
六创建kevin,mandy,todd和erien用户,创建teacher,student组,
要求:
1kevintodd属于teacher组(或者是第一附属组是teacher),密码设置成password
2mandy属于student组,并且指定他的家目录是/rhome/$USERNAME,设置密码有效期是20天,密码任意设置
3erien属于erien组同时隶属于(或者说是第二附属组)teacher和student组,但指定他使用的shell为/sbin/nologin
[root@station1~]#groupaddteacher
[root@station1~]#groupaddstudent
[root@station1~]#useradd-Gteacherkevin
[root@station1~]#echo'password'|passwd--stdinkevin
[root@station1~]#useradd-Gteachertodd
[root@station1~]#echo'password'|passwd--stdintodd
[root@station1~]#useraddmandy-d/rhome/mandy-Gstudent
[root@station1~]#chage-M20mandy
[root@station1~]#echo'redhat'|passwd--stdinmandy
[root@station1~]#chage-lmandu
[root@station1~]#useradd-Gteacher,student-s/sbin/nologinerien
[root@station1~]#echo'redhat'|passwd--stdinerien
七拷贝/etc/passwd到/student
1要求该文件拥有者是todd,拥有组是student
2其它人没有可读权限
3kevin能读写该文件
[root@station1~]#mkdir/student
[root@station1~]#cp/etc/passwd/student
[root@station1~]#chownroot.student/student/passwd
[root@station1~]#chmodo-r/student/passwd
[root@station1~]#setfacl-mu:
kevin:
rw/student/passwd
[root@station1~]#getfacl/student/passwd
八创建/student/test目录,要求
1student组的用户对此目录有完全权限
2kevin对此目录有r-x权限
3在此目录中创建的文件,只有本人和root可以删除
4在此目录中创建的文件,拥有组一定是student
[root@station1~]#mkdir/student/test
[root@station1~]#chgrpstudent/student/test/
[root@station1~]#chmodg=rwx/student/test/
[root@station1~]#setfacl-mu:
kevin:
rx/student/test/
[root@station1~]#chmodo+t/student/test/
[root@station1~]#chmodg+s/student/test/
九打开kernel的转发功能
[root@station1~]#vim/etc/sysctl.conf
//修改如下为1
net.ipv4.ip_forward=1
[root@station1~]#sysctl-p
十todd用户设置一个计划任务
每周三和周五的15点钟,每两分钟统计一下内存的使用情况
[root@station1~]#crontab-e-utodd
*/215**3,5/usr/bin/free
十一
1创建用户student1到student50,指定组为student组,并设置密码为redhat
2其中为student1和student2这两个用户设置磁盘配额,要求以这两个用户登录系统后,运行ddif=/dev/zeroof=/home/studentX/filetestbs=1Mcount=10是成功的,ddif=/dev/zeroof=/home/studentX/filetestbs=1Mcount=30是失败的
[root@station1~]#foriin$(seq150);douseradd-gstudentstudent$i;echo'redhat'|passwd--stdinstudent$i;done
[root@station1~]#vim/etc/fstab
/dev/VolGroup00/LogVol00/homeext3defaults,usrquota,grpquota12
[root@station1~]#mount-oremount/home
[root@station1~]#quotacheck-mcug/home
[root@station1~]#quotaon/home
[root@station1~]#edquotastudent1
Diskquotasforuserstudent1(uid504):
Filesystemblockssofthardinodessofthard
/dev/mapper/VG-LV281100022000700
[root@station1~]#edquota-pstudent1student2
十二172.16.254.254这个服务器上有用户nisuX,密码为password,nisdomainisnotexample
1要求这个用户可以通过你的机器登录
2172.16.254.254通过nfs把/rhome共享出来了,nisuX的家目录是:
/rhome/nisuX,nisuX的家目录应该能自动挂载到/home/guests/nisuX
[root@station1~]#setip--->usenis--->nisdomain:
notexample,server:
172.16.254.254
[root@station1~]#ypcatpasswd
[root@station1~]#vim/etc/auto.master
/home/guests/etc/auto.misc
[root@station1~]#vim/etc/auto.misc
nisu1:
/rhome/nisu1
[root@station1~]#serviceautofsrestart
十三把/home缩小成1G
[root@station1~]#serviceautofsstop
[root@station1~]#umount/home
[root@station1~]#e2fsck-f/dev/VolGroup00/LogVol00
[root@station1~]#resize2fs1G/dev/VolGroup00/LogVol00
[root@station1~]#lvresize-L1G/dev/VolGroup00/LogVol00
[root@station1~]#mount-a
[root@station1~]#df-h
十四设置一个别名date=”date+%F”,要求,kevin这个用户每次登录系统都要能用这个别名
[root@station1~]#vim/home/kevin/.bashrc
//增加以下行
aliasdate="date+%F"
十五搭建时钟服务客户端,指定上级服务器是172.16.254.254
[root@station1~]#system-config-date
十六设置selinux的模式为enforcing
十七添加一个默认的本地打印机,打印队列转发到的IPP(CUPS)的打印队列上,该IPP的打印队列的名称是stationX,要求,把打印机配置成“Generic-textonly"
[root@station1~]#system-config-printer
十八编写shell脚本
1脚本位于/bin/目录下,脚本名称是test.sh
2当运行/bin/test.shkernel命令时,输出到终端的内容是user
3当运行/bin/test.shuser命令时,输出到终端的内容是kernel
4当给脚本传递的参数不是kernel,也不是user时,输出到终端的内容是error
[root@station1~]#vim/bin/test.sh
#!
/bin/bash
case$1in
kernel)
echouser
;;
user)
echokernel
;;
*)
echoerror
esac
[root@station1~]#chmod775/bin/test.sh
[root@station1~]#test.shuser
十九用find工具完成下面的内容
1查找系统中权限是2755的文件,拷贝到/student/findfile1目录下
2查找系统中拥有者和拥有组是student的文件,拷贝到/student/findfile2目录下
[root@station1~]#find/-perm2755-execcp-rp{}/student/findfile1\;
[root@station1~]#find/-userstudent-groupstudent-execcp-rp{}/student/findfile2\;
RHCE部分
一搭建FTP服务,要求:
1匿名用户可以访问ftp
2(可选)student1和student2登录ftp后,只能在自己的家目录下
3(可选)student3不能登录ftp
4允许从这个域来访问
5不允许从其它域来访问
[root@station1~]#yum-yinstallvsftpd
[root@station1~]#vim/etc/vsftpd/vsftpd.conf
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
[root@station1~]#echo'student1'>/etc/vsftpd/chroot_list
[root@station1~]#echo'student2'>>/etc/vsftpd/chroot_list
[root@station1~]#echo'student3'>>/etc/vsftpd/ftpusers
[root@station1~]#getsebool-a|grepftp
ftp_home_dir-->off
[root@station1~]#setsebool-Pftp_home_diron
[root@station1~]#vim/etc/hosts.deny
vsftpd:
ALL
[root@station1~]#echo'vsftpd:
172.16.0.0/255.255.0.0'>>/etc/hosts.allow
[root@station1~]#whereisvsftpd
vsftpd:
/usr/sbin/vsftpd/etc/vsftpd/usr/share/man/man8/vsftpd.8.gz
[root@station1~]#ldd/usr/sbin/vsftpd|greplibwrap.so
libwrap.so.0=>/lib/libwrap.so.0(0x00170000)
二配置samba服务,要求:
1配置samba服务作为ITLAB组的成员
2共享出/yangbang目录
3只有172.16.0.0/16和192.168.1.0/24和127.0.0.1可以访问
4共享出的名字是[sharefile],默认可以查看到该共享
5只有student组才有写的权限
6要把student组里的每个用户的家目录也要共享出来
7设置Netbiosname=GUESTX
[root@station1~]#yum-yinstallsamba
[root@station1~]#vim/etc/samba/smb.conf
workgroup=ITLAB//改名
netbiosname=GUEST1//去掉注释并改名
[sharefile]
comment=sharefile
path=/yangbang
writelist=@student
hostsallow=172.16.0.0/16192.168.1.0/24127.0.0.1
[root@station1~]#chkconfigsmbon
[root@station1~]#getsebool-a|grepsamba
samba_enable_home_dirs-->off
[root@station1~]#setsebool-Psamba_enable_home_dirson
[root@station1~]#chgrpstudent/yangbang/
[root@station1~]#chmodg+w/yangbang/
[root@station1~]#chcon-R-tsamba_share_t/yangbang/
[root@station1~]#testparm//测试samba的配置文件
[root@station1~]#smbpasswd-astudent1
[root@station1~]#servicesmbrestart
[root@station1~]#smbclient//172.16.25.1/sharefile-Ustudent1
Password:
Domain=[GUEST1]OS=[Unix]Server=[Samba3.0.33-3.14.el5]
smb:
\>pwd
Currentdirectoryis\\172.16.25.1\sharefile\
三搭建ssh服务,要求:
1puser用户能远程登录
2只允许从这个域来访问,不允许从其它域访问
[root@station1~]#whereissshd
sshd:
/usr/sbin/sshd/usr/share/man/man8/sshd.8.gz
[root@station1~]#ldd/usr/sbin/sshd|greplibwrap.so
libwrap.so.0=>/lib/libwrap.so.0(0x0096b000)
[root@station1~]#vim/etc/hosts.deny
vsftpd:
ALL
sshd:
ALL
[root@station1~]#vim/etc/hosts.allow
sshd:
192.168.142.0/255.255.255.0192.168.0.0/255.255.255.0
[root@station1~]#vim/etc/ssh/sshd_config
//增加以下行
DenyUserspuser
[root@masternispub]#servicesshdrestart
四搭建webserver要求:
1站点的名字:
stationX
2从172.16.254.254:
/var/ftp/pub目录下下载webdoc.gz,解压到根目录下后,挂载到你的站点的DocumentRoot下,就能看到一个index.html,不用修改index.html的内容
八再搭建