Page 1 of 1

Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 12:56
by Behnil
Hi,
I've installed Ubuntu 9.04 as a guest. I've instaled QuestAdditions and there is setting of my VM:

Code: Select all

PS C:\Program Files\Sun\VirtualBox> .\VBoxManage showvminfo Ubuntu
VirtualBox Command Line Management Interface Version 3.0.8
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Name:            Ubuntu
Guest OS:        Ubuntu
UUID:            186a612f-0f51-422e-87cf-0b83cb1a9b58
Config file:     D:\VirtualOS\Machines\Ubuntu\Ubuntu.xml
Memory size:     512MB
VRAM size:       12MB
Number of CPUs:  1
Boot menu mode:  message and menu
Boot Device (1): DVD
Boot Device (2): HardDisk
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          off
PAE:             on
Time offset:     0 ms
Hardw. virt.ext: on
Nested Paging:   on
VT-x VPID:       off
State:           powered off (since 2009-10-16T10:28:11.822000000)
Monitor count:   1
3D Acceleration: off
Floppy:          empty
SATA:            enabled
SATA 0:          D:\VirtualOS\HardDisks\Ubuntu.vmdk (UUID: ced6181c-68ce-4f7f-a9b9-caaa6
1eb5be1)
IDE Controller:  PIIX4
DVD:             empty
NIC 1:           MAC: 080027A33BE1, Attachment: NAT, Cable connected: on, Trace: off (fi
le: none), Type: Am79C973, Reported speed: 0 Mbps
NIC 2:           MAC: 0800279FB932, Attachment: Host-only Interface 'VirtualBox Host-Onl
y Ethernet Adapter', Cable connected: on, Trace: off (file: none), Type: Am79C973, Repor
ted speed: 0 Mbps
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
UART 1:          disabled
UART 2:          disabled
Audio:           disabled
Clipboard Mode:  Bidirectional
VRDP:            disabled
USB:             enabled

USB Device Filters:

<none>

Shared folders:  

Name: 'Ubuntu_box', Host path: 'C:\Users\Behnil\Desktop\Ubuntu_box' (machine mapping), w
ritable

Guest:

Statistics update:                   disabled
In the Ubuntu_box folder on the host is a text file.
I've mount this shared folder in ubuntu like this : sudo mount -t vboxsf Ubuntu_box /home/behnil/Plocha/Box. I can see the text file a I can read it also. The problem is, that I can't write into it. I can't even create any new folder inside the Box folder, it says "Permission denied".
I've tried sudo mount -t vboxsf -o uid=1000,gid=1000 Ubuntu_box /home/behnil/Plocha/Box, but no success :(

Do anybody know what's wrong?

Re: Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 13:02
by Sasquatch
Can you write to it as root? Are you sure that your user has UID 1000?

Re: Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 13:27
by Behnil
Hmm..I can write to it as a root. How can I detect my uid number?

Re: Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 13:45
by Sasquatch
Simply enter id in a terminal. Not all distro's start with 1000 as user ID and group ID.

Re: Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 13:48
by Behnil
Hmm..the result is my UID is really 1000.

I don't understand it, because ls -l say :

Code: Select all

dr-xr-xr-x 1 root   root      4096 2009-10-16 13:37 Box
so how can I write to it as root, when root is an owner and there is written that owner has only read an execute permissions. And the next mysteriousness is that sudo chmod 777 Box change nothing, permissions stay same like above.

Do you have another idea?

Re: Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 13:53
by Sasquatch
Change the ownership of the mount point to your user. Maybe this makes it work properly. Chmod and chown in the shared folder don't work, you have to make that possible through the mount options, just as you would when mounting NTFS manually or through fstab.

Re: Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 14:02
by Behnil
Change the ownership of the mount point to your user.
What does it mean? I'm new in linux :oops:

When I use sudo mount -t vboxsf -o uid=1000,gid=1000 Ubuntu_box /home/behnil/Plocha/Box, then ls -l shows

Code: Select all

dr-xr-xr-x 1 behnil behnil    4096 2009-10-16 13:37 Box
so I suppose nobody can write to it. But I don't know how to change it when chmod doesn't work.

Re: Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 14:25
by Sasquatch
Try the mount command with rw option added. Did you read my howto?

Re: Can't write to shared folder in ubuntu guest

Posted: 16. Oct 2009, 17:19
by Behnil
Yes, I did. I tried sudo mount -t vboxsf -o uid=1000,gid=1000,rw Ubuntu_box /home/behnil/Plocha/Box and also sudo mount -t vboxsf -o uid=1000,gid=1000 -w Ubuntu_box /home/behnil/Plocha/Box, without effect.