CENTOS给文件设置了777权限仍不能访问解决方案

215


原因:开启了SELinux导致

1.查看SELinux状态:

/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态

SELinux status: enabled

 ##也可以用这个命令检查getenforce

2.关闭SELinux:

a.临时关闭(不用重启机器):

setenforce 0 ##设置SELinux 成为permissive模式

b.临时开启(不用重启机器):

setenforce 1 ##设置SELinux 成为enforcing模式

c.修改配置文件,需要重启机器:

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

reboot重启机器即可


相关知识:一文彻底明白linux中的selinux到底是什么