TOP > Linux > Fedoraの技 > 301-400 > 373
セキュリティコンテキストを変更するには
SELinuxで保護されているプロセスには専用のセキュリティコンテキストが用意されており、それぞれのファイルに適用されています。httpd(apache)とsquidは保護されるプロセスで、設定ファイルを確認すると独自のセキュリティコンテキストが設定されていることが分かります。
$ ls -lZ /etc/httpd/conf/httpd.conf /etc/squid/squid.conf
-rw-r--r-- root root system_u:object_r:httpd_config_t /etc/httpd/conf/httpd.conf
-rw-r----- root squid system_u:object_r:squid_conf_t /etc/squid/squid.conf
ファイルのセキュリティコンテキストを変更するにはchconコマンドを利用します。下記はappleファイルのセキュリティコンテキストを"system_u:object_r:httpd_config_t"に変更した例です。
$ ls -lZ /tmp/apple
-rw-r--r-- john beatles user_u:object_r:tmp_t /tmp/apple
$ chcon system_u:object_r:httpd_config_t /tmp/apple
$ ls -lZ /tmp/apple
-rw-r--r-- john beatles system_u:object_r:httpd_config_t /tmp/apple
2005-12-03 作成