|
|
Posted by Royan on 10/27/07 10:09
On 27 , 01:35, Jeremy <jer...@pinacol.com> wrote:
> Royan wrote:
> > I'm trying to make use of ssh2_auth_pubkey_file() and login into
> > remote machine.
>
> > I've read somewhere that in order to make that function work I have to
> > supply it with public key with specific format due to limitation of
> > libssh2. The public key should look like this: <key_type>{1 space
> > character}<key_data>
>
> > Well it still does not work even if I change my public key file. Says
> > "Authentication failed for <user_name> using public key" Can somebody
> > help me and perhaps give an idea where to look next?
>
> > Yes, unfortunately i can not use any other way of logging in to the
> > remote PC, so username/password is not an option for me
>
> Are you sure you have all the pieces in place for this? For it to work,
> you must:
>
> 1) Have the public key installed on the remote server in the user's
> authorized_keys file. The file (and sometimes the whole directory) must
> have appropriate permissions (typically 600) or the server may ignore it.
>
> 2) Have both the private and public keys on the local machine (I'm not
> sure why they require the pubkey, but they do). If the private key is
> encrypted, you must also pass the passphrase to ssh2_auth_pubkey_file.
>
> I have done this successfully without monkeying with the key files, so I
> doubt that is your issue. Did you use OpenSSH to generate the keys? If
> not, they could be in the wrong format - but you almost certainly did
> use OpenSSH so the keys should be OK. I'm betting it's a problem on the
> remote server (permissions) or the private key being encrypted.
>
> Jeremy
Well the thing is that I have used that private key to generate my
public key (did that using PuTTYgen) I do not mention that I've added
public key to "authorized_keys" file and now i successfully login to
the remote server (using PuTTY) with this particular public key that I
use in my php script. So i assume this is not a problem of incorrect
permissions. Perhaps it happens because I use ssh-dss key type instead
of ssh-rsa key?
[Back to original message]
|