2013-09-03 18:08:28 +00:00
|
|
|
---
|
2016-01-19 18:08:53 +00:00
|
|
|
layout: "docs"
|
2013-09-06 16:50:43 +00:00
|
|
|
page_title: "Synced Folders - Getting Started"
|
2013-09-03 18:08:28 +00:00
|
|
|
sidebar_current: "gettingstarted-syncedfolders"
|
2016-01-19 18:08:53 +00:00
|
|
|
description: |-
|
|
|
|
While it is cool to have a virtual machine so easily, not many people
|
|
|
|
want to edit files using just plain terminal-based editors over SSH.
|
|
|
|
Luckily with Vagrant you do not have to. By using synced folders, Vagrant
|
|
|
|
will automatically sync your files to and from the guest machine.
|
2013-09-03 18:08:28 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Synced Folders
|
|
|
|
|
|
|
|
While it is cool to have a virtual machine so easily, not many people
|
|
|
|
want to edit files using just plain terminal-based editors over SSH.
|
2016-01-19 18:08:53 +00:00
|
|
|
Luckily with Vagrant you do not have to. By using _synced folders_, Vagrant
|
2013-09-03 18:08:28 +00:00
|
|
|
will automatically sync your files to and from the guest machine.
|
|
|
|
|
|
|
|
By default, Vagrant shares your project directory (remember, that is the
|
|
|
|
one with the Vagrantfile) to the `/vagrant` directory in your guest machine.
|
2016-01-20 20:37:40 +00:00
|
|
|
|
2016-02-03 15:02:09 +00:00
|
|
|
If your terminal displays an error about incompatible guest additions (or no
|
|
|
|
guest additions), you may need to update your box or choose a different box such
|
|
|
|
as `hashicorp/precise64`. Some users have also had success with the
|
|
|
|
[vagrant-vbguest](https://github.com/dotless-de/vagrant-vbguest) plugin, but it
|
|
|
|
is not officially supported by the Vagrant core team.
|
2016-01-20 20:37:40 +00:00
|
|
|
|
2013-09-03 18:08:28 +00:00
|
|
|
Run `vagrant up` again and SSH into your machine to see:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ vagrant up
|
|
|
|
...
|
|
|
|
$ vagrant ssh
|
|
|
|
...
|
2016-01-19 18:08:53 +00:00
|
|
|
vagrant@precise64:~$ ls /vagrant
|
2013-09-03 18:08:28 +00:00
|
|
|
Vagrantfile
|
|
|
|
```
|
|
|
|
|
|
|
|
Believe it or not, that Vagrantfile you see inside the virtual machine
|
|
|
|
is actually the same Vagrantfile that is on your actual host machine.
|
|
|
|
Go ahead and touch a file to prove it to yourself:
|
|
|
|
|
|
|
|
```
|
2016-01-19 18:08:53 +00:00
|
|
|
vagrant@precise64:~$ touch /vagrant/foo
|
|
|
|
vagrant@precise64:~$ exit
|
2013-09-03 18:08:28 +00:00
|
|
|
$ ls
|
|
|
|
foo Vagrantfile
|
|
|
|
```
|
|
|
|
|
|
|
|
Whoa! "foo" is now on your host machine. As you can see, Vagrant kept
|
|
|
|
the folders in sync.
|
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
With [synced folders](/docs/synced-folders/), you can continue
|
2013-09-03 18:08:28 +00:00
|
|
|
to use your own editor on your host machine and have the files sync
|
|
|
|
into the guest machine.
|
2014-12-19 15:38:56 +00:00
|
|
|
|
2016-01-19 18:08:53 +00:00
|
|
|
## Next Steps
|
|
|
|
|
|
|
|
You have successfully interacted with your host machine via synced folders on
|
|
|
|
the guest machine. Read on to learn about installing packages, users, and more
|
|
|
|
with [provisioning](/docs/getting-started/provisioning.html).
|