Vagrant ssh prompts 'no kex alg' and I'm unable to connect to the virtual machine

31,970

Solution 1

I just had this same issue for a couple days a finally found a way to fix this. I know its a old topic but just incase other people will experiance the same issue. this is how you can solve it:

edit your sshd_config and add:

KexAlgorithms diffie-hellman-group1-sha1

this is what fixed it for me (obviously restart ssh after that)

Solution 2

I guess something was done wrong in the box - when you look the history https://vagrantcloud.com/ubuntu/boxes/vivid32 there has been a few boxes released in short time. I just downloaded the box today and it is working as expected.

I suggest you update the box and you will get the latest version

vagrant box update --box ubuntu/vivid32
Checking for updates to 'ubuntu/vivid32'
Box 'ubuntu/vivid32' (v20151001.0.0) is the latest version

Solution 3

you should go to your vagrant using putty or anything

after that

sudo nano /etc/ssh/sshd_config

go to bottom line and put

KexAlgorithms diffie-hellman-group1-sha1

after that ctrl+o and enter and ctrl+x

go back to your windows and reload vagrant

then try

ssh [email protected] -p 2222

Hope this help you

Share:
31,970

Related videos on Youtube

Ville Miekk-oja
Author by

Ville Miekk-oja

Updated on August 10, 2020

Comments

  • Ville Miekk-oja
    Ville Miekk-oja almost 4 years

    I'm trying to connect to a vagrant with a command vagrant ssh as instructed in the official vagrant documentation. Earlier I used older ubuntu as a virtual machine: config.vm.box = "hashicorp/precise32". During that time, issuing a command vagrant ssh did let me connect to the machine with just a username and password.

    Now I changed the vagrant box to a newer one because I wanted newer nodejs. Currently, the box is: config.vm.box = "ubuntu/vivid32". Now with this box, if I run the vagrant, and try to connect to the machine with vagrant ssh, it does not let me, but instead it will prompt no kex alg. I read somewhere it has to do with authentication using keys. How could I connect to the new ubuntu with vagrant ssh? One option could be to just regularly connect to the box.

    • Ali
      Ali over 8 years
      Only the provider of the box can tell you how they have configured SSH access to the box. I believe Vagrant documentation recommends a user vagrant and password vagrant be setup to allow vagrant ssh to work. The person who provides the box should hopefully follow these guidelines. Also look at config.ssh.private_key_path in vagrant docs.
    • Jakuje
      Jakuje over 8 years
      what is hour host system and ssh version? If you use some old one, some algorithms were deprecated in recent version.
    • Ville Miekk-oja
      Ville Miekk-oja over 8 years
      OpenSSH_3.8.1p1, OpenSSL 0.9.7d 17 Mar 2004. Windows 7 Profession SP1
  • Paul Allsopp
    Paul Allsopp about 7 years
    Thanks lauw. Worked for me
  • CJ Kepinsky
    CJ Kepinsky about 7 years
    Windows 10. Added it to C:\Program Files\OpenSSH\etc\sshd_config, didn't work.
  • lauw
    lauw about 7 years
    @chrisKepinski this is a ubuntu topic i dont know exactly what your trying to do in windows 10. my problem was that i could login my virtual machine with ssh connection. so i logged in with virtualbox then edit the file.... restart the service and then i was able to make a ssh connection