I would like the ability to write the code on my host computer (Mac) and run them on my virtual machine (ubuntu 11). Parallels does not come with a built in way to share ubuntu folders with your Mac like it does for Windows. Using sshfs and openssh-server you can still accomplish it.
First make sure you can log into your virtual machine using ssh and your public/private keys.
1) Install openssh-server on the ubuntu VM
sudo apt-get install openssh-server
2) Make sure you can ssh into your vm
3) Generate ssh key pair. I assume you use the default rsa keys. If you already have keys, you can skip this step.
3) Add your ~/.ssh/id_rsa.pub to your authorized_keys
scp ~/.ssh/id_rsa.pub firstname.lastname@example.org:id_rsa.pub ssh email@example.com mkdir ~/.ssh chmod 700 ~/.ssh cat ~/id_rsa.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
4) You should now be able to login to your VM without supplying your password
5) Install sshfs on your mac. I like to use Homebrew to install my open source software. You need to install fuse and sshfs. If you’ve previously installed MacFus, or OS Fuse, you need to uninstall it for this doc. You can probably get it to work, but this guide won’t tell you how!
brew install fuse4x sshfs
6) Now you should be able to connect to the filesystem of ubuntu. This creates “/Volume/ubuntu” folder that you can open from finder, or terminal, or textmate!
# mount mkdir /Volumes/ubuntu sshfs firstname.lastname@example.org:/home/jason/ /Volumes/ubuntu -oauto_cache,reconnect,defer_permissions,negative_vncache,volname=somename # unmount umount /Volumes/linux
Sometimes your VM will change it’s ip address. If it does, you may need to clear out your ~/.ssh/known_hosts file. It’s ok to just wipe everything out because it’s simply a cache of the keys of the servers you’ve accessed.
Thanks to Philipp Klaus for the sshfs info
Thanks to ubuntu docs for the openssh-server info.