Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 8139  / 1 Year ago, mon, november 28, 2022, 9:25:24

I used the Vagrant image for 13.04 from http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-i386-vagrant-disk1.box to create a new virtual machine and tried to connect to it using ssh. However, the SSH always disconnected immediately, without even getting to the stage where it tried to authenticate.



I opened the VM in the VirtualBox GUI and looked at the SSH log file (auth.log). It was full of lines like this:



Jul 25 17:57:02 vagrant-ubuntu-raring-32 sshd[898]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Jul 25 17:57:02 vagrant-ubuntu-raring-32 sshd[898]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Jul 25 17:57:02 vagrant-ubuntu-raring-32 sshd[898]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Jul 25 17:57:02 vagrant-ubuntu-raring-32 sshd[898]: fatal: No supported key exchange algorithms [preauth]


The problem was solved by executing the following commands:



sudo ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa
sudo ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
sudo ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa


I would assume that these should run automatically at some point, especially given that (a) I did not have to run them myself when I installed Ubuntu from an ISO image, and (b) because Vagrant is supposed to be designed that after you run vagrant up you can immediately use the VM without any additional configuration.



I may need to create a large number of Virtual Machines in the near future and I was hoping that I could use Vagrant to do it, but I can't do it if I'm going to have to manually fix SSH on each one.



Does anyone know why this happens and what can be done to fix it? Should I report it as a bug?


More From » ssh

 Answers
0

This appears to have been a bug in the older base boxes. In the current base box images (generated August 20th, 2013), the keys appear to be created automatically when the box boots up for the first time.


[#30200] Tuesday, November 29, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rinstracte

Total Points: 221
Total Questions: 114
Total Answers: 120

Location: France
Member since Fri, Jan 28, 2022
2 Years ago
rinstracte questions
Wed, Jun 15, 22, 02:09, 2 Years ago
Tue, Jan 24, 23, 01:39, 1 Year ago
Wed, Jun 9, 21, 04:34, 3 Years ago
Sun, Apr 17, 22, 11:38, 2 Years ago
;