我正在尝试学习Selinux。使用沙箱并使用VSFTPD进行试验,我在Centos中运行了vsfptd服务器。我有匿名用户将文件放在/ var / ftp / incoming中。在远程计算机上,我可以使用户成功登录,但是无法将文件放在删除vsftpd服务器上:

$ftp mysql_server
Connected to mysql_server (192.168.1.31).
220 Welcome to blah FTP service.
Name (mysql_server:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer ftp> put atd
local: atd remote: atd
227 Entering Passive Mode (192,168,1,31,19,161).
553 Could not create file.
ftp>


在VSFTPD服务器上,aureport -a报告显示:

[root@mysql_server ftp]# aureport -a

AVC Report
========================================================
# date time comm subj syscall class permission obj event
========================================================
4. 04/08/2013 13:30:36 vsftpd unconfined_u:system_r:ftpd_t:s0-s0:c0.c1023 21 dir write system_u:object_r:public_content_t:s0 denied 28
5. 04/08/2013 13:34:57 vsftpd unconfined_u:system_r:ftpd_t:s0-s0:c0.c1023 2 dir write system_u:object_r:public_content_t:s0 denied 47


我检查了目录,文件上下文看起来不错,所以我不明白为什么Selinux不允许vsftpd写入传入目录:

[root@mysql_server ftp]# ls -Z
drwx-wx---. root ftp  system_u:object_r:public_content_t:s0 incoming
drwxr-xr-x. root root system_u:object_r:public_content_t:s0 pub
[root@mysql_server ftp]#

最佳答案

您需要运行以下命令以允许在SELinux中上载和编辑文件:

setsebool -P allow_ftpd_full_access on
setsebool -P ftp_home_dir on

关于centos - Selinux-文件上下文看起来不错,但是Selinux不允许写,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15890481/

10-12 04:10