Linux查看、修改SELinux的状态
来源:互联网 发布:mac系统word文档只读 编辑:程序博客网 时间:2024/05/17 11:58
SELinux(Security-Enhanced Linux) 是美国国家安全局(NSA)对于强制访问控制的实现,是 Linux历史上最杰出的新安全子系统。但是我们一般都不用它,因为它管的东西太多了,想做安全可以用防火墙等其他措施。
我们可以通过查看配置文件的命令 cat /etc/selinux/config 来查看状态,
[root@lill ~]# cat /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=enforcing# SELINUXTYPE= can take one of these two values:# targeted - Targeted processes are protected,# mls - Multi Level Security protection.SELINUXTYPE=targeted
发现SELinux共有3个状态enforcing (执行中)、permissive (不执行但产生警告)、disabled(关闭)。
我们可以通过修改配置文件来修改SELinux的状态
[root@lill ~]# sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config [root@lill ~]# cat /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=disabled# SELINUXTYPE= can take one of these two values:# targeted - Targeted processes are protected,# mls - Multi Level Security protection.SELINUXTYPE=targeted
最后我们重启服务器,SELinux状态由enforcing变为disabled 。
当然,一般我们的Linux都不能重启,我们可以使用这个命令 setenforce 1 临时(重启即失效)设置SELinux 成为enforcing模式(setenforce 0 设置SELinux 成为permissive模式),用getenforce这个命令来检查。
root@lill ~]# setenforce 0[root@lill ~]# getenforce Permissive
我们还可以用 /usr/sbin/sestatus 命令来查看SELinux的状态。
[root@lill ~]# /usr/sbin/sestatus SELinux status: enabledSELinuxfs mount: /selinuxCurrent mode: enforcingMode from config file: disabledPolicy version: 24Policy from config file: targeted
1 0
- Linux查看、修改SELinux的状态
- Linux查看、修改SELinux的状态
- Linux下查看SELinux状态和关闭SELinux的方法
- Linux下查看SELinux状态和关闭SELinux的方法
- Linux下查看SELinux状态和关闭SELinux的方法
- 查看SELinux的状态,关闭SELinux
- 如何查看SELinux的状态
- 查看SELinux状态&关闭SELinux
- 查看SELinux状态&关闭SELinux
- 查看SELinux状态
- 查看SELinux状态
- samba能看到linux中的文件目录,但是看不到文件的解决(查看SElinux状态&关闭SElinux)
- 修改SELinux状态
- 查看和修改SELinux
- 查看 SELinux状态及关闭SELinux
- 查看 SELinux状态及关闭SELinux
- 查看 SELinux状态及关闭SELinux
- 查看 SELinux状态及关闭SELinux
- What's a Tri-state Buffer?
- Executing spatial queries
- 算法作业_16(2017.4.18第九周)
- String和StringBuffer的区别,和大多数讲区别的不一样
- 函数指针和指针函数
- Linux查看、修改SELinux的状态
- 自己编写的一个基于java的socket网络聊天程序
- 树
- LIVE555 RTSP RTP/RTCP协议介绍
- archlinux清理一下空间
- squashfs 文件看mount
- Aliyun ECS配置代理服务器以tinyproxy为例
- java字符编码
- scp 和 ssh 关于端口号的参数的区别