Maison  >  Article  >  développement back-end  >  unix - 想用php控制linux下其他应用的配置文件,文件权限该怎么做?

unix - 想用php控制linux下其他应用的配置文件,文件权限该怎么做?

WBOY
WBOYoriginal
2016-06-06 20:14:441096parcourir

想用php管理linux下面其他应用的配置文件,比如生成dnsmasq的配置文件。
目前问题是php是跑在apache或nginx下的,运行权限是www-data或者nginx。
而dnsmasq配置文件的权限是root的。
有什么办法能让php临时获得dnsmasq配置文件的读写权限,并且不给php过高的权限,也不给其他进程访问dnsmasq配置文件的读写权限?

回复内容:

想用php管理linux下面其他应用的配置文件,比如生成dnsmasq的配置文件。
目前问题是php是跑在apache或nginx下的,运行权限是www-data或者nginx。
而dnsmasq配置文件的权限是root的。
有什么办法能让php临时获得dnsmasq配置文件的读写权限,并且不给php过高的权限,也不给其他进程访问dnsmasq配置文件的读写权限?

把运行权限加到root组里去

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn