Linux运维笔记-文档总结- selinux对文件的控制

来源:互联网 发布:重庆seo公司 编辑:程序博客网 时间:2024/06/08 00:05

以下所有操作都是在Red-hat 7.0上


SELinux是个经过安全强化的Linux操作系统,实际上,基本上原来的运用软件没有必要修改就能在它上面运行。真正做了特别修改的RPM包只要50 多个。像文件系统EXT3都是经过了扩展。

文件操作

1)ls命令
在命令后加个-Z 或者加 –context
[root@python azureus]# ls -Z
-rwxr-xr-x fu fu user_u:object_r:user_home_t azureus
-rw-r–r– fu fu user_u:object_r:user_home_t Azureus2.jar
-rw-r–r– fu fu user_u:object_r:user_home_t Azureus.png
2)chcon
更改文件的标签
[root@python tmp]# ls –context test.txt
-rw-r–r– root root root:object_r:staff_tmp_t test.txt
[root@python tmp]# chcon -t etc_t test.txt
[root@python tmp]# ls -lZ test.txt
-rw-r–r– root root root:object_r:etc_t test.txt

在进行这个实验的时候。要删除之前配置的文件,重新安装ftp服务

[root@localhost ~]# ls -Z /var/ftp/pub 显示安全上下文 [root@localhost ~]# ps auxZ | grep vsftpd 显示安全文件上下文 [root@localhost ~]# chcon -t public_content_t /var/ftp/pub/westos ##更改安全文件上下文

在Enforing模式下,如果安全上下文不一致,将不能在FTP中显示。

这里写图片描述

这里写图片描述


The end

0 0