我需要允许在我的当地网络服务器上使用PHP文字,允许SSH向另一台机器提供特定任务,处理某些档案。 www.un.org/Depts/DGACM/index_spanish.htm 作为<条码>的
现在我这样做的方法是,要有一个最起码的双管齐下手套,可以把双管齐下(作为我)放在文件根基之外。 印本反过来又打电话(作为我)说,PHP代码实际从事SSH工作,并印刷其产出。 这部法典。
read_remote_files.php
(我从我的浏览器打字):
exec( sudo -u me -n /home/me/run_php.sh /path/to/my_prog.php , $results);
print $results;
/home/me/run_php.sh
(作为我,我说的是:
php $1 2>&1
www.un.org/Depts/DGACM/index_spanish.htm
_www ALL = (me) NOPASSWD: /home/me/run_php.sh
This all works, as my_prog.php is called as me and can SSH as me. It seems it s not too insecure since run_php.sh
can t be called directly from a browser (outside document root). The issue I m having is that my_prog.php
isn t called as an HTTP program so doesn t have access to the HTTP environment variables (DOCUMENT_ROOT etc).
两个问题:
- Am I making this too complicated?
- Is there an easy way for my final script to get the HTTP variables?
Thanks! Andy