RHCE (下午2小时)
网络
设置静态网络,要求如下:ip192.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,匿名用户ftpanonymous登录显示目录。非匿名用户登录显示用户的home目录
配置HTTP server,通过http//serverX.example.com 可以访问,页面内容可以从ftp//192.168.0.254/pub/server.html 下载
注意yum仓库的路径,ftphttp的根目录
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 http://server9.example.com/
存储
请挂载iscsi存储,iscsi servicer192.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.shallnone时候,则显示"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
配置FTP服务器
1、建立ftp server 允许匿名用户可以上传,
2、将所有用户都锁定在自己的家目录
3、仅允许example.com域用户访问该FTP 
yum -y install vsftpd
service vsftpd restart
chkconfig vsftpd on
chmod 777 /var/ftp/pub
man ftpd_selinux
chcon -P -t pubic_content_rw_t /var/ftp/pub
getsebool -a | grep ftp
allow_ftpd_anon_write=1
          
vim /etc/vsftpd/vsftpd.conf
允许匿名用户可以上传: anon_upload_enable=YES write_enable=YES为前提 
将所有用户都锁定在自己的家目录: chroot_list_enable=YES
仅允许example.com域用户访问: vim /etc/hosts.allow  vsftpd:example.com
Vim /etc/hosts.deny  vsftpd:  ALL
测试:
SElinux的状态设置为Enforcing模式
yum whatprovides *system-config-selinux
安装
select-status-system Default Enforcing Mode
新建一台web server 要求如下:
1、下载http://192.168.0.254/pub/tools/server.html文中,当用户输入http://serverX.example.com可以访问该文件,仅允许本机可以访问http//serverX.example.com下的pub目录
NameVirtualHost 192.168.0.116:80
<VirtualHost 192.168.0.116:80>
#    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/virt1
    <Directory /var/www/html/pub>
    order allow,deny
    deny from all
    allow from 192.168.0.116
#   options Indexes -FollowSymLinks
   Allowoverride  authconfig
    </Directory>
    ServerName server16.example.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
2、下载http://192.168.0.254/pub/tools/www.html文中,当用户输入http://serverX.example.com可以访问到该文中的内容,该站点需要身份验证,仅alicebob可以访问,密码均为redhat
生成httpd的用户认证
htpasswd -cm /etc/httpd/.htpasswd alice
htpasswd -m /etc/httpd/.htpasswd bob
NameVirtualHost 192.168.0.116:80
<VirtualHost 192.168.0.116:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/virt2
    ServerName www16.example.com
    <Directory /var/www/html/virt2>
    AuthName "test"
    AuthType basic
    AuthUserFile /etc/httpd/.htpasswd
    require valid-user
    </Directory>
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
新建邮件服务器,要求如下
1、允许localhost和远程主机均能够访问
2、允许example.com域可以中继,拒绝remote.test
3、所有发送给user3的邮件将发送给user1
4、仅允许用户在example.com域中使用pop3接受邮件。