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

SSH Agent forwarding not working during `vagrant provision` on Windows #8415

Closed
geerlingguy opened this Issue Mar 27, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@geerlingguy
Contributor

geerlingguy commented Mar 27, 2017

Vagrant version

Vagrant 1.9.2

Host operating system

Windows 7 / 8

Guest operating system

Ubuntu 14.04

Vagrantfile

Using Drupal VM for testing, but can use a minimal Vagrantfile with just:

config.ssh.forward_agent = true

...

config.vm.provision :shell, :inline => "ssh -Tv git@github.com -o StrictHostKeyChecking=no"

Expected behavior

On macOS 10.12 and Linux (tested on Fedora 25), I get:

...
==> vm: debug1: SSH2_MSG_SERVICE_ACCEPT received
==> vm: debug1: Authentications that can continue: publickey
==> vm: debug1: Next authentication method: publickey
==> vm: debug1: Offering RSA public key: /Users/jeff.geerling/.ssh/id_rsa
==> vm: debug1: Server accepts key: pkalg ssh-rsa blen 279
==> vm: debug1: Authentication succeeded (publickey).
==> vm: Authenticated to github.com ([192.30.253.112]:22).
==> vm: debug1: channel 0: new [client-session]
==> vm: debug1: Entering interactive session.
==> vm: debug1: Sending environment.
==> vm: debug1: Sending env LANG = en_US.UTF-8
==> vm: debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
==> vm: Hi geerlingguy! You've successfully authenticated, but GitHub does not provide shell access.
==> vm: debug1: channel 0: free: client-session, nchannels 1
==> vm: debug1: fd 0 clearing O_NONBLOCK
==> vm: debug1: fd 1 clearing O_NONBLOCK
==> vm: debug1: fd 2 clearing O_NONBLOCK
==> vm: Transferred: sent 3360, received 1800 bytes, in 0.1 seconds
==> vm: Bytes per second: sent 26364.5, received 14123.8
==> vm: debug1: Exit status 1
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Actual behavior

...
==> vm: debug1: Trying private key: /root/.ssh/id_ed25519
==> vm: debug1: No more authentication methods to try.
==> vm: Permission denied (publickey).
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Steps to reproduce

  1. Use Windows (e.g. Cmder/msysgit)
  2. Start the SSH agent (start-ssh-agent)
  3. Run vagrant up or vagrant provision and see if Ansible, shell, etc. provisioners can use pubkey.

On my Mac, the exact same provisioner/Vagrantfile successfully connected. On Windows, it seems that the only way currently to get ssh keys inserted during vagrant up/vagrant provision is using Pageant (e.g. using these instructions).

Note that vagrant ssh works great with Cmder's ssh-agent. I can vagrant ssh then manually run:

$ vagrant ssh
vagrant@local:~ $ ssh -T git@github.com -o StrictHostKeyChecking=no
Hi geerlingguy! You've successfully authenticated, but GitHub does not provide shell access.

Workaround

You can currently get things working by adding your keys to Pageant. But this is annoying and weird (at least to this non-Windows-native user).

References

@chrisroberts

This comment has been minimized.

Member

chrisroberts commented Mar 27, 2017

Should be covered by: #8329

@geerlingguy

This comment has been minimized.

Contributor

geerlingguy commented Mar 27, 2017

Yes, please!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment