dongxu7408 2015-02-06 10:18
浏览 56
已采纳

从php代码安装debian驱动器

I've been at this for two days now and haven't been able to find any way (good or bad) of doing that to work.

I have to be able of dynamically mounting drives over network from my website's pages (that part is inevitable).

I have no problems doing it directly on the console with the following command

mount -t cifs //IP-REMOTE-MACHINE/Folder -o username=username,password=password /mnt/share

Obviously trying to just do a shell_exec() of this command wouldn't work with no root rights.

I tried to shell_exec() a script in which I would switch to root user (via su or sudo mycommand) but both of them wouldn't work (never been able to succeed in doing a script who would automatically switch my user to root even with the root pwd hard coded (even if that feels an extremely bad idea I could have accepted that atm).

After that I tried to use pmountbut never found a way to access to a remote shared file (don't think it's even possible but I may have missed something here?)

All that is running on a Debian machine with apache2.

  • 写回答

2条回答 默认 最新

  • duanpao4522 2015-02-06 10:25
    关注

    I have a wild idea...

    You could set a cron to run as root that checks for mount commands from your script. The script would simply set a mount command to be processed, and when the cron gets to it, runs the mount, marks the command as processed, and writes to a log file which you could then display.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?