普通网友 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 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题