0
我尝试编写一个PHP脚本,该脚本可以通过ssh连接到远程服务器并执行命令。 这是我到目前为止的代码:身份验证失败ssh2_auth_pubkey_file()
$ssh = ssh2_connect($ip,22);
$boolean = ssh2_auth_pubkey_file($ssh, $user, './pubkey.pub', './privatekey.ppk');
$stream = ssh2_exec($ssh, $command);
stream_set_blocking($stream, true);
以下异常我的脚本返回:
Warning: ssh2_auth_pubkey_file() [function.ssh2-auth-pubkey-file]: Authentication failed for $user using public key in file.php
当我用油灰和我的私钥,我可以连接没有任何问题连接。
我用PuttyGen生成了我的.ppk文件中的公钥。
任何人都可以帮忙吗?