invalid privatekey

Questions and answers
ihtarlik
Posts: 4
Joined: Sat May 28, 2022 3:46 am

invalid privatekey

Post 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 id_rsa.pub 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?
User avatar
citypuma
Posts: 1
Joined: Sat May 29, 2021 10:47 am

Re: invalid privatekey

Post 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]
ihtarlik
Posts: 4
Joined: Sat May 28, 2022 3:46 am

Re: invalid privatekey

Post 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:
PubkeyAcceptedKeyTypes=+ssh-rsa

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.
Post Reply