普通网友 2016-10-13 01:00
浏览 382

Apache2服务器以特定用户身份运行脚本

I am using Ubuntu server 12.04 to run Apache2 web server.

I am hosting several webpages, and most are working fine.

One page is running a cgi script which mostly works (I have the python code working outside Apache building the html code nicely.)

However, I am calling a home automation program (heyu) and it is returning different answers then when I run it in my user account.

Is there a way I can...

1 call the heyu program from my python script as a specific user, (me) and leave the rest of the python code and cgi code alone?

2, configure apache2 to run the cgi code, as a whole, as me? I would like to leave all the other pages unchanged. Maybe using the sites_available part.

3, at least determine which user is running the cgi code so maybe I can get heyu to be OK with that user.

Thanks, Mark.

  • 写回答

2条回答 默认 最新

  • dongzizhi9903 2016-10-16 00:24
    关注

    It looks like I could use suEXEC.

    It is an Apache module that is not installed at default because they really don't want you to use it. It can be installed using the apt-get scheme.

    That said, I found the real answer to my issue, heyu uses the serial ports to do it's work. I needed to add www-data to the dialout group then reboot.

    This circumvented the need to run my code as me (as I had already add me to the dialout group a long time ago) in favor of properly changing the permissions.

    Thanks.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