简体   繁体   English

使用phpseclib通过PHP创建SSH屏幕

[英]Creating a SSH screen through PHP with phpseclib

I need to start a SSH screen through PHP. 我需要通过PHP启动SSH屏幕。 I have a PHP script in which I am trying to create a screen on my ssh server with the PHP SSH library phpseclib. 我有一个PHP脚本,试图在其中使用PHP SSH库phpseclib在ssh服务器上创建一个屏幕。 This is the function that I am using to try to create the screen: 这是我用来尝试创建屏幕的功能:

 function startscreen($ssh, $user)
 {
      $ssh->exec("screen -S ".$user);
 }

And this is how I am calling the function: 这就是我调用该函数的方式:

startscreen($ssh, $user);

I know I can create screens this way, but it will not work remotely with php. 我知道我可以用这种方式创建屏幕,但是不能用php远程工作。 Thanks 谢谢

Screen needs an actual pty/tty allocated to start in attached mode like you do now. 屏幕需要分配实际的pty / tty,才能像现在一样以附加模式启动。 It'll work better if you start it in detached mode (see the manpage, and see stack overflow if you have more programming questions) 如果以分离模式启动它会更好(请参见手册页,如果还有更多编程问题,请参阅堆栈溢出)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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