[英]How to execute a remote bash script from PHP
I need to execute a bash script
on a remote web server from PHP
. 我需要从
PHP
在远程Web服务器上执行bash script
。 The request originates from web1
via PHP and needs to execute a bash script on another web server web2
. 该请求通过PHP从
web1
发起,并且需要在另一个Web服务器web2
上执行bash脚本。 web1
can SSH into web2
all local traffic, but doing SSH via PHP is really nasty, and running exec("ssh user@web2.mydomain.com ./bash_script")
seems like a terrible idea for security. web1
可以通过SSH进入所有本地流量的web2
,但是通过PHP进行SSH确实很讨厌,并且运行exec("ssh user@web2.mydomain.com ./bash_script")
似乎是一个可怕的安全主意。 Also, trying to expose some sort of HTTP interface from a bash script seems like the wrong approach. 另外,尝试从bash脚本公开某种HTTP接口似乎是错误的方法。
What is recommended? 推荐什么? Are there any cross language and remote execution libraries or frameworks?
是否有任何跨语言和远程执行库或框架?
Thinking I could write a simple wrapper in Node.js that executes the bash script and lives on web2
. 认为我可以在Node.js中编写一个简单的包装程序,该包装程序执行bash脚本并位于
web2
。 web1
simply hits the node.js wrapper over HTTP. web1
只是通过HTTP命中了node.js包装器。
Thanks. 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.