php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61320 Problems with ssh2_auth_pubkey_file
Submitted: 2012-03-07 16:06 UTC Modified: 2012-06-14 21:42 UTC
From: joey at teehanlax dot com Assigned: langemeijer (profile)
Status: Closed Package: ssh2 (PECL)
PHP Version: 5.3SVN-2012-03-07 (SVN) OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: joey at teehanlax dot com
New email:
PHP Version: OS:

 

 [2012-03-07 16:06 UTC] joey at teehanlax dot com
Description:
------------
---
From manual page: http://www.php.net/function.ssh2-auth-pubkey-file#refsect1-function.ssh2-auth-pubkey-file-description
---

I've tried every possible combination to get this function to work.  I've ran tests on both rsa and dsa keys and have determined that this function must have a bug related that is preventing it from functioning properly.   I've tested and ensured that my php is running as the proper user and have also used the system command and ensured that i could make a connection from within the PHP file.


Test script:
---------------
system("ssh -i id_rsa user@domain.com");

The above will make a connection to the remote server. However below will not for both rsa and dsa keys:

$server = "domain.com";
$connection = ssh2_connect($server, 22, array('hostkey'=>'ssh-rsa'));
if (ssh2_auth_pubkey_file($connection, 'user', '~/.ssh/id_rsa.pub', '~/.ssh/id_rsa')) {
       echo "success!";
} else {
       echo "no success :-(";
}

I've also tried multiple combinations including adding a pass phrase and verifying permissions and also trying different connection servers.






Expected result:
----------------
success!

Actual result:
--------------
PHP Warning:  ssh2_auth_pubkey_file(): Authentication failed for ubuntu using public key in /home/teehanlax/test-rsa.php on line 9
no success :-(

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-07 19:21 UTC] johannes@php.net
-Package: *General Issues +Package: ssh2
 [2012-06-14 21:42 UTC] langemeijer@php.net
This function does not allow ~ for home dir. Please specify the full path to the 
file.
 [2012-06-14 21:42 UTC] langemeijer@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: langemeijer
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 12:01:30 2024 UTC