To login with ssh I do this:

ssh -i ~/.ssh/kp1.pem [email protected]

I tried all this with mosh:

mosh --ssh='ssh -i ~/.ssh/kp1.pem [email protected]'

mosh -i ~/.ssh/kp1.pem [email protected]

But I get the error:

/usr/bin/mosh: could not get canonical name for /home/$USER/.ssh/kp1.pem: Name or service not known
ssh_exchange_identification: Connection closed by remote host
/usr/bin/mosh: Did not find remote IP address (is SSH ProxyCommand disabled?).

1 Answer 1


I ended up needing to run the command like this:

mosh --ssh="ssh -i ~/.ssh/kp1.pem" [email protected]

This works, but I also needed to add a rule for port 60001 for mosh to run on in the EC2 management console under security groups.

You must log in to answer this question.

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