私は現在SELinuxを学んでいます。私は以下の指示に従いました。RedHat SELinux ドキュメント。次のコマンドを入力した後、成功しました。
mkdir /mywebsite
//add something to /mywebsite/index.html
semanage fcontext -a -t httpd_sys_content_t "/mywebsite(/.*)?"
restorecon -R -v /mywebsite //everythins worked well by then
しかし、私はそれ以上のことをしました。
chcon -R -t httpd_sys_content_t /mywebsite //I can't access index.html now, as expected
restorecon -R -v /mywebsite //Still can't access index.html!!
semanage fcontext -a -t httpd_sys_content_t "/mywebsite(/.*)?"
restorecon -R -v /mywebsite //didn't work, either
ls -dZ /mywebsite // unconfined_u:object_r:httpd_sys_content_t:s0
Firefoxのエラーメッセージは次のとおりです。
Forbidden
You don't have permission to access /index.html on this server.
私は何を逃したことがありませんか?それともバグですか?私のオペレーティングシステムはFedora 20とApache 2.4.7です。
ベストアンサー1
次のディレクトリから構成を複製できます/var/www/html
。
chcon -R --reference=/var/www/html /path/to/your/project