Ubuntu 访问权限 - Mod_Python 权限被拒绝
我正在使用带有 Mod_python 的 Apache Web 服务器运行 Ubuntu。 Web服务器的根目录是/var/www
我有一个用于上传文件的表单。上传的文件应通过Python脚本存储在/var/www/xy/uploads
文件夹中。 但是当我使用这个脚本时,我收到一个错误:
Permission denied: '/var/www/xy/uploads/316.jpg'
这里是代码的相关部分,应该处理接收到的文件:
targetdir_path = "/var/www/xy/uploads"
newid = 316
f = open(os.path.join(targetdir_path,str(newid)+'.jpg'),"w")
我假设上传目录的访问权限存在问题。它们设置为: drwxr-xr-x
谁能解释一下,我需要更改什么?感谢您的帮助!
I am running Ubuntu with an Apache webserver with Mod_python. The root directory of the web server is /var/www
I have a form for uploading files. The uploaded files should be stored in folder /var/www/xy/uploads
by a python script.
But when I use this script, I receive an error:
Permission denied: '/var/www/xy/uploads/316.jpg'
Here the relevant parts of the code, that should handle the received files:
targetdir_path = "/var/www/xy/uploads"
newid = 316
f = open(os.path.join(targetdir_path,str(newid)+'.jpg'),"w")
I assume, there is a problem with the access rights of the uploads directory. They are set to: drwxr-xr-x
Can anyone explain me, what I need to change? Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的目录权限设置为仅允许目录所有者进行写入。
试试这个:
另外,我建议不要使用
mod_python
因为它已被弃用,请改为查看mod_wsgi
。Your directory permissions are set for only allowing writing for the owner of the directory.
try this:
Also, I'd advise against using
mod_python
as it is deprecated, look intomod_wsgi
instead.