3

I want to connect with a vagrant machine with different user instead of Vagrant also want to use another username and password instead of using keys. Also, I want to know is it possible to use ssh vagrant vm from another vm running in same machine. If so, how to do that?

2
  • 1
    can you clarify use ssh vagrant vm from another vm running in same machine ? Commented Sep 8, 2015 at 10:11
  • It mean that am running two vms A and B hosted in same machine. I want to connect to machine A from machine B.
    – abinesh s
    Commented Sep 8, 2015 at 12:04

1 Answer 1

7

Vagrant has a few options (see full doc https://docs.vagrantup.com/v2/vagrantfile/ssh_settings.html) :

Vagrant.configure("2") do |config|
  config.ssh.username = "user"
  config.ssh.password = "password"
end

note indeed, you need to make sure those users exist on the guest os (generally most vagrant box are created with vagrant user)

To have the connection between your different VMs, you can easily do that if you assign fix IP to the VM.

Vagrant.configure("2") do |config|
  config.vm.network :private_network, ip: "192.168.45.15"
end

when you connect to your second VM, you can run ssh [email protected] and it will ssh to the first VM

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.