问题描述
我有一个网站,用户可以在其中裁剪图像。我通常将裁剪的图像保存在带有 755 chmod参数的文件夹下。
但是,当它为755时,它不起作用-当我将chmod改为777时,它可以工作并且我认为777非常不安全,所以我不想使用它。
可能出什么问题了?
文件权限指定文件的所有者可以做什么,其他人可以做什么(组和世界其他地方)。您仍然必须指定正确的所有者。
您可能必须将文件夹的所有者更改为服务器进程的用户(如果使用的是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。我该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!