duanmu8911 2019-03-11 08:47
浏览 308

phpseclib SSH2写入不执行长命令

I am trying to execute an SSH command to a device (firewall). Command is executed when the length is short. When the length is about 1000 characters, command is not being executed.

When I execute the command via putty, that is working as well.

After reading few solutions, I tried to set timeout to 5 seconds. Still, no help.

In the device logs, I can see SSH login and logout. But no activity.

I am using phpseclib ssh version 2.0

$ssh = new SSH2(ip_address);
$ssh->login($user, $password);
$ssh->write($command);
$ssh->setTimeout(5);
$ssh->read()
  • 写回答

2条回答 默认 最新

  • dpxnrx11199 2019-03-11 09:47
    关注

    Juddging the source code of the library https://github.com/phpseclib/phpseclib/blob/master/phpseclib/Net/SSH2.php#L4244 we can see, that the waiting time is in-built in the library, so you do not have to set a timeout.

    If this doesn't work, you can open an issue on the github, providing your command. IF the library is being supported, you'll get a fix or an answer from the library developers.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 opencv 无法读取视频
  • ¥15 按键修改电子时钟,C51单片机