ssh requires password between systems

32 views
Skip to first unread message

Joaquin Menchaca

unread,
Oct 23, 2015, 4:39:29 PM10/23/15
to Vagrant
What's the easiest way to fix this?  I have a multi-system configuration, when I try to SSH into them on my private network, I am prompted for a password.  Thus inside workstation01, I try "ssh 192.168.50.5", and I am prompted for a password.

My Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.define "work" do |work|
    work.vm.box = "hashicorp/precise64"
    work.vm.hostname = "workstation01"
    work.vm.network "private_network", ip: "192.168.50.4"
  end

  config.vm.define "server" do |server|
    server.vm.box = "hashicorp/precise64"
    server.vm.hostname = "server01"
    server.vm.network "private_network", ip: "192.168.50.5"
  end
end
Message has been deleted

Alvaro Miranda Aguilera

unread,
Oct 23, 2015, 7:27:52 PM10/23/15
to vagra...@googlegroups.com
Hello,

Couple of options.

1. you can tell vagrant to not change the known insecure key.

config.ssh.insert_key = false

and then on each box, just copy the private key, so they will identify
as the vagrant, and should work.

2. Use a post script at the end to that, since at that stage the keys
will have been setup.
Just not usre if will be the same private key for all the boxes, so
you need to make

- each box copy the private
- every box to add the public of the rest and authorized_keys

be sure to set correct permissions at the end

chown -R vagrant: /home/vagrant/.ssh
chmod -R 0600 /home/vagrant/.ssh
chmod 0700 /home/vagrant/.ssh

Hope this helps
Alvaro
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/689d3fad-577f-49ee-9b17-5c7bf253e717%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Joaquin Menchaca

unread,
Oct 23, 2015, 8:43:35 PM10/23/15
to Vagrant
Ultimately, through numerous more complex trials, figured this was the easiest route, using the shell provisioner, placing something like this:

    config.vm.provision "shell", path: "setup-all.sh"    # ssh convenience


The script in question does the following:

cat <<- CONFIGEOF > /etc/ssh/ssh_config
Host server01
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  IdentitiesOnly yes
  User vagrant
  IdentityFile /vagrant/.vagrant/machines/server/virtualbox/private_key
  PasswordAuthentication no
Host workstation01
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  IdentitiesOnly yes
  User vagrant
  IdentityFile /vagrant/.vagrant/machines/work/virtualbox/private_key
  PasswordAuthentication no
CONFIGEOF
echo '192.168.50.4 workstation01' >> /etc/hosts
echo '192.168.50.5 server01' >> /etc/hosts

After this, everything magicaliciously works.
Reply all
Reply to author
Forward
0 new messages