cURL sftp public key authentication fails “Callback Error”

时光毁灭记忆、已成空白 提交于 2019-12-01 06:40:24

There are cases (debian-based distros) when your libssh2 is built with libgcrypt. In those, use PEM-encoded private key file:

$ openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem

ppk is a putty putty private key, you need to export it as an open ( using puttygen go Conversations-> export OpenSSH )

You might have better luck with phpseclib, a pure PHP SFTP implementation. eg.

<?php
include('Net/SFTP.php');

$sftp = new Net_SFTP('www.domain.tld');
if (!$sftp->login('username', 'password')) {
    exit('Login Failed');
}

// puts a three-byte file named filename.remote on the SFTP server
$sftp->put('filename.remote', 'xxx');
?>
Elias Kouskoumvekakis

libssh2 in Debian distributions (e.g Ubuntu LTS 14.04) uses libgcrypt which doesn't support passphrases. Use a key without a passphrase or generate a PEM key as described by Alexander's answer.

More information can be found on the following link: Trying to connect using ssh2_auth_pubkey_file()

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!