过了一会儿,不能ssh到亚马逊aws ec2机器

我已经阅读了几个类似的问题,并检查我的用户名是Ubuntu,因为我正在运行的Ubuntu实例,我的Pem键是400的权限和.ssh文件夹是.600

ssh -i ~/.ssh/my-key.pem ubuntu@myserver -v OpenSSH_6.7p1 Ubuntu-5ubuntu1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /home/me/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to myserver [myserver] port 22. debug1: Connection established. debug1: key_load_public: No such file or directory debug1: identity file /home/me/.ssh/my-key.pem type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/me/.ssh/my-key.pem-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1 

我真的迷失在这里,希望得到一些帮助。

自从这个问题提出已经很长时间了,但我刚刚解决了同样的问题。

首先,.ssh文件夹的权限必须是0700,不能是600

 $ chmod 0700 ~/.ssh 

其次,服务器安装在Amazon EC2实例上,使用公司的域mycompany.cxx ,一个Elastic Load Balancer和SSLconfiguration。 出于某种原因,名称myserver.mycompany.cxx不起作用。

 $ ssh -i ~/.ssh/my-key.pem [email protected] 

我可以使用EC2configuration中的公共DNS名称来解决它:

 $ ssh -i ~/.ssh/my-key.pem [email protected]