dongshan2004 2015-03-31 03:25
浏览 45

登录后更改webserver用户

I am having trouble in accessing files on the server. exec(whoami) returns apache. However, files that I have to read and write through PHP scripts have a username as ben like this:

-rw-r--r-- 1 ben staff 1000 Mar 27 17:54 backup_1.sql
-rw-r----- 1 ben staff 2000 Mar 27 17:54 backup_2.sql

Setting write permission to apache on this subdirectory will do the job, but then I am concerned of security.

On my website, I have a login system. Is there a way to change a webserver user to ben upon logging-in to a specific account in database, say admin? Is it even possible to change the webserver username from apache to something else?

  • 写回答

1条回答 默认 最新

  • douju3911 2015-03-31 03:46
    关注

    Is it even possible to change the webserver username from apache to something else?

    You need to change the User and Group directive in Apache configuration file. In Ubuntu the main configuration file is /etc/apache2/httpd.conf

    User ben 
    Group staff
    

    Restart Apache

    sudo /etc/init.d/apache2 restart
    
    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP