简体   繁体   English

Amazon EC2实例“权限被拒绝(公钥)”

[英]Amazon EC2 instance “Permission denied (publickey)”

All time I used this command to get access to my server via SSH 我一直使用此命令通过SSH访问我的服务器

ssh -i "KeyPair.pem" ubuntu@52.26.255.0

Today I tried the same command and got this error message 今天,我尝试了相同的命令,并收到此错误消息

Permission denied (publickey)

Using -v option I got this message 使用-v选项,我收到此消息

OpenSSH_6.6.1, OpenSSL 1.0.1m 19 Mar 2015
debug1: Connecting to 52.26.255.0 [52.26.255.0] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Jacob\\Google Drive\\KeyPair.pem type -1
debug1: identity file C:\\Users\\Jacob\\Google Drive\\KeyPair.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA e3:51:6f:9a:ed:2f:a2:dd:50:9d:19:a2:0a:f4:88:10
debug1: Host '52.26.255.0' is known and matches the ECDSA host key.
debug1: Found key in /.ssh/known_hosts:2
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\Jacob\\Google Drive\\KeyPair.pem
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

I did not modify my KeyPair.pem file ("Date modified" = 24-Sep-15) 我没有修改我的KeyPair.pem文件(“修改日期” = 15年9月24日)

A very important thing. 一个非常重要的事情。 At last successfully authorized time I executed the next command on the server: 在最后成功的授权时间,我在服务器上执行了下一条命令:

home> chmod -R 777 ubuntu/

Is it possible, that above command ruined my access rights to the server? 上面的命令是否有可能破坏了我对服务器的访问权限?

home> chmod -R 777 ubuntu/ 主页> chmod -R 777 ubuntu /

is the culprit. 是罪魁祸首。 Your /home/ubuntu/.ssh directory has to be 700 and /home/ubuntu/.ssh/authorized_keys has to be 600 . /home/ubuntu/.ssh目录必须为700 ,/ home / ubuntu / .ssh / authorized_keys必须为600 Since they are 777 now, you are out of luck. 由于它们现在是777 ,因此您不走运。 Bur there are ways to restore it. Bur有恢复它的方法。 Search StackOverflow. 搜索StackOverflow。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM