php ssh connection phpseclib

前端 未结 1 1878
夕颜
夕颜 2021-01-25 20:52

System: Linux
Server: XAMPP
Goal:
ssh-connection to a server (later: doing some stuff on this server, not part of this question)

Test-Code:

          


        
相关标签:
1条回答
  • 2021-01-25 21:21

    It looks like you are getting output. (M4300-28G-PoE+) > is the output you're getting and you're getting it for both of the commands you're trying to run.

    M4300-28G-PoE+ is a NetGear switch. Switches are fairly notorious for not having full SSH implementations.

    My guess: if you want to run commands you'll have to use phpseclib's interactive commands:

    echo $ssh->read('username@username:~$');
    $ssh->write("ls -la\n"); // note the "\n"
    echo $ssh->read('username@username:~$');
    
    0 讨论(0)
提交回复
热议问题