SSH jumping from Linux to RouterOS to Linux

Hello,
I’m looking for a way to log into a remote Linux, from a local Linux host passing through a RouterOS (6.49) without editing any DNAT rule.

Originating Linux host is called hostA
Relaying RouterOS is called hostB
Destination Linux host is called hostC.

I copied userA SSH key on both hostB and hostC.

I’m typing as userA on hostA, the command bellow:
ssh -J userB@hostB userC@hostC

I was expecting to access userC 's shell on hostC but nothing appears on my hostA console.

My question are:

  1. Does it have a chance to work (I use this daily when hostB is a Linux host) ?
  2. Is it possible to generate a private key, public key for a given user on RouterOS (as I’ve seen a way to import public or private keys but I’not seen anything to generate SSH keys) ?

Best regards

Have you read the fine wiki (RTFW)


https://wiki.mikrotik.com/wiki/Use_SSH_to_execute_commands_(public/private_key_login)
https://wiki.mikrotik.com/wiki/Manual:System/SSH_client#SSH-exec

@olivier2831

  1. yes, for host jump from remote client you need to enable ssh forwarding, set to remote or both, see https://wiki.mikrotik.com/wiki/Manual:IP/SSH
  2. no, generate keys elsewhere and import to ROS[/list]

Thanks: this is what I was after.