Query: ssh2_auth_pubkey_file
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
SSH2_AUTH_PUBKEY_FILE(3) 1 SSH2_AUTH_PUBKEY_FILE(3) ssh2_auth_pubkey_file - Authenticate using a public keySYNOPSISbool ssh2_auth_pubkey_file (resource $session, string $username, string $pubkeyfile, string $privkeyfile, [string $passphrase])DESCRIPTIONAuthenticate using a public key read from a file.PARAMETERSo $session - An SSH connection link identifier, obtained from a call to ssh2_connect(3). o $username - o $pubkeyfile - The public key file needs to be in OpenSSH's format. It should look something like: ssh-rsa AAAAB3NzaC1yc2EAAA....NX6sqSnHA8= rsa-key-20121110 o $privkeyfile - o $passphrase - If $privkeyfile is encrypted (which it should be), the $passphrase must be provided.RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESExample #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 "; } else { die('Public Key Authentication Failed'); } ?>NOTESNote The underlying libssh library doesn't support partial auths very cleanly That is, if you need to supply both a public key and a password it will appear as if this function has failed. In this particular case a failure from this call may just mean that auth hasn't been completed yet. You would need to ignore this failure and continue on and call ssh2_auth_password(3) in order to complete authentication. PHP Documentation Group SSH2_AUTH_PUBKEY_FILE(3)
Related Man Pages |
---|
ssh-keygen(1) - opensolaris |
puttygen(1) - debian |
ssh2_auth_hostbased_file(3) - php |
ssh2_auth_pubkey_file(3) - php |
ssh2_publickey_add(3) - php |
Similar Topics in the Unix Linux Community |
---|
Solaris 10 auth issue |
ssh into home network |
Problem with id_rsa |
ssh-keygen issue on AIX |
Is SSH Key Authentication Disabled? |