9. 在/var/www/html 建一个 secret 目录,内容自定义,并启用身份验证,用户student可以通过密码123登录
# mkdir /var/www/html/secret
# vi /var/www/html/secret/index.html
secret
# htpasswd -cm /etc/httpd/.htpasswd student
123
# vi /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName server7.example.com
ErrorLog logs/server7.example.com-error_log
CustomLog logs/server7.example.com-access_log common
<Directory /www/virtual/secret>
authuserfile /etc/httpd/.htpasswd
authname "please input your username and passwd"
authtype basic
require valid-user
</Directory>
</VirtualHost>
10. 在/mnt/test文件查找gp字符串行,并按顺序复制到/root/lines.txt
# grep gp /mnt/test > /root/lines.txt
11. 挂载/mnt/boot.iso镜像文件到/mnt/img,启动时自动挂载
# vi /etc/fstab
/mnt/boot.iso /mnt/img iso9660 loop 0,0
12. 编写一个脚本/root/test.sh,当执行命令“sh test.sh A”执行脚本时,输出 B
执行”sh test.sh B”执行脚本时 输出 A
执行“sh test.sh 空格或其他字符" 输出“error”
# vi /root/test.sh
#!/bin/bash
case $1 in
A)
echo B ;;
B)
echo A ;;
*)
echo error ;;
esac
#chmod +x /root/test.sh
13. 开机后查看/proc/cmdline,其中包含max_loop=16
# vi/boot/grub/grub.cong
在kernel行添加max_loop=16
14. 只允许 192.168.0.0/24 网段用户访问 ssh 服务
# vi /etc/hosts.deny
sshd:ALL
# vi /etc/hosts.allow
sshd:192.168.0.
15. 配置iscsi 目标:iqn.2010-09.com.example:rdisks.serverX, 并格式化为ext3,永久挂载到/mnt/data,目标主机:instructor.example.com
# chkconfig iscsi on
# chkconfig iscsid on
# iscsiadm -m discovery -t st -p instructor.example.com
iqn.2010-09.com.example:rdisks.server7
# iscsiadm -m node -l
# fdisk -l
在/dev/sda
# fdisk -cu /dev/sda
分区/dev/sda1
# partx -a /dev/sda
# mkfs.ext3 /dev/sda1
# blkid
查看UUID
# vi /etc/fsatb
UUID=*** /mnt/data ext3 _netdev 0,0
16. nfs共享/common, 仅允许当前example.com域用户访问
# chkconfid rpcbind on
# chkconfig nfs on
# vi /etc/exprts
/common 192.168.0.0/24(async)
# exportfs -rv
17. Samba 共享/common,工作组名 STAFF,要求 browseable=yes ,harry用户可以读取密码为harry
# chkconfig smb on
# vi /etc/samba/smb.conf
workgroup = STAFF
[common]
comment = local common
path = /common
browseable = yes
# smbpasswd -a harry
# chcon -t samba_share_t /common/
