简体   繁体   中英

PHP + SSH: Interactive Shell

I am using phpseclib to run commands via SSH on another server . I am currently using the Interactive Shell example (See Here )

If I want to send a command, I use $ssh->write("ls -la\\n"); and then I run $ansi->appendString($ssh->read()); echo $ansi->getScreen(); $ansi->appendString($ssh->read()); echo $ansi->getScreen(); to see the screen output.

Is there a way for me to run commands from a form where can I use it like a web-based console?

Yes why not! Then you have to implement a form and send the command to your server. But there is a much easier way. Perhaps with ajax and fetch the return from your command line.

http://www.web-console.org/

There are a lot of projects doing exact that. When you build that on your own you have to look at security and much more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM