Can't write to shared folder

Discussions related to using VirtualBox on Linux hosts.
Post Reply
3beezer
Posts: 11
Joined: 23. Nov 2009, 19:21
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Ubuntu 9.10, DSL, Mer

Can't write to shared folder

Post by 3beezer »

A recent thread (45884) discussed the exact problem I am having, but the solution in that case was to start over with a new VM. It would be painful to do that in my case.

I am trying to use the shared folder capability. The host is Ubuntu Server and the guest is Ubuntu Desktop (10.10 in both cases). VBoxManage is version 4.1.8r75467. I have VBoxGuestAdditions version 4.1.8 installed in the guest.

I created a shared folder using

VBoxManage sharedfolder add guest-os --name shared-folder --hostpath /usr/share/shared-folder/

I mount it from within guest-os using

sudo mount -t vboxsf -o uid=1000,gid=1000 shared-folder /mnt/shared-folder

I am able to read the contents of the folder, but when I try to create a file I get

$ touch test2
touch: cannot touch `test2': Protocol error

When I try to delete a file I get

$ rm test
rm: cannot remove `test': Operation not permitted

The user is in the vboxsf group. Permissions in the shared folder are 644. I get the same error messages when I run the commands as root.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't write to shared folder

Post by Perryg »

What happens if you use a non-system folder instead, like a folder in your ~/home?
What does ls -al say about the groups and owners of the /usr/share
3beezer
Posts: 11
Joined: 23. Nov 2009, 19:21
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Ubuntu 9.10, DSL, Mer

Re: Can't write to shared folder

Post by 3beezer »

Yup. You got it. The system folder and its contents are owned by root. If I make a copy of the folder and change the ownership to the user, then the shared folder works perfectly.

So, is there a way to share a folder owned by root, or is doing so a security breach?

Thanks for the help.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Can't write to shared folder

Post by Perryg »

Sure there is always a work-around, but it is a major security risk.
Post Reply