首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法通过ubuntu中的配置文件将ssh连接到ec2。拒绝许可(公开密钥,gssapi-keyex,gssapi-with-mic)

无法通过ubuntu中的配置文件将ssh连接到ec2。拒绝许可(公开密钥,gssapi-keyex,gssapi-with-mic)
EN

Stack Overflow用户
提问于 2013-11-26 04:58:36
回答 2查看 1.6K关注 0票数 1

无法通过Ubuntu连接到SSH。但在MAC上效果很好。

我的Config文件

代码语言:javascript
复制
Host testserver
User ubuntu
IdentityFile '/home/kavin/.ssh/AnotherKey.pem' 
HostName ec2-54-201-xxx-xxx.us-west-2.compute.amazonaws.com

通过SSH连接

代码语言:javascript
复制
$ ssh testserver

这和我对Mac和Ubuntu做的一样。它在Mac中运行得很好,但是在Ubuntu中抛出了一个错误Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

现在我尝试了另一种方法-- ssh -i '/home/kavin/.ssh/AnotherKey.pem' ec2-user@54.201.xxx.xxx

这在Mac和Ubuntu中都很好。

你能告诉我哪里出了问题吗?

这些是$ -v的日志

代码语言:javascript
复制
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.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-11-27 13:42:58

就像你说的

代码语言:javascript
复制
ssh -i '/home/kavin/.ssh/AnotherKey.pem' ec2-user@54.201.xxx.xxx

从ubuntu /c工作到ssh testserver失败。我建议对配置文件中的其他行进行注释,只需保留

代码语言:javascript
复制
IdentityFile /home/kavin/.ssh/AnotherKey.pem 

确保,您删除引号和路径应该直接可用的键。

票数 0
EN

Stack Overflow用户

发布于 2015-03-21 20:44:34

Goto终点站:

  1. gksu nautilus (输入您的根密码)
  2. 浏览至/etc/ssh/
  3. 在/etc/ssh/复制您的“密钥”
  4. 开放ssh_config
  5. 复制粘贴: 主机测试服务器 HostName ec2-54-201-xxx-xxx.us-west-2.compute.amazonaws.com 用户ubuntu IdentityFile /etc/ssh/AnotherKey.pem
  6. 储蓄-出口
  7. 开放新终端
  8. 数独-i
  9. 输入密码
  10. cd /etc/ssh
  11. chmod 400“你的钥匙”
  12. ssh测试服务器

-确保你的22个港口是开放的

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20208854

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档