[英]Unable to SSH into EC2 Instance pem 'Permissions 0777 for '.ssh/intuit-tke-qe.pem' are too open'
我無法通過 ssh 進入我的 EC2 實例,這似乎是我傳遞給 ssh 的 ssh .pem 文件的權限級別的問題,谷歌搜索這似乎是許多其他人面臨的問題,但他們的解決方案沒有不適合我。
這是我嘗試過的,請有人幫忙...
嘗試 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).
嘗試 2:
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? 這應該是一件很簡單的事情吧??
將權限更改為chmod 400 ~/.ssh/secure.pem
您需要通過 AWS EC2 管理控制台啟動實例。 啟動后,復制公共 DNS IPv4 並將其粘貼到正在使用的 linux 發行版名稱之后(例如 ubuntu@IPv4)。 此外,請確保您在存放您的私有訪問密鑰的目錄中工作。
為澄清起見,一旦您的 EC2 實例啟動並且您位於包含您的私有訪問密鑰的目錄中,請在命令行中輸入以下內容:
ssh -i private_access_key.pem linux@IPv4
您可以使用pem
密鑰以默認用戶身份登錄嗎? 對於 Ubuntu 實例,默認用戶應該是ubuntu
; 對於大多數其他情況,它應該是ec2-user
。 如果您能夠以默認用戶身份登錄,則很可能不允許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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.