Forum und email



ssh2_auth_pubkey_file --  Authenticate using a public key


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.

Příklad 1. Authentication using a public key

= ssh2_connect('', 22, array('hostkey'=>'ssh-rsa'));

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