Thursday, June 24, 2010

Virtual Box –folders sharing-Permission problem.

 

While sharing folders between host and a virtual machine using Virtual box, Sometimes you may face the problem that after a folder is shared to the virtual machine from host machine you don't find execute permissions on the files shared and if you try to set the execute permissions with chmod command that don't work.

Here is an ugly way to make that work, if you are good at coding then you can  edit the vboxvfs kernel module (the joys of open source!).

NOTE: Do the steps at ur own risk..!!!

How to:
1. mount the VBoxGuestAdditions.iso (e.g. /media/cdrom0)
2. mkdir vbox && cd vbox && /media/cdrom0/VBoxLinuxAdditions.run --tar -xf
3. edit module/vboxvfs/utils.c, change line 96 "mode |= mode_set (IXUSR);" to "mode |= S_IXUSR;" (note addition of "S_" prefix... basically, always set executable flag)
4. sudo ./install.sh vfs-module
5. cd .. && rm -rf vbox

This sets the executable flag in the guest only (mode 700) for all shared files — the host still always gets mode 500 for newly created files. Hopefully a dev can make a proper fix. (slight improvement: set executable on new file creation, and keep file permissions in sync otherwise so non-executables in the host don't show up as executable in the guest)

But at least this lets you to do some development within a shared directory...

 
Things You Should Know About Linux !!!