2013-11-26 71 views
0

無法通過Ubuntu連接到SSH。但它在MAC上正常工作。無法通過ubuntu中的配置文件將ssh連接到ec2。權限被拒絕(publickey,gssapi-keyex,gssapi-with-mic)

我的配置文件

Host testserver 
User ubuntu 
IdentityFile '/home/kavin/.ssh/AnotherKey.pem' 
HostName ec2-54-201-xxx-xxx.us-west-2.compute.amazonaws.com 

通過SSH連接

$ ssh testserver 

這是相同的,我沒有爲Mac和我的Ubuntu。它完美地在Mac,但在Ubuntu引發錯誤Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

現在,我嘗試了另一種方法ssh -i '/home/kavin/.ssh/AnotherKey.pem' [email protected]

這工作正常,在Mac和Ubuntu Linux系統。

能否請你告訴我在哪裏出了錯

這些都是$ SSH TESTSERVER -v

OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012 
debug1: Reading configuration data /home/kavin/.ssh/config 
debug1: /home/kavin/.ssh/config line 1: Applying options for testserver 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to ec2-54-200-26-1.us-west-2.compute.amazonaws.com [54.200.26.1] port 22. 
debug1: Connection established. 
debug1: identity file '/home/kavin/.ssh/AnotherKey.pem' type -1 
debug1: identity file '/home/kavin/.ssh/AnotherKey.pem'-cert type -1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1 
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_6.1p1 Debian-4 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-md5 none 
debug1: kex: client->server aes128-ctr hmac-md5 none 
debug1: sending SSH2_MSG_KEX_ECDH_INIT 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ECDSA 90:e1:d7:01:ab:cf:eb:2c:4b:8f:b2:5e:ad:05:a5:b8 
debug1: Host 'ec2-54-200-26-1.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key. 
debug1: Found key in /home/kavin/.ssh/known_hosts:10 
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: '/home/kavin/.ssh/AnotherKey.pem' 
debug1: No more authentication methods to try. 
+0

它看起來像你使用不正確的密鑰。您可以發佈「ssh testserver -v」的輸出 –

+0

添加-v –

+0

的輸出您必須確保AnotherKey.pem是您在創建密鑰對時從AWS下載的密鑰文件。 –

回答

0

正如你所說,

ssh -i '/home/kavin/.ssh/AnotherKey.pem' [email protected] 
從Ubuntu的米

/C日誌作品和ssh testserver失敗。我會建議評論配置文件的其他行,只是保持

IdentityFile /home/kavin/.ssh/AnotherKey.pem 

請確保您刪除引號和路徑應直接可用鍵。

0

轉到終端:

  1. gksu鸚鵡螺(輸入根口令)
  2. 瀏覽到/ etc/SSH/
  3. 複製你的 '鑰匙' 在/ etc/SSH/
  4. 開放ssh_config中
  5. 複製粘貼:

    主機TESTSERVER

    主機名ec2-54-201-xxx-xxx.us-west-2.compute.amazonaws.com

    用戶的ubuntu

    IdentityFile的/ etc/SSH/AnotherKey。PEM

  6. 保存 - 退出

  7. 打開新的終端

  8. 須藤,我

  9. 輸入密碼

  10. CD的/ etc/ssh的

  11. 搭配chmod 400'你的鑰匙'

  12. SSH TESTSERVER

- 確保你的22端口是開放的

https://askubuntu.com/questions/410218/how-to-close-an-open-port-in-ubuntu-12-04

相關問題