Mosh works on top of SSH. I used to log in using ssh public key authentication. I use ssh-agent to login:
$ ssh-add ~/.ssh/private_key $ ssh [remote-server-ip]
When I switch to mosh, it's a matter of running
$ mosh [remote-server-ip]
You can still use any existing ssh commands with the --ssh
option. For example, without using ssh-agent my mosh command would be
$ mosh --ssh="ssh -i ~/.ssh/private_key" [remote-server-ip]