Phing 在权限有限的用户下运行
我以前没有使用过 phing,但想用它来自动化我的部署过程。目前我在 myuser 下登录,Apache 在 www-data 下运行。我的所有应用程序代码均归 myuser 所有,但其他(缓存)文件由 www-data 生成。
我目前通过使用 sudo 删除这些文件来解决这个问题。我想保留 myuser 拥有的应用程序代码,因为通过 ssh 访问文件更容易。我不希望 phing 以超能力运行,因为目前我还不信任这个自动化工具。
在有限的文件权限下使用 phing 的最佳实践是什么?
I have not used phing before, but would like to use it to automate my deployment process. Currently I log in under myuser, Apache runs under www-data. All my application code is owned by myuser, but other (cache) files are generated by www-data.
I currently solve this by using sudo to remove these files. I would like to keep the application code owned by myuser, because it's easier to access the files via ssh. I wouldn't like phing to run with super powers, because at this moment I don't trust this automated tool yet.
What is the best practice to use phing with limited file permissions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有同样的问题。 Apache 作为 www-data.www.data 运行,网络服务器创建的文件为 644,目录为 755。
我通过以下方法解决了这个问题:
Phing 现在能够删除apache 创建的目录和文件
I had the same issue. Apache is running as www-data.www.data and files created by the webserver are 644 and directories 755.
I solved it by:
Phing is now able to remove the directories and files created by the apache
据我了解,问题是 phing 无法对缓存文件执行任何操作,因为它们是由您的 Apache 用户 (www-data) 创建的,并且您以 myuser 身份运行 phing。在我看来,您只需要更改缓存文件的权限,以便 myuser 拥有完整的权限。如何执行此操作取决于应用程序的编写方式,但类似于创建文件后 chmod/chowning 文件或使用允许 myuser 权限的 umask 创建文件。
As I understand it the problem is that phing can't do anything with the cache files since they were created by your Apache user (www-data) and you are running phing as myuser. It sounds to me like you just need to change the permissions on the cache files so that myuser has full permissions. How to do this will depend on how your application is written, but something along the lines of chmod/chowning'ing the files after creation or creating them with a umask allowing myuser permissions.