PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<ssh2_auth_passwordssh2_connect>
Last updated: Mon, 16 Jul 2012

ssh2_auth_pubkey_file

(PECL)

ssh2_auth_pubkey_file --  Authenticate using a public key

Description

bool ssh2_auth_pubkey_file ( resource session, string username, string pubkeyfile, string privkeyfile [, string passphrase] )

Authenticate using a public key read from a file. If privkeyfile is encrypted (which it should be), the passphrase must be provided.

例子 1. Authentication using a public key

<?php
$connection
= ssh2_connect('shell.example.com', 22, array('hostkey'=>'ssh-rsa'));

if (
ssh2_auth_pubkey_file($connection, 'username',
                        
'/home/username/.ssh/id_rsa.pub',
                        
'/home/username/.ssh/id_rsa', 'secret')) {
  echo
"Public Key Authentication Successful\n";
} else {
  die(
'Public Key Authentication Failed');
}
?>



<ssh2_auth_passwordssh2_connect>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST