Centos更改目录权限

时间:2014-05-15 07:59:04

标签: apache centos chown

早上好,

我试图为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 base dir使用了一个目录。

[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'而不是阿帕奇'。还有更多想法吗?

更新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共享,看看是否修复了它。

2 个答案:

答案 0 :(得分:1)

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

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

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

答案 1 :(得分:0)

问题在于使用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
相关问题