图像保存不适用于chmod 755,但适用于777。我该怎么办? [英] Image save doesn't work with chmod 755, but does with 777. What should I do?

查看:80
本文介绍了图像保存不适用于chmod 755,但适用于777。我该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,用户可以在其中裁剪图像。我通常将裁剪的图像保存在带有 755 chmod参数的文件夹下。



但是,当它为755时,它不起作用-当我将chmod改为777时,它可以工作并且我认为777非常不安全,所以我不想使用它。



可能出什么问题了?



<聚苯乙烯该系统的工作原理是这样的。服务器中有一些图片,PHP允许用户裁剪这些图片,当他们单击保存时,应将其保存在 / cropped文件夹中。它适用于777,但不适用于755。

解决方案

文件权限指定文件的所有者可以做什么,其他人可以做什么(组和世界其他地方)。您仍然必须指定正确的所有者。



您可能必须将文件夹的所有者更改为服务器进程的用户(如果使用的是Apache,则可能是www-data)。那么755应该可以工作。



 小丑www-data:www-data /裁剪

编辑:如果 / cropped中包含子文件夹,请使用 chown -R ,您还想更改其权限。


I have a website where users can crop images. I usually save cropped images under a folder with "755" chmod parameters.

However, when it is 755, it doesn't work - It works when I chmod to 777 and I believe 777 is very insecure so I don't want to use it.

What could be wrong?

Ps. The system works like this. There are some pictures in server, PHP allows user to crop those images and when they click save, it should be saved on /cropped" folder. It works with 777 but not with 755.

解决方案

File permissions specify what the file's owner can do, and what others can do (groups, and rest of the world). You still have to specify the correct owner.

You'll probably have to change the folder's owner to your server process' user (maybe www-data, if you're using apache). Then 755 should work.

chown www-data:www-data /cropped

Edit: Use chown -R if there are subfolders inside /cropped and you want to change their permissions as well.

这篇关于图像保存不适用于chmod 755,但适用于777。我该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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