chmod in shared folder (on guest machine) has no affect

Discussions related to using VirtualBox on Linux hosts.
Post Reply
staffordt
Posts: 3
Joined: 16. Oct 2008, 00:28

chmod in shared folder (on guest machine) has no affect

Post by staffordt »

No luck finding a previous message on the forums, so I expect this is a silly problem in that I have not set up something right.

I can create/write/read files from both the guest and the host from the shared folder.

Doing a chmod on the guest does not have any affect on the permissions on the items in the shared folder. But chmod does work fine when doing it on the host side.

Host - Ubuntu 8.04
Guest - Ubuntu 8.04

Some relevant info from the vbox log:

04:37:50.865 SharedFolders host service: request to map folder work
04:37:50.865 SharedFolders host service: map operation result VERR_FILE_NOT_FOUND.
04:37:50.873 SharedFolders host service: request to map folder work

04:42:41.887 SharedFolders host service: adding host mapping.
04:42:41.887 Host path /work, map name work, writable 1

04:44:13.221 SharedFolders host service: request to map folder work
04:44:13.221 SharedFolders host service: map operation result VINF_SUCCESS.
04:44:13.221 Mapped to handle 0.

In my guest OS, the following line is in my /etc/rc.local
mount -t vboxsf -o uid=devel work /work&

From VirtualBox console, shared folders,
folder Path = /work
folder Name = work
Read only is NOT checked
Make Permanent IS checked

The folder is under the machine folder list.

Something to ask, does the uid have to match on both the guest and host? In my case, they currently are not.

Not sure what other information to give. I am trying to build an environment in which I can have code in a shared folder and compile it within the guest. Currently I think this is not working because the tests in the configure is failing to execute a test file it creates. Just realized that the guest OS is not properly setting files +x, or any permission.

I would appreciate help from anyone who has seen/heard about this, or any suggestions on what to try. Thanks.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

If you want to change the file permissions/modes, you have to change the mount options. See the man-page of mount for the correct options. It's also mentioned in the manual what options are available.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
staffordt
Posts: 3
Joined: 16. Oct 2008, 00:28

Post by staffordt »

Thanks for the quick reply.

I did not see, and after reviewing do not see anything in the current users manual about setting the proper mount options to allow chmod to work correctly. But I do consider it totally possible that I am dumb and overlooking it. :)

I read the mount man pages, but I am having a difficult time in understanding exactly what options I need to allow chmod to work. Can anyone suggest which options to use?

--edit, are you referring to this section?
"The generic mount options (documented in the mount manual page) apply also.
Especially useful are the options uid, gid and mode, as they allow access by
normal users (in read/write mode, depending on the settings) even if root has
mounted the filesystem."

I assume then that the mode is "what is important", so then my question turns to what value do I need to set here to allow me to change the file permissions within the guest host.

Based on this info, I guess this message should be in the linux guests forum. Oh well.
-- end edit
staffordt
Posts: 3
Joined: 16. Oct 2008, 00:28

solved, i hope

Post by staffordt »

ok, so I did some more searching on the forums, and what search did not find, I found manually looking at each subject line :)

Other posts have described the problem, it really comes down to any host OS to any client OS. Recent versions of VirtualBox have added additional parameters to allow for "mimicking" custom permissions on the guest OS.

This post helped me out the most.
http://forums.virtualbox.org/viewtopic.php?t=6691

But that post's solution fixed one issue, but I appeared to have two.
So I used this command in my /etc/local.rd (talking ubuntu linux here):

sudo mount -t vboxsf -o fmode=557,dmode=557 work /work

note a couple things, I DID NOT set a uid or gid. using fmode and dmode would not change "self" permissions. Therefore if I changed the uid and gid to me, I couldnt write/execute the files, which anyone else could. The fmode and dmode will change, but not exactly as expected, the group permission, but the everyone permission changes as desired, in this case (7/r+x+w). Also note I used dmode, which I do not think was listed in the other forum posts that I found. I got to a point where I could execute and write to existing files in a directory, but I could not create files since the directory permissions were not letting me, dmode fixed this.

The only errors I have seen so far when doing my code builds in unsuccessful attempts to chmod +x things, which I think is okay, since they are created in the guest OS with +x. I will keep my fingers crossed.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

If you want to be able to read/write to the SF, and execute files, all you actually need are the options uid=x,gid=x,rw,exec. With this, you will be the owner of the mounted files, be able to read and write them and they have the execute mask on (so in all, it should be like chmod 777 on every file).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
pajatopmr
Posts: 3
Joined: 6. Sep 2009, 03:57
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: Windows/XP, Fedora, RHEL

Re: chmod in shared folder (on guest machine) has no affect

Post by pajatopmr »

I've been reading nearly everything I can find on this issue since it is adversely affecting me. However it would appear that the scope of those affected is small so I could very well be doing something dumb. In any case here's the behavior:

