Page 1 of 1

SSH RSA Mikrotik to Mikrotik not working

Posted: Fri Jul 28, 2023 6:57 pm
by DottorT86
Hi everybody,
As you can guess from the title I have a problem connecting two Mikrotik using SSH with RSA inside Winbox.
I did a lot of tests and I try to summarize them.

I generated the RSA key pair with PuTTY Key Generator:
Type of key generated: RSA
Number of bits in generated key: 2048

I exported both the public key and the private key (I tried to export the private key both with and without the password but nothing changed).
I exported the private key in both PPK and OpenSSH format.

I configured the two Mikrotiks with the same "admin" account and "12345678" password.
In the first Mikrotik (client) I imported the private key for the admin user:
user/ssh-keys/private/import private-key-file=admin_rsa user=admin
In the second Mikrotik (server) I imported the public key for the admin user:
user/ssh-keys/import public-key-file=admin_rsa.pub user=admin
If I connect to the "server" from a PC using PuTTY and the PPK key I am able to connect.
Instead, when I connect to the "server" from the Mikrotik "client" I am immediately disconnected.
If I try to connect from Tools->Telnet->SSH the window opens and immediately says "Disconnected".
If I try to connect from terminal:
system/ssh address=x.x.x.x user=admin
after a few seconds I get the message "Welcome back!".

Re: SSH RSA Mikrotik to Mikrotik not working

Posted: Fri Jul 28, 2023 10:30 pm
by serafin
have you tried as below?
/ip ssh
set always-allow-password-login=yes
Ser@fin

Re: SSH RSA Mikrotik to Mikrotik not working

Posted: Sat Jul 29, 2023 8:38 am
by DottorT86
Yes, using the password it works but I would like to use it with RSA without a password because I would like to use ssh-exec.

Re: SSH RSA Mikrotik to Mikrotik not working  [SOLVED]

Posted: Sat Jul 29, 2023 3:24 pm
by mantouboji
which version do you use?

7.8 is OK, 7.9 is broken, 7.10 is broken when import new private key, 7.11beta7 corrected .

Downgrade to 7.8, clear all private key, and re-import private key, and then upgrade to 7.10.2, will work.

Re: SSH RSA Mikrotik to Mikrotik not working

Posted: Mon Jul 31, 2023 6:49 pm
by DottorT86
You're great!
I'm using 7.10.2 and it doesn't work but using 7.8 it's ok!
Thank you very much!!!