39
votes

vagrant ssh -- EXTRA SSH ARGS is supposed to allow extra args to be passed to ssh.

vagrant ssh -- -t 'cd /var/www' should ssh into vagrant and change directory to /var/www, but doesn't. Instead it returns

ssh: Could not resolve hostname ls: nodename nor servname provided, or not known

What am I missing?

2

2 Answers

93
votes

This works for me:

vagrant ssh -- -t 'cd /var/www; /bin/bash'
17
votes

To run a command to a vagrant box remotelly run:

vagrant ssh -c "COMMAND; COMMAND1"

If you need, try vagrant ssh --help