8

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,

1 Answer 1

9

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]
2
  • 1
    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. Jul 8, 2019 at 14:35
  • @DavidMackintosh interesting point, I didn't even know about. i would use another key from the mosh host to the next hop.
    – alex
    Nov 8, 2022 at 7:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .