Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handshake error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [publickey none], no supported methods remain #1517

Closed
joegoggins opened this issue Sep 20, 2014 · 5 comments

Comments

@joegoggins
Copy link

How do you use Packer to build base AMI's that you can build other specific packer generated AMIs on top of? SSH KeyPair issues are tripping me up and I'm not sure if this is a bug, or that I'm misusing the tool.

I'm trying to build a "base centos" AMI with packer first, then use the generated AMI as the source_ami for other packer .json machine templates. Though my base centos image appears to work correctly, when I reference the generated AMI in subsequent templates, I can't get past the SSH login part. I doesn't appear that the public key from the AWS keypair gets copied to the machine correctly. Oddly, if I use the private key generated from the initial "base centos" machine to login to the new machine it works.

I've tried following this advice: http://stackoverflow.com/questions/22204001/how-does-ec2-install-the-public-key-from-your-keypair and on the new machine (that uses the "base centos" as source_ami) I define a user_data_file like:

mkdir -p /root/.ssh
chmod -R 600 /root/.ssh
curl -s -o /root/.ssh/authorized_keys http://169.254.169.254/2011-01-01/meta-data/public-keys/0/openssh-key
chmod 600 /root/.ssh/authorized_keys

(which should copy the public key from the newly generated key-pair where it needs to be to authenticate via ssh)

Any tips or insight into how to proceed would be greatly appreciated.

Thanks!

-joe

@joegoggins
Copy link
Author

Note: This issue DOES NOT happen with an Ubuntu AMI that uses a "ubuntu" user for the login. Thus, the scope of the bug is likely limited to AMIs that link the keypair with the "root" user as opposed to a provisioning user (i.e. "ubuntu" or "ec2-user").

@kyptin
Copy link

kyptin commented Oct 4, 2014

I ran into the same problem, and what fixed it for me was changing the ssh_username in my .json template from ubuntu to ec2-user. I found the solution in #788.

@mitchellh
Copy link
Contributor

As @kyptin said, please set the proper user/pass. This error is a bit bad but that is the core of the issue is that the authentication is failing. The good news is that Packer was able to talk to the server, so that means you're almost there!

@Vishal-Gaur
Copy link

Hi All,

I'm also facing this issue, please suggest.

root@gfs1:/etc/heketi# heketi-cli topology load --json=/etc/heketi/topology.json

Found node gfs1 on cluster 8f207c20e4470125f11b3a98306c98a8
	Adding device /dev/vda1 ... Unable to add device: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
Creating node gfs2 ... Unable to create node: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Thanks

@rickard-von-essen
Copy link
Collaborator

Hi @Vishal-Gaur, thanks for reaching out.

This ticket is really old so it's probably not relevant to the issue you're seeing.

To ask for general help use IRC #packer-tool on Freenode or the mailing list for that.

See https://www.packer.io/community/

Thanks!

@hashicorp hashicorp locked as resolved and limited conversation to collaborators Mar 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants