VirtualBox

Ticket #1776 (reopened defect)

Opened 5 months ago

Last modified 2 weeks ago

No execute permission on file in shared folder, Mac host, Linux guest

Reported by: Paul Assigned to:
Priority: major Component: shared folders
Version: VirtualBox 1.6.2 Keywords: execute, shared folder
Cc: Guest type: Linux
Host type: Mac OS X

Description

Virtualbox 1.6.2 on MacOSX. The guest is Linux (Ubuntu, hardy heron). In a shared folder, I created hello.c. On the guest, I compiled it, but the execute permission is missing:

   vbox:/mac$ gcc hello.c
   vbox:/mac$ ls -l                                                     
   -rw------- 1  6362 2008-06-18 10:26 a.out
   -rw------- 1    79 2008-06-18 10:13 hello.c                   

Manually setting the x bit does not work:

   vbox:/mac$ chmod +x a.out                                            
                                                                              
   vbox:/mac$ ls -l                                                     
   -rw------- 1  6362 2008-06-18 10:26 a.out
   -rw------- 1    79 2008-06-18 10:13 hello.c                   

However, running the "chmod +x a.out" on the mac does properly change the mode and allows the guest to run the binary:

   vbox:/mac$ ls -l                                                     
   -rwx--x--x 1  6362 2008-06-18 10:26 a.out
   -rw------- 1    79 2008-06-18 10:13 hello.c                   
                                                                              
   vbox:/mac$ ./a.out                                                   
   Hello from C                   

Change History

(follow-up: ↓ 3 ) 07/07/08 15:20:50 changed by frank

  • host changed from other to Mac OS X.
  • guest changed from other to Linux.

07/09/08 22:35:15 changed by frank

  • owner changed.
  • component changed from other to shared folders.

(in reply to: ↑ 1 ) 07/31/08 19:26:46 changed by DaveK

Replying to frank:

Those new host/guest settings are unduly restrictive. I can reproduce the exact same problem on a windows XP host with an ubuntu guest.

(in reply to: ↑ description ) 07/31/08 19:33:56 changed by DaveK

Replying to Paul:

Virtualbox 1.6.2 on MacOSX.

VB 1.6.0 on WinXp? here. Same problem.

The guest is Linux (Ubuntu, hardy heron).

Same guest.

In a shared folder, I created hello.c. On the guest, I compiled it, but the execute permission is missing:

Exact same here, but there's no way to set the execute perm even from the host side. I made sure the ACL for the directory gave full control to the "Everyone" user, no difference; I checked the ACL for the generated a.out itself, it had correctly inherited full control for everyone, still couldn't be executed from the guest side.

Just in case, I tried unmounting the shared folder and remounting it with the 'exec' option. Still no luck.

08/02/08 21:03:17 changed by ejtttje

I agree the 'host' field is overly restrictive, this is a more general problem. For windows, vboxfs probably needs to support fmask or umask so files can be executable by default. For OS X, vboxfs should allow upstream modification of the flags on the host. I expect this problem also exist on Linux hosts.

(follow-up: ↓ 8 ) 08/02/08 22:16:31 changed by ejtttje

