Last Updated: February 25, 2016
·
728
· yanhaoyang

Ssh and scp into a Vagrant box

To scp:

  1. cd <into-vagrant-dir>
  2. vagrant ssh-config > ./vagrant.ssh.config
  3. scp -F vagrant.ssh.config default:/etc/httpd/conf.d/ssl.conf .

To run advanced ssh commands such as creating a tunnel I had no success using the formula above but instead had to use the "long hand" method.

ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ~/.vagrant.d/insecure_private_key vagrant@127.0.0.1 -L 8118:localhost:8080

Copied from: http://minimul.com/ssh-and-scp-into-a-vagrant-box.html