Page 1 of 1

invalid privatekey

Posted: Sat May 28, 2022 3:58 am
by ihtarlik
I used ssh-keygen to create a public/private keypair on my server to use for logging in without a password. I copied the id_rsa keyfile to my android phone, and added the text from to ~/.ssh/authorized_keys.

When I go onto PowerFTP Pro, I edit host, select Login Mode=SSH key, and locate id_rsa on my device. However, when I attempt to login to server, it fails with error:

invalid privatekey
Failed to create connection

When I load the id_rsa file into ConnectBot, it loads properly and I can login without using a password. This is how I know the keypair is properly authorized on the server for the username. Yet PowerFTP Pro fails. Any ideas?

Re: invalid privatekey

Posted: Thu Jul 14, 2022 7:20 pm
by citypuma
Hi ihtarlik.

Unfortunately PowerFTP does not (yet) support openssh private key.
You need to use a rsa private key for key authentication.

To convert an existing file(Don't forget to backup the file):
On a Linux machine you need to ensure the permissions:
chgrp users [key-file]
chmod 600 [key-file]

Windows and Linux:
ssh-keygen -p -f [key-file] -m pem

To create a new rsa key:

Linux and Windows (Parameter -f is optional):
ssh-keygen -t rsa -b 4096 -m pem -f [path_to_save_file]

Re: invalid privatekey

Posted: Tue Jul 19, 2022 7:19 am
by ihtarlik
I tried converting my current OpenSSH key into RSA, then exporting the RSA's public key to my server's authorized_keys file, yet the connection still failed.

I tried generating a keypair using your instruction, and adding the public key to the server's authorized_keys file, yet the connection still failed.

A review of /var/log/auth.log showed the following error:
Jul 19 08:53:28 host sshd[14732]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

I added the following to /etc/ssh/sshd_config:

Then it worked perfectly.

sshd --version gave the following info in case other users with similar systems need to locate this post:
OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022

I am running Ubuntu 22.04 with latest updates.