I've understood that private RSA key of client must be copied into ~/.ssh/authorized_key of server
Just proven this works for a passwordless login from debian client to debian server.
Now, what RSA key of mikrotik should I use to be copied into server authorized_key ??
If I cannot issue a RSA key from routerboard, is this definitely not going to work ?
! RESET !
My fault :
the authorized_key file must be enabled (uncommented) in /etc/ssh/sshd_config on server :
AuthorizedKeysFile %h/.ssh/authorized_keys
So:
Server side:
Generate a key pair :
ssh-keygen -t RSA -m PEM -f mikrotik
(hit enter at passphrase prompt for the empty password)
Copy the .pub key into authorized_keys:
cat mikrotik.pub >> ~/.ssh/authorized_key
Copy both keys (via scp, ssh, whatever_you_want) to routerboard file folder.
Routerboard side:
Import the private key:
/user ssh-keys private import private-key-file=mikrotik public-key-file=mikrotik.pub user=admin
(hit enter at passphrase prompt for the empty password)
Done !
You can login to remote server via
/system ssh user=<user> <host>
or
/system ssh-exec address=<address> user=<user> command="putyourcommandhere"