How to enter SSH private key?

edited October 2014 in Acrosync for Windows
Hi,

I just found Acrosync and tried to use the beta. However, I got stuck with entering (copy-paste) the SSH private key to the text area that opens once the "public key"-checkbox has been checked and I click "Remote directory" to enter the remote directory.

The error messages says:

"Authentication by public key failed: unable to extract public key from private key file: Unable to open private key file"

Which is kind of weird since the UI asked me to enter the private key content, not the its file name. So my question is, which format the private key should be? OpenSSH RSA key? Putty key format? Something else? I tried both Putty and OpenSSH format without success.

I am running Win 8.1 64 bit if that matters.

Jarno



Comments

  • This is a regression bug caused by a build change.

    I uploaded a new build 393 which should fix the bug.  Just reinstall Acrosync from www.acrosync.com.

    The key should be in OpenSSH format.  Both DSA and RSA are supported.

  • I gave up Acrosync last time and returned now after 4 years decided to give it a 2nd try. And surprisingly it still fails on the very same error. My key is OpenSHH private key and I paste it with the '-----BEGIN OPENSSH PRIVATE KEY-----' tags.

    I have generated the key by converting a working Putty private key with puttygen Key-> Conversions -> Export OpenSSH (Force new file format)
  • Exactly the same problem for me...
  • The tag should be '-----BEGIN RSA PRIVATE KEY-----' or '-----BEGIN DSA PRIVATE KEY-----'.  If you select 'Export OpenSSH key' you will get either of these two tags.


    '-----BEGIN OPENSSH PRIVATE KEY-----' is created by 'Export OpenSSH key (for new file format)', which isn't supported.

  • Magic, it works ;-)
  • I am having the same error message in a much later build.

    yyyy/mm/dd tt:tt:tt ACROSYNC_SERVICE Acrosync for windows 1.7 build 611 service started
    yyyy/mm/dd tt:tt:tt SSH_AUTH Authentication by public key failed: Unable to extract public key from private key.

    I have tried the following troubleshooting steps:

    Confirmed working public key authentication with PuTTY on the same machine.
    Create new profile from scratch.
    Copy the key from ssh-keygen -y -f output in a terminal window on a Linux machine instead of using PuTTYgen version 0.73.
    Re-save the private key and public key to disk using PuTTYgen version 0.73 to update file security, in case that matters.
    Switch to a different SSH library as described by gchen in the forum here.

    Is there something else I should try?

    Thank you for any suggestions.



  • @BDT907 make sure the first line of your key file should be '-----BEGIN RSA PRIVATE KEY-----' or '-----BEGIN DSA PRIVATE KEY-----'.  If the key is encrypted by a passphrase you should enter the passphrase in the password field.
  • I found when reviewing the manual that the ssh-keygen command (-y) I was using exported the PUBLIC key, not the PRIVATE key.
    Also, I needed the -e option to be passed in order to get the BEGIN and END lines. And, to get the "RSA" instead of "OpenSSH", I needed to pass -m PEM option.

    I wasn't able to find in my notes how I decided to try that command in the first place. Perhaps I was trying to see if I could manually do what the error message said it could not do.

    "Authentication by public key failed: unable to extract public key from private key file: Unable to open private key file"

    @gchenThanks for the tip about the lines in the key file. Perhaps a clearer error message indicating the incorrect format would be useful?

    I finally realized the problem was with they key material that I had pasted after I looked at the PuTTYgen window and saw that it said "Public key for pasting into OpenSSH authorized_keys file:"

    In the end, I used cat ./private_key in my linux terminal to get the information to paste into the Acrosync window.

    I discovered one other issue when I was doing all of this.

    When switching back and forth to libssh, The "ServerHash" value in the Windows registry changes.  This causes the service (if you are running Acrosync as a service) to pop a window warning you that the server hash value has changed and asking if you still want to connect to the server.  Depending on the system configuration, the service can't show this window to the interactive user, making this problem hard to find and hard to debug. "However, note that the following registry key contains a value, NoInteractiveServices, that controls the effect of
    SERVICE_INTERACTIVE_PROCESS:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows
    When NoInteractiveServices is set to a nonzero value, no service started
    thereafter is allowed to run interactively, regardless of whether it has SERVICE_INTERACTIVE_PROCESS"

Sign In or Register to comment.