drj26159 2013-09-08 11:47
浏览 70

无法为php文件上传设置正确的文件权限

I know that there are a lot of similar questions, but just hear me out and if this was a silly question and there was nothing new about it, i'll just delete this question.

I'm trying to upload using php, but I get permission denied. So here's what I did to solve it and didn't work:

first of all, this is localhost, so i can't set the owner of the files to apache, because I won't be able to edit them. So I got the apache user name in php, and it was www-data

I created a new group called 'localhostowners'

I added my own user to this group

I added www-data to the group

when I run

grep -i 'localhostowners' /etc/group

I get

localhostowners:x:1001:mnvoh,www-data

And then I set the file permissions for everything on the localhost dir to 764 and set the owner with this:

sudo chown -R mnvoh:localhostowners localhostdir

But now I can't execute the php scripts hence the 4. although according to what I know, the 6 should be affecting apache, since I set the group on the files. What am I doing wrong here???

Thanks everybody :)

  • 写回答

2条回答 默认 最新

  • doudiewen9435 2013-09-08 11:56
    关注

    Test with:

    sudo chown -R mnvoh:localhostowners localhostdir
    sudo chmod 764 -R localhostdir
    

    -R: recursivity

    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)