As an ugly workaround, I have edited the vboxvfs kernel module (the joys of open source! Otherwise I'd be screwed on monday! :)

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 me do development within a shared directory...

08/04/08 02:16:28 changed by DaveK

ejtttje, thanks a million! I have tested your fix on my setup and it works for me too. You saved me hours of grepping through the sources, I wouldn't even have known whether to look at the host or guest end of things to start with! I owe you virtual beer, cheers!

(in reply to: ↑ 6 ) 08/12/08 08:12:55 changed by Mjalik

Virtualbox 1.6.2 on WinXP. The guest is Linux (Kubuntu, hardy). After this:

Replying to ejtttje:

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

Installation ends with error:

/tmp/vbox.l/utils.c:96: error: 'RTFX_UNIX_S_USER' undeclared (first use in this function)

/tmp/vbox.l/utils.c:96: error: (Each undeclared identifer is reported only once

/tmp/vbox.l/utils.c:96: error: for each function it appears in.)

/tmp/vbox.l/utils.c:96: error: 'S_S_IXUSR' undeclared (first use in this function)

08/13/08 02:13:34 changed by Mjalik

Oh, sorry, my bad. I have done mistake. Instead of "mode |= S_IXUSR;" I entered "mode |= mode_set (S_IXUSR);". All works fine.

08/20/08 14:26:46 changed by frank

Starting with 1.6.6 there will be some additional filesystem options which can be specified when mounting a shared folder into a Linux guest:

  • umask will specify all bits which should be cleared for every file/directory
  • dmask same as umask for directories only
  • fmask same as umask for regular files only
  • dmode will specify the mode for every directory in the shared folder
  • fmode same as dmode for regular files.

So specifying

mount -t vboxsf -o fmode=555

will make every file have r+x bits set. Note that the vboxvfs kernel module still ignores read/write permissions of the files, that is, if the file is readable by the on the host the file will be readable on the guest as well, same for write, regardless of the file permissions inside the guest.

09/02/08 14:47:41 changed by frank

  • status changed from new to closed.
  • resolution set to fixed.

(follow-up: ↓ 18 ) 11/03/08 21:54:36 changed by XBigTK13X

  • status changed from closed to reopened.
  • resolution deleted.

The fix listed (using -o arguments) does not solve the issue on my system:

Windows Vista Ultimate 32-bit Host GNULinux Ubuntu 8.1 32-bit guest

Able to mount a shared folder, but unable to run compiled C++ compiled binary executables within the code directory. ls -l Reports no exec permissions granted, regardless of options used during mount. Directory mounted has full permissions on Windows machine. Unable to add exec permissions to any user (including root).

11/03/08 21:55:48 changed by XBigTK13X

Also, VB version 2.0.4.

11/03/08 23:41:42 changed by Titantux

The workaround by "ejtttje" it is working for VB version 2.0.4 as well. I did it on Ubuntu 8.10 guest, Vista Prof host.

11/04/08 00:33:24 changed by XBigTK13X

My third attempt at a fix was using ejtttje's workaround. However, the GNULinux guest additions installation failed at the file system build, with errors similar to the ones posted by Mjalik. I am changing the correct line to what was described as the fix, but this does not suppress the error (neither the "incorrect" or "corrected" posts by ejtttje)

11/04/08 04:56:22 changed by Titantux

I had a problem like... Unable to build the kernel module. See the log file /var/log/vboxadd-install.log... but was when I left the line as following:

mode |= mode_set (S_IXUSR);

But, when I just left as below, it works...

mode |= S_IXUSR;

11/04/08 04:58:23 changed by XBigTK13X

I apologize for not posting my solution earlier, but Titantux is correct, I reached the same conclusion through trial and error a little while ago.

(in reply to: ↑ 12 ) 11/06/08 19:09:39 changed by frank

Replying to XBigTK13X:

The fix listed (using -o arguments) does not solve the issue on my system: Windows Vista Ultimate 32-bit Host GNULinux Ubuntu 8.1 32-bit guest

Actually this works fine here. Vista Ulimate host, Debian guest (both 32-bit). Are you sure that you updated the guest additions? What happens if you create a file on that share, does it have exec permissions?

11/06/08 19:17:13 changed by XBigTK13X

Ubuntu guest for me, but shouldn't make a difference. The mount script prior to editing the file system module had the proper switches for mounting with exec permission, but execution was still not possible.

11/07/08 09:53:28 changed by frank

Does anybody else have this problem with VirtualBox 2.0.4?

11/10/08 17:04:32 changed by pauloc

I'm not sure if what's happpening to me is the same issue you are talk about here, sorry if not. I work on a Ubuntu host, XP guest. Whenever I edit or create a file on the XP guest, it looses its execution permisions. I'm just scripting php on Dreamweaver against Ubuntu's apache, but it's werd to change file permisions every time I save a file on XP guest. Well, not only werd, it's imposible to work this way. And yes, I'm on 2.0.4 version.

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy