Reputation: 87
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?
Upvotes: 3
Views: 14597
Reputation: 53733
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
Upvotes: 7