是否有可能在使用PECL ssh2扩展(类似于-A ssh命令行选项)时激活代理转发?我找不到任何文档
可以使用phpseclib:
<?php
include('Net/SSH2.php');
include('System/SSH/Agent.php');
$agent = new System_SSH_Agent();
$ssh = new Net_SSH2('website.com');
$ssh->login('user', $agent);
$ssh->read('[prompt']);
$agent->startSSHForwarding($ssh);
$ssh->write("ssh user@domain.tld 'ls -la''n");