【问题标题】:Apache user can't create files in 777 directoryApache 用户无法在 777 目录中创建文件
【发布时间】:2017-10-24 12:22:38
【问题描述】:

我没有使用 SELinux,但我仍然无法让 apache 用户在我的缓存存储目录中创建文件。这可以在不使用chown 将用户更改为实际的apache 用户的情况下工作吗?

[root@server live_storage]# getenforce
Disabled
[root@server live_storage]# su -s /bin/bash -c 'touch /home/admin/live_storage/c50d02d942c0a3d.cache' apache
touch: cannot touch ‘/home/admin/live_storage/c50d02d942c0a3d.cache’: 
Permission denied
[root@server admin]# ls -lsa 
total 84 
  4 drwx------. 10 admin admin  4096 24 mei 10:32 .
  4 drwxr-xr-x.  3 root  root   4096  9 mei 11:12 ..
  4 drwxrwxrwx   3 admin admin  4096 24 mei 10:33 live_storage

[admin@server live_storage]$ touch '/home/admin/live_storage/c50d02d942c0a3d.cache'
[admin@server live_storage]$ ls '/home/admin/live_storage/c50d02d942c0a3d.cache'
/home/admin/live_storage/c50d02d942c0a3d.cache

【问题讨论】:

  • /home/admin/live_storage/c50d02d942c0a3d.cache 文件在您尝试 touch as apache 之前是否存在?
  • @DusanBajic 嗨,没有。整个目录是空的
  • [root@server live_storage]# su -s /bin/bash -c 'touch /home/admin/live_storage//c50d02d942c0a3d.cache' touch: cannot touch ‘/home/admin/live_storage//c50d02d942c0a3d.cache’: Permission denied [root@server live_storage]# su -s /bin/bash -c 'touch /home/admin/live_storage//c50d02d942c0a3d.cache' admin [root@server live_storage]#

标签: linux apache permissions chmod selinux


【解决方案1】:

想通了。 Apache 没有/home/admin 目录的执行权限。 chmod +x /home/admin 修复了问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-28
    • 2020-10-18
    • 1970-01-01
    • 2019-06-17
    • 2014-09-21
    • 2013-10-05
    • 2017-10-06
    相关资源
    最近更新 更多