chmod 777 命令给文件夹授权后,依旧无权限访问
这是因为SELinux是Linux系统上一个常见的安全软件,只需要把它关闭即可
首先通过命令 getenforce 来查看当前SELinux的状态,默认情况下一般都是Enforcing状态,也就是强制启用的意思。
SELinux一共有3种状态,分别是Enforcing,Permissive和Disabled状态。第一种是默认状态,表示强制启用,第二种是宽容的意思,即大部分规则都放行。第三种是禁用,即不设置任何规则。可以通过setenforce命令来设置前面两种状态
Enforcing:setenforce 1
Permissive:setenforce 0
只是单纯通过执行 setenforce 0 命令修改状态为Permissive,在系统重启后又会恢复到默认状态Enforcing,
为了使修改一直生效,可以通过修改配置文件
[root@CentOS7 selinux]# vim /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=permissive # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
修改配置文件中SELINUX=permissive 保存,reboot 重启系统即可
再次查看状态
[root@CentOS7 selinux]# getenforce Permissive
注意:不要修改SELINUX=disabled,这会使dockers容器启动异常



