使用 PHP/Apache 上传文件夹的正确权限是什么? [英] What are the proper permissions for an upload folder with PHP/Apache?

查看:34
本文介绍了使用 PHP/Apache 上传文件夹的正确权限是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉问这个基本问题 - 我是 .NET 开发人员,对 LAMP 设置没有太多经验.

Sorry for the basic question - I'm a .NET developer and don't have much experience with LAMP setups.

我有一个允许上传到特定文件夹的 PHP 站点.有人告诉我,该文件夹需要由网络服务器用户拥有才能使上传过程正常工作,因此我创建了该文件夹,然后将权限设置为:

I have a PHP site that will allow uploads to a specific folder. I have been told that this folder needs to be owned by the webserver user for the upload process to work, so I created the folder and then set permissions as such:

chown apache:apache -R uploads/
chmod 755 -R uploads/

现在唯一的问题是FTP用户根本无法修改上传的文件.

The only problem now is that the FTP user can not modify the uploaded files at all.

是否有权限设置允许我仍然上传文件,然后作为网络服务器用户以外的用户修改它们?

Is there a permission setting that will allow me to still upload files and then modify them later as a user other than the webserver user?

推荐答案

您可以创建一个以 apache 用户和 FTP 用户为成员的新组,然后将上传文件夹的权限设置为 775.这应该给两个 apache和 FTP 用户能够写入文件夹中的文件,但防止其他人修改它们.

You can create a new group with both the apache user and FTP user as members and then make the permission on the upload folder 775. This should give both the apache and FTP users the ability to write to the files in the folder but keep everyone else from modifying them.

这篇关于使用 PHP/Apache 上传文件夹的正确权限是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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