About SELinux

来自cslt Wiki
2016年11月3日 (四) 04:05Wangyang讨论 | 贡献的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

semanage - SELinux Policy Management tool I introduce this command because several service need obtain the permission of SElinux. 2 example:

  • change mysql datadir.
 1) semanage fcontext -a -s system_u -t mysqld_db_t "/var/data/mysql(/.*)?" (/var/data/mysql is the datadir you want use)
 2) restorecon -Rv /var/data/mysql
  • grant www/apache to read files in a directory.
 1) semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html(/.*)?'
 2) restorecon -R /var/www/html