gpt4 book ai didi

centos - Selinux - 文件上下文看起来不错,但 Selinux 不允许写入

转载 作者:太空宇宙 更新时间:2023-11-03 17:15:31 30 4
gpt4 key购买 nike

我正在努力学习 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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com