Can't write to shared folder in ubuntu guest

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Behnil
Posts: 16
Joined: 27. Sep 2009, 13:00
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04, Windows XP SP3
Location: Tabor, Czech Republic

Can't write to shared folder in ubuntu guest

Post 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?
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: Can't write to shared folder in ubuntu guest

Post by Sasquatch »

Can you write to it as root? Are you sure that your user has UID 1000?
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.
Behnil
Posts: 16
Joined: 27. Sep 2009, 13:00
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04, Windows XP SP3
Location: Tabor, Czech Republic

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

Post by Behnil »

Hmm..I can write to it as a root. How can I detect my uid number?
Last edited by Behnil on 16. Oct 2009, 13:46, edited 2 times in total.
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: Can't write to shared folder in ubuntu guest

Post by Sasquatch »

Simply enter id in a terminal. Not all distro's start with 1000 as user ID and group ID.
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.
Behnil
Posts: 16
Joined: 27. Sep 2009, 13:00
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04, Windows XP SP3
Location: Tabor, Czech Republic

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

Post 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?
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: Can't write to shared folder in ubuntu guest

Post 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.
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.
Behnil
Posts: 16
Joined: 27. Sep 2009, 13:00
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04, Windows XP SP3
Location: Tabor, Czech Republic

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

Post 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.
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: Can't write to shared folder in ubuntu guest

Post by Sasquatch »

Try the mount command with rw option added. Did you read my howto?
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.
Behnil
Posts: 16
Joined: 27. Sep 2009, 13:00
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 9.04, Windows XP SP3
Location: Tabor, Czech Republic

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

Post 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.
Post Reply