From: Operating system: Ubuntu PHP version: 5.3SVN-2012-03-07 (SVN) Package: *General Issues Bug Type: Bug Bug description:Problems with ssh2_auth_pubkey_file
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 u...@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 :-( -- Edit bug report at https://bugs.php.net/bug.php?id=61320&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61320&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61320&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61320&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61320&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61320&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61320&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61320&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61320&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61320&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61320&r=support Expected behavior: https://bugs.php.net/fix.php?id=61320&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61320&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61320&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61320&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61320&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61320&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61320&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61320&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61320&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61320&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61320&r=mysqlcfg