4

I am trying to set up Vagrant for my development environment, but are having problems getting Vagrant to automatically connect to a remote server on startup

In my Vagrantfile I have the following line:

config.vm.provision "shell", path: "vagrant/startup.sh", run: "always"

In my startup.sh I have the following:

#!/usr/bin/env bash
sshpass -p '*******' ssh -fN -L 389:XXX.XXX.XXX.XXX:389 ******@********.*******.**.**

The provision runs on startup, but no ports are getting forwarded

If I SSH into the box and run the command, it just returns without any errors, but doesn't work. I can only get it to work if I don't use sshpass

P.S. Please don't tell me about the insecurity of sshpass, this is only used for LAN connections

Adam Honoré
  • 183
  • 8
  • 2
    I ended up using SSH agent forwarding, and sticking with private keys - seems like sshpass doesn't work with port forwards / or running in the background – Adam Honoré May 19 '15 at 11:53

0 Answers0