阿帕奇添加到用户组的文件上传权限 [英] Adding apache to a user group file upload permission

查看:263
本文介绍了阿帕奇添加到用户组的文件上传权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP脚本文件上传到特定的文件夹,目前正上传为psacln组中,这样我可以通过FTP删除这些文件。这是所有工作的罚款时,PHP正在运行的FastCGI的,我不得不改变PHP作为Apache模块,以获得一个PHP扩展的工作运行。但现在我无法通过PHP脚本,因为权限被拒绝删除文件。我想因为现在该集团阿帕奇试图删除属于psacln的文件。我如何让Apache来删除这些文件?

编辑:LS -alF

  drwxr-XR-X 2 fugitiveink psacln 4096 11月13日14时05分92 /
drwxr-XR-X 2 fugitiveink psacln 4096年11月13 06:57 93 /
drwxr-XR-X 2 fugitiveink psacln 4096年11月13 14:12 95 /
drwxr-XR-X 2 fugitiveink psacln 4096年12月21 18:56 96 /
drwxr-XR-X 2 fugitiveink psacln 4096年12月21 08:30 97 /
drwxr-XR-X 2 fugitiveink psacln 4096年11月13 14:26 98 /
drwxr-XR-X 2 fugitiveink psacln 4096年11月13 14:28 99 /


解决方案

我假设你有shell和根访问此系统。如果是这样,你可以尝试添加Apache用户(通常阿帕奇 www数据)的 / etc / group文件文件。

要做到这一点,正确的方法是使用 usermod命令,虽然我通常只是直接编辑文件。

在短,如果你的apache用户是阿帕奇,请尝试:

 须藤usermod命令阿帕奇--append --groups psacln

这基本上给到任何文件和放大器apache用户访问;目录由该psacln组所有。

如果这不起作用,发布的文件权限的目录的示例( LS -alF ),我们可以从工作。

编辑:

要直接编辑组文件利用纳米(替代与任何编辑器,你有舒适):

  sudo的纳米/等/组

和找到 psacln 组并添加阿帕奇用户:

  psacln:X:130:阿帕奇

注意,GID( 130 )无疑将是不同的。

I have a php script uploading files to a certain folder, currently they are uploading as a 'psacln' group, so that I can delete the files via FTP. This was all working fine when PHP was running as FastCGI, I had to change PHP to run as Apache Module in order to get a php extension to work. But now I can't delete files via PHP script because permission is denied. I assume because now the group 'Apache' is trying to delete the file that belongs to 'psacln'. How do I allow apache to delete those files?

EDIT: ls -alF

drwxr-xr-x   2 fugitiveink psacln 4096 Nov 13 14:05 92/
drwxr-xr-x   2 fugitiveink psacln 4096 Nov 13 06:57 93/
drwxr-xr-x   2 fugitiveink psacln 4096 Nov 13 14:12 95/
drwxr-xr-x   2 fugitiveink psacln 4096 Dec 21 18:56 96/
drwxr-xr-x   2 fugitiveink psacln 4096 Dec 21 08:30 97/
drwxr-xr-x   2 fugitiveink psacln 4096 Nov 13 14:26 98/
drwxr-xr-x   2 fugitiveink psacln 4096 Nov 13 14:28 99/

解决方案

I assume that you have shell and root access to this system. If so, you can try adding the apache user (typically apache or www-data) to the /etc/group file.

The proper way to do this is to use usermod, though I typically just edit the file directly.

In short if your apache user is apache, try:

sudo usermod apache --append --groups psacln

This basically gives the apache user access to any files & directories that are owned by the psacln group.

If this doesn't work, post an example of your directory with the file permissions (ls -alF) and we can work from that.

EDIT:

To directly edit the groups file using nano (substitute with whichever editor you're comfortable with):

sudo nano /etc/groups

and find the psacln group and add the apache user:

psacln:x:130:apache

Note that the gid (130) will undoubtedly be different.

这篇关于阿帕奇添加到用户组的文件上传权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