The Emacs Dire mode works for remote files through SSH and FTP. Detailed documentation about how to open remote files from Emacs can be found here. With a proper setting, one can use Emacs to work directly to open files in Virtual Box without having to set the target directory as a shared resource between the host and client. In a previous post, I showed how to add the private key used by Vagrant to access Virtual Box and find out the port number for SSH connection, in this post, you will see how it will benefit you as an Emacs user.
/ssh:vagrant@127.0.0.1#2222:/vagrant:
Once you are in Emacs, use the command “Ctrl x + Ctrl f” to open file just like you would with a local file, then you use the command above to open the remote directory “/vagrant” in a Emacs frame. Of course, this command requires that you have already added the private key to your host SSH key settings and 2222 is the correct port number.