I would like to be able to connect via SSH from mikrotik to the Linux server.
For this I need to add an ssh key to be able to login without a password.
I follow the instructions from Wiki
https://wiki.mikrotik.com/wiki/Use_SSH_ ... key_login)
so
I log in to the linux server, execute the command
, I am not giving passphrasessh-keygen -t rsa -m pem
I uploaded the generated keys to RouterOS.[user@server ~/.ssh]$ ssh-keygen -t rsa -m pem
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:qSfhmyyq66ARmOLYEssYRIMEQm9LnyXbYawiIgd4fKo user@server
The key's randomart image is:
+---[RSA 3072]----+
|B= |
|=.o . |
|o.o+.. = |
|o+ooo O .. |
|X.oo =..S |
|OO. .. o |
|Eo. + . |
|oo .. = |
|=+.. .+ |
+----[SHA256]-----+
[user@server ~/.ssh]$
I added publickey to ROS.
From Linux I can log into Mikrotik without using a password.
Now I have done point 7, i.e.
The keys are imported without any problem or errorImport both keys for the user:
/user ssh-keys private import user=remote private-key-file=mykey public-key-file=mykey.pub passphrase=""
According to Wiki, this is the end of the configuration, but I have a problem because I can't log in from Mikrotik on Linux
What else should I do?[user@Dude_v2] > system ssh user=user address=IP command="ip a"
password:
Welcome back!
[user@Dude_v2] > system ssh-exec user=user address=IP command="ip a"
failure: authentication failure
[user@Dude_v2] >