Trying to achieve passwordless access via ssh, following the 3 steps from https://wiki.mikrotik.com/wiki/Use_SSH_ ... o_RouterOS
First I tried with a dedicated user, failed, tried with default admin, failed. Here for simplicity lets talk about admin.
Issues:
- Can't access passwordless having installed "to_MikroTik.pub" key;Code: Select all
ssh -i ~/.ssh/to_MikroTik admin@192.168.88.1
- Can't access with password - "Permission denied, please try again.". I copy password from a password manager, no typos, but ssh doesn't let me in, whereas I can access via webfig, delete ssh key atCode: Select all
ssh admin@192.168.88.1
System -> Users -> SSH Keys
and then I can againwith passwordCode: Select allssh admin@192.168.88.1
Commands:
Code: Select all
ssh-keygen -t rsa -m PEM -f ~/.ssh/to_MikroTik
Double Enter for empty passphrase.
Code: Select all
cd ~/.ssh/
ftp 192.168.88.1
put to_MikroTik.pub
^D
ssh admin@192.168.88.1
user ssh-keys import public-key-file=to_MikroTik.pub
^D
Wiki has it:
Code: Select all
user: admin-ssh
If I understand it right, I should be able to passwordlessly ssh into MikroTik with:
Code: Select all
ssh -i ~/.ssh/to_MikroTik admin@192.168.88.1
or passwordlessly execute commands e.g. see leases with:
Code: Select all
ssh -i ~/.ssh/to_MikroTik admin@192.168.88.1 ip dhcp-server lease print
So, what is the way to make it happen?
Also, Wiki:
Code: Select all
3) Now from either Winbox or terminal mode you need to import the key.