Share permissions/ownerships seem useless

Discussions related to using VirtualBox on Linux hosts.
Post Reply
SteveC1
Posts: 30
Joined: 7. Nov 2019, 07:33

Share permissions/ownerships seem useless

Post by SteveC1 »

Ubuntu host, ubuntu client, VirtualBox 6.0.14

I was finally able to create a share and look into it. (I finally realized that the share must be mounted by/within the guest; simply creating the share doesn't do this.)

The problem is, on the guest it belongs to root (group root) and thus I can't create files in it, not without going through the entire directory structure and changing permissions to 777 (oddly enough that works even without doing sudo!). Sudo chown and sudo chgrp do not change the ownership of the shared folder.

Furthermore any new document I create on the host within the share ends up with 664 permissions on the guest, and I have to do a chmod on it on the guest.

This is going to become quite tiresome. Is there some way to do this so that the user on the guest machine actually CAN write to a writeable share without going through this rigamarole?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: share permissions/ownerships seem useless

Post by mpack »

SteveC1 wrote:I finally realized that the share must be mounted by/within the guest; simply creating the share doesn't do this.
That depends on the guest. I don't need to mount shares in any of my VMs, because I'm happy to browse to them via the VBoxSVR network branch.

Linux permissions are not really relevant to an SMB share, which is an implementation of Windows network storage. Maybe during a session permissions will be emulated by a Samba driver, but I wouldn't expect them to survive a VM restart: I mean, where would they be stored? If you want a share to behave like a Linux filesystem then perhaps SMB isn't what you need.
SteveC1 wrote: any new document I create on the host within the share ends up with 664 permissions on the guest, and I have to do a chmod on it on the guest.
Speaking of which, I imagine you may be talking GA shared folders rather than SAMBA. GA shared folders allow you to copy files into and out of a VM. They aren't designed for complex uses. For that you should configure an SMB share or whatever Linux only equivalents there may be.
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Share permissions/ownerships seem useless

Post by socratis »

SteveC1 wrote:Ubuntu host, ubuntu client, VirtualBox 6.0.14
The Host and the Guest don't have versions?
SteveC1 wrote:I was finally able to create a share and look into it
VBoxSF, SMB, NFS, other?
SteveC1 wrote:I finally realized that the share must be mounted by/within the guest
Mounted how?
SteveC1 wrote:on the guest it belongs to root (group root) and thus I can't create files in it
If VBoxSF and automounted, you need to add your user to the 'vboxsf' group of the Guest. From the related chapter in the User Manual:
Access to an automatically mounted shared folder is granted to everyone in a Windows guest, including the guest user. For Linux and Oracle Solaris guests, access is restricted to members of the group vboxsf and the root user.
If VBoxSF and not auto-mounted, you need to modify the entry in your /etc/fstab.
SteveC1 wrote:any new document I create on the host within the share ends up with 664 permissions on the guest
That's to be expected, that's the default.
SteveC1 wrote: Is there some way to do this so that the user on the guest machine actually CAN write to a writeable share without going through this rigamarole?
Create and use an appropriate type of share, just like you would between two physical computers.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
SteveC1
Posts: 30
Joined: 7. Nov 2019, 07:33

Re: Share permissions/ownerships seem useless

Post by SteveC1 »

socratis wrote:The Host and the Guest don't have versions?
They are both (using uname -a):
  • Linux intercon 5.0.0-36-generic #39~18.04.1-Ubuntu SMP Tue Nov 12 11:09:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
socratis wrote:VBoxSF, SMB, NFS, other?
I have no idea. I simply followed the directions in the manual, section 4.3; creating a folder on the host, creating a mount point folder on the guest, then going into vm setup and creating the share there.
socratis wrote:Mounted how?
I believe I used the command given in section 4.3.1 of the manual.

I also added the line to fstab, as instructed there.
socratis wrote:If VBoxSF and automounted, you need to add your user to the 'vboxsf' group of the Guest.
If VBoxSF and not auto-mounted, you need to modify the entry in your /etc/fstab.
socratis wrote:
SteveC1 wrote:any new document I create on the host within the share ends up with 664 permissions on the guest
That's to be expected, that's the default.
Fair enough! OK, my use case is as follows. I will be running two Ubuntu VMs (thus far I've created one of them). I want to be able to have either VM put a file into the share, and the other machine to be able to read it--the share is to be primarily a method of communication between two VMs. I don't need to be able to alter the file from the VM while it's in the shared area, so I'm not too concerned with that (I shouldn't have tried it).

It appears that I can at the very least send files from the VM to the host, and vice versa right now.

I simply don't recall what permission changes, etc., I may have made on either the host or guest VM to get it to work; I was flailing and failing at it. (And I have no idea yet what will happen if I send a folder with nested folders that way.) I'l have to figure any of that out all over again once I create the other VM guest.
socratis wrote:Create and use an appropriate type of share, just like you would between two physical computers.
Good advice [though it may be moot for all I know].

I should learn how on earth to know what kind of share got created by simply following section 4.3.

Thanks for your time; now to go create the log file you wanted on my other issue.

[I will be happy to mark this as [Resolved] or [WorksForMe] if I can just figure out how.]
Post Reply