【问题标题】:packer build cannot ssh to aws instance打包程序构建无法 ssh 到 aws 实例
【发布时间】:2016-12-18 04:10:47
【问题描述】:

以下配置将启动一个实例但无法连接它...但相同的密钥、vpc-id、子网 id 和安全组 id 在测试厨房中正常工作。

{
  "variables": {
  "aws_access_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "aws_secret_key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
    "builders": [{
        "type": "amazon-ebs",
        "access_key": "{{user `aws_access_key`}}",
        "secret_key": "{{user `aws_secret_key`}}",
        "region": "us-east-1",
        "source_ami": "ami-146e2a7c",
        "instance_type": "t2.micro",
        "ssh_username": "ubuntu",
        "ami_name": "packer-example {{timestamp}}",
        "ssh_keypair_name": "xxx",
        "ssh_private_key_file": "xxx.pem",
        "vpc_id": "vpc-xxxxxxx",
        "subnet_id": "subnet-xxxxxxx",
        "security_group_id": "sg-xxxxxxx",
        "associate_public_ip_address": "true"

    }]
}

我收到以下调试错误:

2016/12/17 20:10:50 packer: 2016/12/17 20:10:50 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported methods remain
2016/12/17 20:10:50 packer: 2016/12/17 20:10:50 [DEBUG] Detected authentication error. Increasing handshake attempts.
2016/12/17 20:10:57 packer: 2016/12/17 20:10:57 [INFO] Attempting SSH connection...
2016/12/17 20:10:57 packer: 2016/12/17 20:10:57 reconnecting to TCP connection for SSH
2016/12/17 20:10:57 packer: 2016/12/17 20:10:57 handshaking with SSH
2016/12/17 20:10:59 packer: 2016/12/17 20:10:59 handshake error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2016/12/17 20:10:59 packer: 2016/12/17 20:10:59 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2016/12/17 20:10:59 ui error: ==> amazon-ebs: Error waiting for SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2016/12/17 20:10:59 ui: ==> amazon-ebs: Terminating the source AWS instance...

鉴于这在没有额外变量的测试厨房中有效,我想知道我缺少什么?有什么想法吗?

【问题讨论】:

  • 您确定使用相同的 SSH 公钥启动了 ec2 实例?您不可能在实例上放置错误的公钥吗?这就是这通常的意思。
  • 问题已解决 - 默认用户名错误 :)
  • @TyMac 那么您应该回答自己的问题并将您的回答标记为已接受。

标签: amazon-web-services ssh packer


【解决方案1】:

问题是错误的默认用户名。

【讨论】:

    【解决方案2】:

    我通过不忘记添加 public_key_pair(aws 帐户)解决了这个问题 我有相同的错误消息“amazon-ebs:等待 SSH 时出错:ssh:握手失败:ssh:无法验证,尝试的方法 [none publickey],没有支持的方法”,问题是我忘记提供 SSH_KEYPAIR_NAME码头化的打包机。添加kaypair名称后,现在可以使用了!

    【讨论】:

      猜你喜欢
      • 2017-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-08
      • 1970-01-01
      • 2021-08-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多