PHP ssh2_auth_pubkey_file(): Authentication failed using public key: Invalid key data, not base64 encoded

前端 未结 2 1208
予麋鹿
予麋鹿 2020-12-19 12:06

In PHP5.3.3 (on CentOS and apache2) I am attempting to connect to a SFTP via a php script. The code grabs the keys and server details from the constructor

fu         


        
2条回答
  •  無奈伤痛
    2020-12-19 12:24

    Well, it figures, I find the answer after asking the question openly. Found this on another site with dev comments.

    d23d23 at gmail dot com said: "The public key must be on one line starting with the key type, 1 space and followed by the keydata (no newlines) and not followed by comments. This is a limitation of libssh2, so remove any excess data from the file after creating it with your key generation tools."

    So even though I used openssl to create the private key and public key, I had to edit it to put it all on one line with the key type as noted above. Thanks.

提交回复
热议问题