NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
[resolved] SSH public/private key authentication


Joined: 10 Mar 2008
Posts: 33
Reply with quote
Hi,

I've recently purchased PhpEd 5.2 Professional and I'm having immense trouble getting SSH authentication working correctly.

I have an SSH RSA key generated using PuTTYgen. The public-key side of the key is configured on the server, and I have a pass-phrase on the private key-file which is stored on my PC.

This works great in PuTTY but I cannot get PhpEd to log in (SSH terminal) using this configuration - it just keeps saying "permission denied" and prompting for a login password. The one thing that's confusing me is that PhpEd is asking for a public-key file or a hosts file, but the file I have on my client PC is a private key file.

I've also tried another key without the pass-phrase but no joy. Does anyone have a walk-through to set up public/private key authentication in the terminal?

Many thanks,

Andy
View user's profileFind all posts by mailnet_ukSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
It's correct, client needs private and public keys while server needs only public one. That's why it's called public-key-authentication.
First you need to check "Public Key (ssh2)" on the Keys tab->SSH Defaults (see accounts window), then remove all pre-generated keys and add your private key into Host key files field and your public key into Public identity files input. You may also update Certificate access pass phrase or leave it empty. In latter case, IDE will ask you for the pass phrase each time you log in.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 10 Mar 2008
Posts: 33
Reply with quote
Hi Dmitri,

The private-key file I was using was specific to PuTTY which I hadn't realised. I've got it working in PhpEd now.

For anyone else in the same predicament, I had to export the key from PuTTYgen using the "Conversion" -> "Export OpenSSH Key" menu option, and add the exported file to PhpEd as my public key file. I haven't needed a host key file.

Thanks,

Andy
View user's profileFind all posts by mailnet_ukSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Quote:
I haven't needed a host key file.

I'd recommend you to check your key file then. In some cases, private key and public one are added to the same file one by one. It's also supported by PhpED but may break security if you copy it into your server as server needs only public key, nothing else.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 10 Mar 2008
Posts: 33
Reply with quote
dmitri wrote:
Quote:
I haven't needed a host key file.

I'd recommend you to check your key file then. In some cases, private key and public one are added to the same file one by one. It's also supported by PhpED but may break security if you copy it into your server as server needs only public key, nothing else.


Nope. The PuTTY key file stores both, but only so it can be read back by PuTTYgen. When it authenticates it only sends the private part.
As you can see below, the server only has the public hash, and my private key only the private part.

In my private key file used by PhpEd:

Code:
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: x,ENCRYPTED
DEK-Info: xxxxxxx

xxxx PRIVATE KEY DATA xxxx
-----END RSA PRIVATE KEY-----


In the authorized_keys file on the server:

Code:
ssh-rsa xxxx PUBLIC KEY DATA xxxx Andy Shellam NetServe Support
View user's profileFind all posts by mailnet_ukSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Quote:
When it authenticates it only sends the private part

it should never send private key, only public one Smile, the one you added to authorized_keys.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 10 Mar 2008
Posts: 33
Reply with quote
dmitri wrote:
Quote:
When it authenticates it only sends the private part

it should never send private key, only public one Smile, the one you added to authorized_keys.


Oooh yeah true, my bad lol
View user's profileFind all posts by mailnet_ukSend private messageVisit poster's website
[resolved] SSH public/private key authentication
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic