How to import SSH key to MikroTik RouterOS for passwordless login

Important: You can not use elliptic curve keys (tested with ed25519) as of RouterOS 7.9 - RSA keys will work!

First, upload the public key to the filesystem of the router using Files - in the following image, the SSH key is listed at the bottom: MikroTik RouterOS Files menu showing uploaded SSH public key file

Using the terminal:

import_ssh_key.rsc
/user/ssh-keys/import user=admin public-key-file=id_mikrotik.pub

Using WebFig or WinBox:

Now go to System -> Users, open the SSH keys tab:

MikroTik RouterOS System Users SSH Keys tab in WebFig

There, click Import SSH Key

open the user you want to add the public key for (typically admin if you didn’t create other users before):

MikroTik RouterOS Import SSH Key dialog selecting user and public key filethen click Import SSH Key and the key will be active immediately


Check out similar posts by category: MikroTik, Networking