开发者

linux (centos) privilege to copy file

开发者 https://www.devze.com 2022-12-28 20:37 出处:网络
I need some 开发者_JAVA技巧help with priviligies in centos I have a file in home/admin/public_html/generate.php

I need some 开发者_JAVA技巧help with priviligies in centos I have a file in home/admin/public_html/generate.php

that I want to do some file copy with using php copy function

When I set the file to chown admin:admin generate.php I can access the file but I cannot execute the php copy command because I don't have the proper rights.

When I set the file to root:root generate.php I cant access the file beacuse its under admin user folder home/admin/public_html/generate.php

how do I solve please, thankful for any help.

Bottom line is that I want my generate.php which is owned by admin:admin to be able to copy files from sources outside its home dir and to other home dirs

I am using CENTOS


There are a few things you need to determine to make this work:

  • The userid of the web server process. It's usually httpd or www-data or apache
  • Does that user have access to read the file you're copying?
  • Does that user have access to write to the destination?

Assuming that the web server process is running as httpd, you could run chown httpd destination, where destination refers to the file or directory you're trying to copy into.

To access the file that you're copying, the httpd user needs to be able to access all directories leading to the file, which is controlled by the execute bit (x in the ls -l listing, most likely the last character), as well as have read access to the file itself (r in ls -l)

0

精彩评论

暂无评论...
验证码 换一张
取 消