【问题标题】:Centos change directory permissionsCentos 更改目录权限
【发布时间】:2014-05-15 18:08:03
【问题描述】:

早上好,

我正在尝试为 apache 授予对 PHPDOCx 特定文件夹的写入权限。

[root@patdraft word2]# ll
total 4
-rwxr-xr-x 1 root root 718 May 15  2014 generate.php
drwxr-xr-x 1 root root   0 May 13 09:20 lib
drwxr-xr-x 1 root root   0 May 13 09:41 output
[root@patdraft word2]# chown -R apache:apache output/
[root@patdraft word2]# ll
total 4
-rwxr-xr-x 1 root root 718 May 15  2014 generate.php
drwxr-xr-x 1 root root   0 May 13 09:20 lib
drwxr-xr-x 1 root root   0 May 13 09:41 output

任何想法为什么它不改变目录所有者?

谢谢,哈利

更新:

我在 mount 中为我的 apache 基本目录使用了一个目录。

[root@patdraft word2]# cat /etc/passwd | grep apache
apache:x:48:48:Apache:/var/www:/sbin/nologin    
[root@patdraft mnt]# ll
drwxr-xr-x  1 root   root    4096 Apr 25 16:21 patdraft

phpdocx 目录位于我的 Web 服务器目录中。

更新 3:

[root@patdraft /]# chown -R apache:apache /mnt/patdraft/*
[root@patdraft /]# ll /mnt/patdraft/public_html/pages/word2/
total 4
-rwxr-xr-x 1 root root 774 May 15 09:14 generate.php
drwxr-xr-x 1 root root   0 May 13 09:20 lib
drwxr-xr-x 1 root root   0 May 15 09:33 output

只是不改变所有者?!

更新 4:

[root@patdraft word2]# egrep -iw --color=auto 'user|group' /etc/httpd/conf/httpd                                                                          .conf
User apache
Group apache

这不是因为该组拼写为“Apache”而不是“apache”。还有什么想法吗?

更新 5:

这是我重启服务后来自httpd的错误日志;

[Thu May 15 10:03:15 2014] [error] [client 192.168.1.26] PHP Warning:  mkdir(): Permission denied in /mnt/patdraft/public_html/pages/word2/generate.php on line 21
[Thu May 15 10:03:15 2014] [error] [client 192.168.1.26] PHP Warning:  copy(/mnt/patdraft/public_html/pages/word2/output/output1400144595.docx): failed to open stream: Permission denied in /mnt/patdraft/public_html/pages/word2/lib/phpdocx/classes/CreateDocx.inc on line 5343

CreateDocx.inc,第 53 行

copy(
   $this->_tempFile,
   $fileName . '.' . $this->_extension
);

更新 6:

我现在正在 apache 用户下挂载 ntfs 共享,看看是否可以修复它。

【问题讨论】:

  • 这是否意味着您在“/var/www”文件夹中有“PHPDOCx”文件夹?
  • 它在 /mnt/patdraft/..../phpdocx/ 中。我使用 /mnt/patdraft 作为我的 /var/www。
  • 尝试进入根目录 => "cd /" 然后输入一个逗号 "chown -R apache:Apache /mnt/patdraft/*"
  • 使用用户/组作为 apache?
  • 查看更新 3 和 4,不幸的是仍然没有运气。

标签: apache centos chown


【解决方案1】:

如果您有这样的用户“apache”,请检查 /etc/passwd。

请检查 /var/www 文件夹的权限,并为 PHPDOCx 文件夹提供相同的权限。

请确保不要将 PHPDOCx 文件夹放在某些用户的主文件夹中。

【讨论】:

  • 更新 OP 回答您的 cmets!
【解决方案2】:

问题是使用 ntfs 挂载,而 Windows(?) 不允许我更改权限。

我编辑了我的 /etc/fstab 挂载点以添加 file_mode 和 dir_mode 如下;

192.168.1.211:/APShared/IT/websites/patdraft.albright /mnt/patdraft cifs rw,username=<removed>,password=<removed>,noserverino,file_mode=0775,dir_mode=0777,exec 48 48

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-23
    • 2020-11-01
    • 2012-07-07
    • 1970-01-01
    • 1970-01-01
    • 2021-08-31
    • 1970-01-01
    相关资源
    最近更新 更多