Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Created February 1, 2011 17:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardBronosky/806251 to your computer and use it in GitHub Desktop.
Save RichardBronosky/806251 to your computer and use it in GitHub Desktop.
setup your VirtualBox guest to export a folder to you host Mac
if [[ $(uname -a) = *Darwin* ]]; then
echo "Run this from your Linux guest, not your Mac";
else
sudo apt-get install nfs-kernel-server
sudo mkdir /export
sudo chmod a+rwx /export
mkdir /export/devel
sudo mount --bind $HOME/devel /export/devel
cat <<EOF | sudo tee -a /etc/fstab
# added per https://help.ubuntu.com/community/SettingUpNFSHowTo
$HOME/devel /export/devel none bind 0 0
EOF
cat <<EOF | sudo tee -a /etc/default/nfs-kernel-server
# added per https://help.ubuntu.com/community/SettingUpNFSHowTo
NEED_SVCGSSD=no # no is default
EOF
cat <<EOF | sudo tee -a /etc/default/nfs-common
# added per https://help.ubuntu.com/community/SettingUpNFSHowTo
NEED_IDMAPD=yes
NEED_GSSD=no # no is default
EOF
cat <<EOF | sudo tee -a /etc/exports
# added per https://help.ubuntu.com/community/SettingUpNFSHowTo
/export 192.168.56.0/24(rw,fsid=0,insecure,no_subtree_check,async)
/export/devel 192.168.56.0/24(rw,nohide,insecure,no_subtree_check,async,anonuid=1000,anongid=1000,all_squash)
EOF
sudo /etc/init.d/nfs-kernel-server restart
cat << EOF
Now you can mount your devel folder on your Mac in either of the following ways:
via Finder:
Cmd-K and mount nfs://192.168.56.101/export/devel
via CLI:
sudo mount -t nfs -o hard,intr -o -P 192.168.56.101:/export/devel /Network
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment