加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – mod_perl无法在/ tmp中看到文件

发布时间:2020-12-13 22:56:55 所属栏目:Linux 来源:网络整理
导读:我有一些mod_perl代码试图访问/ tmp下的文件…但它会抛出’没有这样的文件或目录’错误.我在我的代码中添加了一个’ls -al / tmp’,看看Perl在目录中看到了什么,它只给了我.和..: drwxrwxrwt. 2 root root 6 Jan 21 13:36 .drwxrwxrwx. 18 root sysadmin 40
我有一些mod_perl代码试图访问/ tmp下的文件…但它会抛出’没有这样的文件或目录’错误.我在我的代码中添加了一个’ls -al / tmp’,看看Perl在目录中看到了什么,它只给了我.和..:

drwxrwxrwt.  2 root root        6 Jan 21 13:36 .
drwxrwxrwx. 18 root sysadmin 4096 Nov 22 22:14 ..

实际上/ tmp下有一些文件混合,包括Apache用户拥有的一些文件.将我的代码更改为’ls -al /’会给出正确的目录列表(没有遗漏).

我试过sudo’ing到Apache用户,并且可以在/ tmp文件下看到,所以它必须与mod_perl相关.

想法?我在CentOS 7下运行mod_perl 2.0.8和Apache 2.4.SELinux设置为允许.

解决方法

所以根据评论,这里的答案是 – 这是一个RHEL 7功能.
https://securityblog.redhat.com/2014/04/09/new-red-hat-enterprise-linux-7-security-feature-privatetmp/

PrivateTmp=

Takes a boolean argument. If true sets up a new file system namespace for the executed processes and mounts a private /tmp directory inside it,that is not shared by processes outside of the namespace. This is useful to secure access to temporary files of the process,but makes sharing between processes via /tmp impossible. Defaults to false.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读