I am running VirtualBox 3.0.4 on a Fedora 11 x86_64 host. I have a Fedora 11 i586 guest using shared folders. The share is successfully mounted using:

# mount -t vboxsf -o rw,uid=500,gid=100,exec share /path/to/share

I can create and edit files on the share but I cannot change any of the three execute bits on a file in the share using the guest. I did note that the permissions of a newly created file were 700 while the umask was 022.

Unless I've missed something, the options on the -o shown above (mount command) are all that is required in order to be able to modify an execute bit using the chmod command within the guest system.

So unless someone educates me in the next day or so as to my folly, it would appear to be a good idea to file a bug report on this issue. fwiw, I'll be more than happy to supply more information if it will help shed more light...

-pmr
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: chmod in shared folder (on guest machine) has no affect

Post by Sasquatch »

The chmod options only work on Linux native file systems (ext2/3/4, reiserfs, etc). The VB shared folders are not a native file system, so you can't change it. You can't change the file mode on an NTFS or FAT partition either, you have to change the mount options for it. The exec option means that all files will have the execute bit enabled, as I stated above. There is something with the SF module that makes all files you create on the Guest have x00 file modes, where x depends on the mount options used (if you omit exec, it will be 600, else 700).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
pajatopmr
Posts: 3
Joined: 6. Sep 2009, 03:57
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: Windows/XP, Fedora, RHEL

Re: chmod in shared folder (on guest machine) has no affect

Post by pajatopmr »

Sasquatch wrote:The chmod options only work on Linux native file systems (ext2/3/4, reiserfs, etc). The VB shared folders are not a native file system, so you can't change it. You can't change the file mode on an NTFS or FAT partition either, you have to change the mount options for it. The exec option means that all files will have the execute bit enabled, as I stated above. There is something with the SF module that makes all files you create on the Guest have x00 file modes, where x depends on the mount options used (if you omit exec, it will be 600, else 700).
Thanks for your feedback. It is much appreciated. Being in the dark is so uncomfortable and the light you offer is welcome. However, I still see two issues:

1) That "the chmod options only work on Linux native file systems" could be true sounds like a bug to me. Unless you are saying that this is restriction imposed by the guest OS. But that would make no sense at all for Samba or NFS, etc. If it is a VirtualBox restriction in the implementation of shared folders, then I'm curious to know the rationale behind it. I'm still coming up with a bottom line that this inability to use chmod options on a non-native file system is a bug, or at best a feature not yet implemented.

2) I do use the "exec" mount option but I do not see it reflected on the output of the mount command:

# mount -t vboxsf -o "exec,uid=509,gid=100,rw" export /mnt/wurb/export
# mount
...
export on /mnt/wurb/export type vboxsf (uid=509,gid=100,rw)
#

This strikes me as another issue. Perhaps I should be looking in a log file somewhere for helpful information?

fwiw, I do not see the behavior you describe for "exec" reflected when examining file permissions. Some files show execute enabled (via inheritance from the host) and when I change the mode in the host it is reflected on subsequent examination in the guest.

More light shed on these issues would be good.

Thanks,

-pmr
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: chmod in shared folder (on guest machine) has no affect

Post by Sasquatch »

Hmm, how strange. I just fired up my Xubuntu 9.04 VM, mounted an SF with exec option and it too wasn't shown in the mount output. Creating a test file was normal, chmod +x test just worked without issues. It seems that it depends on the Host file system. If it's Linux native, then the options are passed through to the Linux Guest, else you need special mount options like any other FS on Linux. Also, the test file got 755 permissions, instead of 700 (it started with 644, instead of 600).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
pajatopmr
Posts: 3
Joined: 6. Sep 2009, 03:57
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: Windows/XP, Fedora, RHEL

Re: chmod in shared folder (on guest machine) has no affect

Post by pajatopmr »

Sasquatch wrote:Hmm, how strange. I just fired up my Xubuntu 9.04 VM, mounted an SF with exec option and it too wasn't shown in the mount output. Creating a test file was normal, chmod +x test just worked without issues. It seems that it depends on the Host file system. If it's Linux native, then the options are passed through to the Linux Guest, else you need special mount options like any other FS on Linux. Also, the test file got 755 permissions, instead of 700 (it started with 644, instead of 600).
OK, so I will chalk up my observed behavior up to a bug. Not sure where exactly. I'll start with the shared folder implementation in VirtualBox but I'll not be surprised to find out it is a Fedora 11 issue. Never having filed a VirtualBox bug before, I will gladly take suggestions/directions/references otherwise I'll just google "virtual box bugs" and go from there.

Thanks,

-pmr
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: chmod in shared folder (on guest machine) has no affect

Post by Sasquatch »

Check the VirtualBox FAQ for some help. The Bugtracker (separate account needed) is where you report the bug.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply