如何使用Amazon EC2中的.pem文件与mosh?

ssh我这样做:

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

我用这个方法试了一下

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

但是我得到的错误:

 /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?). 

我最终需要像这样运行命令:

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

这可以工作,但是我还需要添加一个端口60001的规则,让mosh在安全组下的EC2pipe理控制台中运行。