Page 1 of 1

Shared folder for $HOME?

Posted: 17. May 2012, 04:43
by mike-d
I have VirtualBox v4.1.4 installed under Mac OS X v10.7.4 (host) with a Windows 7 (32-bit) guest. VirtualBox is configured to look to /Users/Shared/VirtualBox for its data, in case that's relevant. Is there any way I can configure the Win7 guest so that, for whomever logs into the Mac, the (Mac) folder represented by $HOME is available to them within the Win7 guest as a shared folder? I don't want to actually create a shared folder for each and every user, just a kind of "template" that will potentially handle any user.

Thanks,
Mike

Re: Shared folder for $HOME?

Posted: 25. May 2012, 22:32
by mike-d
I thought I was onto something with a login hook:

Code: Select all

#!/bin/bash
#+++ This always runs as root +++
# Primary group of user
gname=`id -gn $1`
# Home dir. of user
home=`finger $1|grep Directory|expand|cut -d ' ' -f 2`
# Symlink in /tmp/machome pointing to user's home dir.
ln -F -f -h -s $home /tmp/machome
# Change owner and permission of home symlink for user
chown -h $1:$gname /tmp/machome
chmod -h u+rwx /tmp/machome
# Make sure VirtualBox dir has functional permissions
chmod -R a+rwx /Users/Shared/VirtualBox
In VirtualBox, the Windows VM would have an automatic share pointing to /tmp/machome. Since the system (and the Windows VM, for that matter) is (are) configured without user switching, this would seem to be an easy work-around. I'm apparently not understanding some aspect of this code and/or how a login hook works, though, because this isn't working. (The target of the symlink isn't changing between accounts.) There's all sorts of information on how to implement a login hook elsewhere on the 'Net, so that information isn't included here, but please know that the above code was properly configured as a login hook.

Since an in-box solution is preferred (no pun intended), we're just going to use Parallels. I offer this in case anyone else can adapt/use it.

Regards,
Mike