Linux查看、修改SELinux的状态
2017-08-02 20:14
375 查看
SELinux(Security-Enhanced Linux) 是美国国家安全局(NSA)对于强制访问控制的实现,是 linux历史上最杰出的新安全子系统。但是我们一般都不用它,因为它管的东西太多了,想做安全可以用防火墙等其他措施。
我们可以通过查看配置文件的命令 cat /etc/selinux/config 来查看状态,
2
3
4
5
6
7
8
9
10
11
12
1
2
3
4
5
6
7
8
9
10
11
12
发现SELinux共有3个状态enforcing (执行中)、permissive (不执行但产生警告)、disabled(关闭)。
我们可以通过修改配置文件来修改SELinux的状态
2
3
4
5
6
7
8
9
10
11
12
13
1
2
3
4
5
6
7
8
9
10
11
12
13
最后我们重启服务器,SELinux状态由enforcing变为disabled 。
当然,一般我们的Linux都不能重启,我们可以使用这个命令 setenforce 1 临时(重启即失效)设置SELinux 成为enforcing模式(setenforce 0 设置SELinux 成为permissive模式),用getenforce这个命令来检查。
2
3
1
2
3
我们还可以用 /usr/sbin/sestatus 命令来查看SELinux的状态。
2
3
4
5
6
7
1
2
3
4
5
6
7
我们可以通过查看配置文件的命令 cat /etc/selinux/config 来查看状态,
[root@mazhonghua ~]# 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=targeted1
2
3
4
5
6
7
8
9
10
11
12
1
2
3
4
5
6
7
8
9
10
11
12
发现SELinux共有3个状态enforcing (执行中)、permissive (不执行但产生警告)、disabled(关闭)。
我们可以通过修改配置文件来修改SELinux的状态
[root@mazhonghua ~]# sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config [root@mazhonghua ~]# 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=targeted1
2
3
4
5
6
7
8
9
10
11
12
13
1
2
3
4
5
6
7
8
9
10
11
12
13
最后我们重启服务器,SELinux状态由enforcing变为disabled 。
当然,一般我们的Linux都不能重启,我们可以使用这个命令 setenforce 1 临时(重启即失效)设置SELinux 成为enforcing模式(setenforce 0 设置SELinux 成为permissive模式),用getenforce这个命令来检查。
root@mazhonghua ~]# setenforce 0 [root@mazhonghua ~]# getenforce Permissive1
2
3
1
2
3
我们还可以用 /usr/sbin/sestatus 命令来查看SELinux的状态。
[root@mazhonghua ~]# /usr/sbin/sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: disabled Policy version: 24 Policy from config file: targeted1
2
3
4
5
6
7
1
2
3
4
5
6
7
相关文章推荐
- Linux查看、修改SELinux的状态
- linux 下查看文件修改时间,访问时间,状态改变时间
- Linux下查看显示器输出状态以及修改显示器工作模式(复制 or 扩展)
- linux 下查看文件修改时间,访问时间,状态改变时间
- Linux下查看SELinux状态和关闭SELinux的方法
- Linux下查看SELinux状态和关闭SELinux的方法
- samba能看到linux中的文件目录,但是看不到文件的解决(查看SElinux状态&关闭SElinux)
- Linux 命令 之 【stat】 查看文件状态。 (包括修改时间)
- linux 下查看文件修改时间,访问时间,状态改变时间
- Linux下查看SELinux状态和关闭SELinux的方法
- Linux下查看SELinux状态和关闭SELinux的方法
- linux 下查看文件修改时间,访问时间,状态改变时间
- Linux下查看SELinux状态和关闭SELinux的方法
- 在linux中查看防火墙当前的状态
- 二、查看和修改Linux的时间
- Linux下用netstat查看网络状态、端口状态
- linux查看和修改PATH环境变量的方法
- Linux netstat 命令查看80端口状态
- Linux学习笔记-----进程管理-查看系统健康状态
- LINUX修改系统时间和linux查看时区、修改时区的方法