douxie3625 2013-05-19 01:14
浏览 68

通过PHP链接SSH命令

I am running a SSH2 command via PHP and am trying to chain the commands to answer the password prompts from the bash script I run.

wget url-to-bash-script
bash name-of-file.sh

After this it will prompt for

MySQL Password:

And:

Retype password:

It will then proceed to install the packages for LAMP

I have tried something like this with no luck;

$ssh->exec( "wget URL;bash installLAMP.sh; password; password");

Thanks!

  • 写回答

1条回答 默认 最新

  • dongyao2022 2013-05-19 02:20
    关注

    What you might want to use is expect

    Here are some examples on how to use it:

    http://www.thegeekstuff.com/2010/10/expect-examples/

    评论

报告相同问题?

悬赏问题

  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退