I was trying to make a passwordless SSH connection to my Mikrotik router (RouterOS 6.49).
There already were some threads about it, like this:
viewtopic.php?f=2&t=38821
And there is a documentation about SSH in Mikrotik:
https://help.mikrotik.com/docs/display/ ... -SSHServer
But for some reason it doesn't work for me.
The steps which I did are as follows:
1. At the first time that I connected to the Mikrotik device, I imported its public key by entering "yes" to the prompt which followed the command:
Code: Select all
$ ssh "$host"
2. I created a public and private key pair with the command:
Code: Select all
$ ssh-keygen -t rsa
"abc" - the private key.
"abc.pub" - the public key.
I uploaded "abc.pub" to the Mikrotik router via HTTP interface.
Then, I associated that public key to my user (assume that my username is "admin"):
Code: Select all
/user ssh-keys import public-key-file=abc.pub user=admin
But when I try to do SSH connection from my PC to the Mikrotik device, then it still asks me for a password:
Code: Select all
ssh -i "/path/to/private/key/abc" "$host"
Note the configuration:
Code: Select all
[admin@Mikrotik] > /ip ssh print
always-allow-password-login: no
I don't understand why it doesn't work.
Has anyone encountered this issue?