How can I do the job of .ssh keys with mosh?

4

1

I'm looking at migrating from ssh + screen to mosh, and I was wondering what (if any) ways of using mosh can satisfy a use case of securely shelling in to a remote server without typing out credentials like a password. (If it matters, I am trying to use mosh from a Linux Mint VM.)

What (if any) is the standard mosh way to have hands-free authentication?

Thanks,

Christos Hayward

Posted 2016-06-01T20:39:25.763

Reputation: 753

Answers

4

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]

hanxue

Posted 2016-06-01T20:39:25.763

Reputation: 2 354

I'm going to suggest that he was hoping for full agent behavior -- that is, load the key on his main host and then be able to forward it along with his chain of ssh hops as he goes. My understanding (and experimentation today) is that this is not possible -- mosh does not forward agent information on to child ssh sessions because it doesn't know how to. – David Mackintosh – 2019-07-08T14:35:25.390