Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 无法SSH到EC2实例pem';';的权限0777;。ssh/intuit-tke-qe.pem';太开放了';_Linux_Amazon Web Services_Ssh_Amazon Ec2 - Fatal编程技术网

Linux 无法SSH到EC2实例pem';';的权限0777;。ssh/intuit-tke-qe.pem';太开放了';

Linux 无法SSH到EC2实例pem';';的权限0777;。ssh/intuit-tke-qe.pem';太开放了';,linux,amazon-web-services,ssh,amazon-ec2,Linux,Amazon Web Services,Ssh,Amazon Ec2,我无法ssh到我的EC2实例中,这似乎是我传递给ssh的ssh.pem文件的权限级别的问题,谷歌搜索这似乎是许多其他人都遇到过的问题,但他们的解决方案不适合我 这是我试过的,有人请帮忙 Atempt 1: asemani$ ssh -i ~/.ssh/secure.pem root@54.210.0.1 ******************************************************************************** This is a priva

我无法ssh到我的EC2实例中,这似乎是我传递给ssh的ssh.pem文件的权限级别的问题,谷歌搜索这似乎是许多其他人都遇到过的问题,但他们的解决方案不适合我

这是我试过的,有人请帮忙

Atempt 1:

asemani$ ssh -i ~/.ssh/secure.pem root@54.210.0.1

********************************************************************************
This is a private computer system containing information that is proprietary
and confidential to the owner of the system.  Only individuals or entities
authorized by the owner of the system are allowed to access or use the system.
Any unauthorized access or use of the system or information is strictly
prohibited.

All violators will be prosecuted to the fullest extent permitted by law.
********************************************************************************
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '.ssh/secure.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key ".ssh/secure.pem": bad permissions
Permission denied (publickey).
asemani$ chmod 600 ~/.ssh/secure.pem 
asemani$ ls -l ~/.ssh/
total 56
-rw-r--r--  1 asemani  CORP\Domain Users    782 Apr 29 11:14 config
-rw-------@ 1 asemani  CORP\Domain Users   1696 Apr 29 21:32 secure.pem
asemani$ 
asemani$ ssh -i .ssh/secure.pem root@54.210.0.1
********************************************************************************
This is a private computer system containing information that is proprietary
and confidential to the owner of the system.  Only individuals or entities
authorized by the owner of the system are allowed to access or use the system.
Any unauthorized access or use of the system or information is strictly
prohibited.

All violators will be prosecuted to the fullest extent permitted by law.
********************************************************************************
Permission denied (publickey).
尝试2:

asemani$ ssh -i ~/.ssh/secure.pem root@54.210.0.1

********************************************************************************
This is a private computer system containing information that is proprietary
and confidential to the owner of the system.  Only individuals or entities
authorized by the owner of the system are allowed to access or use the system.
Any unauthorized access or use of the system or information is strictly
prohibited.

All violators will be prosecuted to the fullest extent permitted by law.
********************************************************************************
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '.ssh/secure.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key ".ssh/secure.pem": bad permissions
Permission denied (publickey).
asemani$ chmod 600 ~/.ssh/secure.pem 
asemani$ ls -l ~/.ssh/
total 56
-rw-r--r--  1 asemani  CORP\Domain Users    782 Apr 29 11:14 config
-rw-------@ 1 asemani  CORP\Domain Users   1696 Apr 29 21:32 secure.pem
asemani$ 
asemani$ ssh -i .ssh/secure.pem root@54.210.0.1
********************************************************************************
This is a private computer system containing information that is proprietary
and confidential to the owner of the system.  Only individuals or entities
authorized by the owner of the system are allowed to access or use the system.
Any unauthorized access or use of the system or information is strictly
prohibited.

All violators will be prosecuted to the fullest extent permitted by law.
********************************************************************************
Permission denied (publickey).
我再也没有收到警告,但许可仍然被拒绝。然后,我还尝试在.pem文件上执行
chmod 400
,但也不起作用。我不会把它贴在这里,因为那可能是过分的


这里发生了什么?如何将ssh连接到ec2中?这应该很简单???

您需要通过AWS EC2管理控制台启动实例。启动后,复制公共DNS IPv4并将其粘贴到使用的linux分发名称后(例如。ubuntu@IPv4). 此外,请确保您正在存放您的私人访问密钥的目录中工作

为澄清起见,一旦启动EC2实例并位于保存私有访问密钥的目录中,请在命令行中键入以下内容:

ssh -i private_access_key.pem linux@IPv4

您是否能够使用
pem
键作为默认用户登录?对于Ubuntu实例,默认用户应该是
Ubuntu
;对于大多数其他情况,它应该是
ec2用户
。如果您能够以默认用户身份登录,则
root
不允许
ssh
登录。要更改此设置,请以默认用户身份登录并执行以下操作:

# Edit sshd_config and modify 'PermitRootLogin XX' to 'PermitRootLogin yes'
sudo vi /etc/ssh/sshd_config

# Reload sshd configuration
sudo service sshd reload

将权限更改为
chmod 400~/.ssh/secure.pem

,感谢您的解决方案奏效。我可以以root用户身份登录