RHCE 6.0 集训试题+答案

RHCE (下午2小时)
网络
设置静态网络,要求如下:ip:192.168.0.100+X    netmask 255.255.255.0 gateway:192.168.0.254  DNS1:192.168.0.254  DNS2:192.168.1.254 要求每次开机自动激活网卡
FTP&HTTP&NFS
安装FTP server 匿名用户可以从/var/ftp/pub下载
system-config-firewall  disable,允许所有。 disable拒绝所有
yum -y install vsftpd
service vsftpd restart
chkconfig vsftpd on
根在/var/ftp/pub,匿名用户ftp,anonymous登录显示目录。非匿名用户登录显示用户的home目录
配置HTTP server,通过http://serverX.example.com 可以访问,页面内容可以从ftp://192.168.0.254/pub/server.html 下载
注意yum仓库的路径,ftp、http的根目录
yum install httpd
chkconfig httpd on
service httpd  restart
service httpd configtest
注意文件的context值,
cd /var/www/html   wget ftp://192.168.0.254/pub/server.htm .
cp server.html index.html
测试:   links
存储
请挂载iscsi存储,iscsi servicer在192.168.0.254,在该存储上面分配30m空间,格式化成ext3的根式,挂载在/mnt/storage目录下,要求每次开机都生效
yum list |grep iscsi
yum -y install iscsi-init*
service iscsi start
iscsi -m discovery -t sendtargets -p 192.168.0.254:3260
iscsi -m node -T iqnname -p 192.168.0.254:3260 -l
fdisk /dev/sda
mkfs.etx3 /dev/sda
mount /dev/sda5 /mnt/storage
写在开机脚本/etc/fstab
属性_netdev
脚本
写一个脚本/root/myscripts.sh,当用户输入/root/myscripts.sh all显示none,当用户输入/root/myscripts.sh none显示all,执行/root/myscripts.sh非all或none时候,则显示"Error,please input all/no"
#!/bin/bash
word=$1
if [ $word = all ]
   then echo "none"
   else if [ $word = none ]
        then echo "all"
   else
   echo "Error,please input all/none"
fi
fi
Chmod a+x /myscripts.sh
[$word = none ] 可以修改为test $word = none  test 命令脚本
共享/mnt/storage目录。允许example.com域里面的用户对该目录有读写权限,remote.test对该用户仅有只读权限。
service nfs restart
chkconfig nfs on
vim /etc/exports
/mnt/storage   *.example.com(rw,sync)
/mnt/storage   *.remote.test(ro,sync)
测试: ssh 192.168.0.16 ; showmount -e 192.168.0.116 ;
允许example.com域中的计算机可以访问ssh server 拒绝remote.test域中的计算级访问ssh server
sshd:.example.com
/etc/hosts.allow    sshd: ALL EXCEPT .example.com
/etc/hosts.deny    sshd: .example.com
/etc/hosts.allow /etc/hosts.deny有明确接受先接受,没有明确接受有明确拒绝就拒绝,没有明确接受明确拒绝则接受
配置samba,要求如下:
1、共享/mnt/storage目录,共享名为share
2、仅允许user1,user2用户对该目录有写权限,其他用户只读,密码为RedHat
3、仅允许用户在example.com域可以访问该共享
4、允许所有人浏览,拒绝匿名用户访问。
yum -y install samba
Service smb restart ;service nmb restart ; chkconfig smb on; chkconfig nmb on;
chcon -t samba_share_t /mnt/storage
getsebool -a | grep samba
setsebool -P samba_domain_controller=1
setsebool -P samba_export_all_ro=1
setsebool -P samba_enable_home_dirs=1
添加samba用户:首先必须是一个本地用户: sampasswd -a user1 ;
Netbios name = RHCE
       [share]
       comment = Public Stuff
       path = /mnt/storage
       public = no
       writable = yes
       write list =user1,user2
       browseable = yes
在/etc/hosts.deny中添加: samba: ALL EXCEPT .example.com
测试:smbclient -L //192.168.0.116; mount -t cifs 192.168.0.116:/share /samba -o username=user1

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/22244.html