I need to login from routerboard (ssh client or ssh-exec) into a debian system without password.
I have generated a RSA key pair into Debian system and copied both into ./ssh/authorized_keys
I have copied those keys into routerboard and correctly imported
When I try to login into Debian it still asks for password (and , anyway, once correct password is given it says wrong password)
Where am I wrong ??
Should I perhaps do the opposite : generate RSA pair into routerboard and import into Debian ??
You can not generate ssh key pair on RouterOS device. Please give some more specific information, for example output of “/user ssh-keys private print” and logs.
As far as my knowledge goes you must use the public key, of the key used on the routerboard device, on the debian system and configure the debian sshd to authorize logins by keys.
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.