練習
.1、安裝httpd服務,改變網站的默認主目錄為/website,添加SELinux文件標簽規則,設置http_sys_content_t到/website及目錄下所有文件,使網站可訪問
mkdir /website
vim /etc/httpd/conf/httpd.conf (找到文件中DocumentRoot)
注釋掉/var/…添加新目錄保存退出
因為你只建立文件但是 /website 的安全上下文 沒有改
兩種方法
①找目標,chcon -R –reference=/var/www/html /website
重啟服務 centos 6 :service httpd restart
centos 7 :systemctl restart httpd
②在文章中就有截圖添加安全上下文
.2、修改網站端口為9527,增加SELinux端口標簽,使網站可訪問
httpd 默認端口為 80
vim /etc/httpd/conf/httpd.conf
如果修改端口Listen 80 為 9527 會起不來服務httpd
所以 看筆記中的最后添加端口;
先查看semanage port –l
semanage port -a -t http_port_t -p tcp 9527
重啟服務。
link x.x.x.x:9527 (此處要加端口號鏈接)
.3、啟用SELinux布爾值,使用戶student的家目錄可通過http訪問
查看
centos 7 /etc/httpd/conf.d/userdir.conf
centos 6 /etc/httpd/conf/httpd.conf
把這個UserDir disabled注釋 # 掉就啟用了
并 吧下面的 userdir public_html的 # 刪掉 wq
service httpd restart
su – student
ls
mkdir public_html;cd public_html
echo xxhomeweb > index.html
但是這個 目錄的權限只有 student 有權限別人沒有訪問權限
chmod 711 /home/student
iptables -F
再
網頁訪問x.x.x.x/~student/
原創文章,作者:Nicolas ZhaoIV,如若轉載,請注明出處:http://www.www58058.com/46835
操作部分缺失?不完整?效果圖怎么沒有展示出來,同時也沒有總結出來此次試驗的目的?