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:

Using the terminal:

/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:

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):

then click Import SSH Key and the key will be active immediately