[Resolved] Can a share be configured to allow modifying files?

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

[Resolved] Can a share be configured to allow modifying files?

Post by SteveC1 »

Xubuntu 18.04, both guest and host.

Share set up by the method in the Vm UserManual, 4.3. Since that manual does NOT tell me any of the technical details behind the share, I can't answer questions like "what kind of share is it?"

[Edit: I removed a long explanation of a problem I was having which I appear to have solved...which was prelude to the following.]

[Now that] the shared folder is working, it appears that all I can do is copy a file into it, or read what's in it. I can't modify a file in the share, nor can I copy files into a folder that's in the share.

[Another edit: Well, no I can't seem to put a file into the share, though I can see what's in it. But let's leave that aside for now. (Edit: I can create a folder INSIDE the share (using sudo) and chmod that folder to 777--that lets me copy things INTO THAT FOLDER. But if I copy a folder into that folder--that folder again has 775 permissions and I can't, therefore, copy a tree of stuff into the share.)]

I am not sure (because I can't run the experiment) whether it's possible to copy a folder, containing documents and other folders, which in turn contain other things, into the share. If I CANNOT, then it basically can't be used to back anything but the simplest things up.

I'm running my e-mail client on the VM. I would like, ideally, for the mail folders, etc., to live on some drive OTHER than the virtual drive. I've had snapshots get corrupted, and I know that older snapshots that I might have to go back to, do NOT show the emails downloaded after they were taken. I COULD back up the email data to somewhere (even a shared folder if I can get it to accept that) but the easiest thing to do is just have the data live somewhere "outside" of the VM, so that when I download mail, it goes there rather than into the VM (and thus the current state of the VM doesn't matter; in fact I could even change VMs and see the same E-mail if they're both set up this way.

Is this even possible, by ANY mechanism? And if that's not possible, what's the simplest way of backing up an extremely complex mess of nested folders and files to someplace outside of the VM?
Last edited by socratis on 24. Dec 2019, 14:54, edited 1 time in total.
Reason: Marked as [Resolved].
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Can a share be configured to allow modifying files?

Post by socratis »

Can you please edit your message and remove the "Edit" after "Edit" after "Edit" and actually create one, single, coherent, makes-sense message and not a series of Drafts? I got lost in the Edits... ;)
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.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Can a share be configured to allow modifying files?

Post by scottgus1 »

Based on your making a shared folder via instructions from the manual section 4.3, you seem to be making a Guest Additions Shared Folder. GASFs are only for file transfer, not for running programs. Most of the usual capabilities and protocols one would expect to find on a real shared folder over a network has not been programmed for GASFs.

So if you want a real full-protocoled shared folder, you will need a network between host and guest. Bridged or Host-Only provide typical wired-Etherent networking between host and guest. Bridged also brings the whole LAN and internet into the guest. Set up a real shared folder using the usual OS methods over this network.

You concerns about saving and restoring emails were addressed in the "Dual Monitors" thread where you discussed them: viewtopic.php?f=1&t=93941&p=464964#p465003
SteveC1 wrote:have the data live somewhere "outside" of the VM, so that...it goes there rather than into the VM (and thus the current state of the VM doesn't matter
See section 5.4 "Special Image Write Modes" in version 6.0.14's manual. The "Write-through hard disks" seem to be the kind of secondary disk you want. Note that this:
SteveC1 wrote:in fact I could even change VMs
may not be covered, or it may. You could let us know. You may need to register this secondary disk in each snapshot until they all have it loaded.

A real shared folder on the host over the network is also a viable solution to having data that can be accessed regardless of snapshot or VM. Note that you will have to make the share in each snapshot or VM.

On the subject of what's possible in a GASF:
SteveC1 wrote:it appears that all I can do is copy a file into it, or read what's in it....edit: Well, no I can't seem to put a file into the share, though I can see what's in it.
This depends on how you made the GASF. See the manual. GASFs can be created read-only, In which case you can see but not modify. Or they can be created writable.
SteveC1 wrote:chmod that folder to 777
There's no telling what could be the result of modifying permissions on a GASF or what might break. GASFs aren't built for all that. Destroy the GASF you have made and make a new one, note whether it's read-only or writable in the GASF settings, then leave the permissions unmodified in the guest OS..
SteveC1
Posts: 30
Joined: 7. Nov 2019, 07:33

Re: Can a share be configured to allow modifying files?

Post by SteveC1 »

socratis wrote:Can you please edit your message and remove the "Edit" after "Edit" after "Edit" and actually create one, single, coherent, makes-sense message and not a series of Drafts? I got lost in the Edits... ;)
My apologies for that. The reason I did that is I seem to be having difficulty on two fronts simultaneously. Shares don't seem to be working quite right for some reason (I can set it up, but I have to do additional things to get them to work and even then depth of copy isn't quite right without a chmod), and I'm trying to figure out what the heck to do about my email data.

I'll have to try to clean this up at some future date. I'd do it right now but...I have to get ready for my day job.

Meanwhile, scottgus1 has given me some things to ponder.
SteveC1
Posts: 30
Joined: 7. Nov 2019, 07:33

Re: Can a share be configured to allow modifying files?

Post by SteveC1 »

Thanks for responding. There are a lot of suggestions here; I'll pursue them in the future (right now I'm pressed for time).

In the meantime there is something I can respond to immediately.
scottgus1 wrote:On the subject of what's possible in a GASF:
SteveC1 wrote:it appears that all I can do is copy a file into it, or read what's in it....edit: Well, no I can't seem to put a file into the share, though I can see what's in it.
This depends on how you made the GASF. See the manual. GASFs can be created read-only, In which case you can see but not modify. Or they can be created writable.
SteveC1 wrote:chmod that folder to 777
There's no telling what could be the result of modifying permissions on a GASF or what might break. GASFs aren't built for all that. Destroy the GASF you have made and make a new one, note whether it's read-only or writable in the GASF settings, then leave the permissions unmodified in the guest OS..
I am quite sure I did create the share as read/write. Yet I had to do additional things to it (beyond manually mounting it) to get it to work on the guest side to the extent of being able to look inside it (as someone not root) and put files into it--and even then I was limited to "one deep"; I couldn't save folders with contents to it.

I just tried creating a new share, and ended up with something I can't write to at all on either the host or the guest. I'll have to look at this more later.
SteveC1
Posts: 30
Joined: 7. Nov 2019, 07:33

Re: Can a share be configured to allow modifying files?

Post by SteveC1 »

OK, I am going to create a totally new share.

On the host:

Code: Select all

cd /
sudo mkdir newshare
result: /newshare created, owner root, group root, permissions 755.

unable to copy a file here as myself, unsurprising given the permissions. So:

Code: Select all

sudo chmod 777 newshare
Now I can drag files into this (future) share.

On the guest:

Code: Select all

cd /
sudo mkdir newshare
to create the mount point.

For good measure I "chmod 777"ed it as well.

Now I go into settings for the VM. SHared folders. Then I press the plus sign on the right, "Add SHare" dialog pops up. I set folder path = "/newshare", folder name: newshare, I leave read only unchecked, as well as auto-mount. Mount point is /newshare. Click OK.

On the guest, /newshare is empty...but that's because I haven't issued the mount command yet.

Code: Select all

sudo mount -t vboxsf newshare /newshare
I also go into /etc/fstab on the guest and add the line:

Code: Select all

newshare /newshare vboxsf defaults 0 0
OK...THIS time the SOB worked. Usually the result is the folder on the guest machine is inaccessible without more work. (I also haven't restarted the VM yet to see what happens! Will I need auto mount, should I make it permanent, or did putting it in fstab do that for me?)

Now: Unsurprisingly if I try to copy a test folder containing things into the share on the guest, it copies the folder but none of the contents. That's because I'd be modifying the folder. So copies are only one deep. (Workaround, obviously, is to tar whatever directory tree one wants to transfer.)

So I guess to make this a bit more useful I need to do something different, as scottgus1 suggests. The difficulty I now face is I know zero, zilch zippo nada about setting up a "network" between a virtual machine and its host. If I search the internet, I get lots of stuff telling me I need to buy a router, etc., all predicated on the assumption I'm trying to connect two physical machines together. So where is a good place to get started?

I don't think I want a bridged network. I don't want this virtual machine (I'm using it right now) to be able to see my ethernet. My motivation for this whole project--I have to use a mobile hotspot for my internet connection since I live in the boonies. For safety, I want to do my internet in a virtual machine right next to the hot spot. Ideally NOTHING else in my house should have access to that. I want to set up a second virtual machine, which will connect to my home network. Ideally, the first virtual machine will never see my ethernet, and the second will never see the wireless connection. And the host should be as close to seeing neither of them as possible. But I should be able to transfer files from one to the other "manually."

Sadly I'm starting to think that maybe the best way for me to do this is just use a thumbdrive. (And I could back up email to it too.)
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Can a share be configured to allow modifying files?

Post by scottgus1 »

SteveC1 wrote:THIS time the SOB worked.
Good, glad something's working, right? I'm not certain this:
SteveC1 wrote:if I try to copy a test folder containing things into the share on the guest, it copies the folder but none of the contents.
is normal, though. I have no experience with 'chmod', being a Windows guy, but I wonder if "owner root" by 'sudo'ing the 'mkdir' command is right, or does it add a bit of complexity? Maybe just sharing one of the logged-in user's folders would unblock some of the glitches you're getting?
SteveC1 wrote:setting up a "network" between a virtual machine and its host
This is easy and does not require any hardware. While the guest is shut down, in the main Virtualbox window's guest's Network settings, set a guest network card to Host-Only. Voila. Network established.

Host-Only puts a virtual network card in your host PC. You can see what IP address the Host-Only network card uses, as well as whether the Host-Only network has DHCP turned on and what address your guest would get from the Host-Only DHCP, by looking at the main Virtualbox window, File menu, Host Network Manager. The defaults for the first Host-Only network at Virtualbox installation are:

Host PC's Host-Only network card ip address: 192.168.56.1
Host-Only DHCP: on
First guest's IP address attached to this Host-Only network: 192.168.56.101

You will use the IP addresses to communicate on this Host-Only network at first, or there may be tricks to attach a name on the host to the guest's IP address and vice versa, so you can use names instead of IP addresses.

Host-Only acts like a real network, and you can do anything a real network can do though it.
SteveC1 wrote:For safety, I want to do my internet in a virtual machine right next to the hot spot. Ideally NOTHING else in my house should have access to that. I want to set up a second virtual machine, which will connect to my home network. Ideally, the first virtual machine will never see my ethernet, and the second will never see the wireless connection. And the host should be as close to seeing neither of them as possible.
In order for the host PC to not be networked to the hotspot but for the first guest to be attached via Wi-Fi to the hotspot, you will need a USB Wi-fi adapter inserted into the first guest via Virtualbox USB filters, see USB basics and troubleshooting. Also, have the Host-Only network mentioned above, so the guest can pass things with the host PC.

The second guest would need to be Bridged to be on the home network. The best connection to the home network is through wired Ethernet. Bridged does not always work on Wi-Fi, but it might, just need to try it. On a Windows PC it is possible to disconnect the bindings of the host OS from the network card that the Bridged guest is using, so only the guest can use the network card. I do not know if Linux has a similar functionality. You can make another Host-Only network, using File menu, Host Network Manager, to put the second guest in a separate network to the host that the first guest couldn't use.

If your host has both Ethernet and Wi-fi adapters, and you intend to leave the host attached to the Ethernet with the host OS bindings deactivated, and Bridged works with Wi-fi to the hotspot, then you can skip the extra USB wi-fi adapter. Bridge guest 1 to the host Wi-Fi adapter, and attach the Wi-Fi adapter to the hotspot (see note). Bridge guest 2 to the Ethernet adapter. Disconnect all host-OS bindings from both adapters but leave the Virtualbox bindings attached. (note: will the host still be able to control what wi-fi network is connected if the host bindings are disconnected? I don't know. If not, then it's back to the USB wi-fi adapter.)
SteveC1 wrote:best way for me to do this is just use a thumbdrive
This would also either require a shared folder, or use the Virtualbox USB filters to put the drive into the guest, as mentioned above.
SteveC1
Posts: 30
Joined: 7. Nov 2019, 07:33

Re: Can a share be configured to allow modifying files?

Post by SteveC1 »

Thank you for all of the information.

I will try to do some of this in a couple of weeks--unfortunately something else has erupted and I won't be able to get to it much sooner.

I thought I'd respond to a few items, though--mainly info for your edification, no real need to respond.
scottgus1 wrote: In order for the host PC to not be networked to the hotspot but for the first guest to be attached via Wi-Fi to the hotspot, you will need a USB Wi-fi adapter inserted into the first guest via Virtualbox USB filters, see USB basics and troubleshooting. Also, have the Host-Only network mentioned above, so the guest can pass things with the host PC.
That, it turns out, is a MASSIVE headache to do. I spent about a week trying; finding Linux drivers for USB WiFi devices, that actually work, is a nightmare. (There are a lot of supposed drivers out there, but they didn't work for me. Either the device is simply ignored even when I do the USB filter thing--or it causes the guest machine to crash.) I finally found a device that brags that its driver is native to all major linux distributions (including this one); I ordered it but haven't tried it yet. If I can't get it to work, I'll just continue with NAT.
scottgus1 wrote: The second guest would need to be Bridged to be on the home network. The best connection to the home network is through wired Ethernet.
The home network is Ethernet, so THAT, for once...should be easier.
scottgus1 wrote:
SteveC1 wrote:best way for me to do this is just use a thumbdrive
This would also either require a shared folder, or use the Virtualbox USB filters to put the drive into the guest, as mentioned above.
Ah, but it's something I know how to do and I *know* it works. Admittedly, it's a bit like sneakernet, but without having to pull the thumbdrive out, walk it over, and plug it in.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Can a share be configured to allow modifying files?

Post by socratis »

socratis wrote:Can you please edit your message and remove the "Edit" after "Edit" after "Edit"
SteveC1 wrote:I seem to be having difficulty on two fronts simultaneously
SteveC1 wrote:I have to do additional things to get them to work
scottgus1 wrote:You concerns about saving and restoring emails were addressed in the "Dual Monitors" thread
SteveC1 wrote:unfortunately something else has erupted
SteveC1 wrote: I spent about a week trying; finding Linux drivers for USB WiFi devices
I'm going to have to issue a yellow card here. Your mixing issues all together in a single thread, does not help anyone, they're all over the map.

To get back to the original story. You need to be a member of the 'vboxsf' to have access. Permissions are limited on the host. Why? How would you set the permissions on a Host FAT32 partition? How would you transfer the ACL of a Windows Guest to an OSX share. No way.

As has been told time and again, VirtualBox Shared Folders (VBoxSF) are only for simple file transfers, period. If anything above that works, it's a bonus. If it doesn't work, it could or couldn't be an issue. File permissions usually aren't, see above.

If you want more than that, you need to search on how you would do it between two real 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: Can a share be configured to allow modifying files?

Post by SteveC1 »

socratis wrote:I'm going to have to issue a yellow card here. Your mixing issues all together in a single thread, does not help anyone, they're all over the map.
You're right--I didn't edit that message. I wrote a new one instead. Then scottgus1 was kind enough to reply, and the latter quotes of yours that you seem to be presenting as evidence of my (continuing) to mix two issues together were in response to what he wrote. If you want to issue me a yellow card (whatever that means) for responding to someone else, go right on ahead.
socratis wrote: To get back to the original story. You need to be a member of the 'vboxsf' to have access. Permissions are limited on the host. Why? How would you set the permissions on a Host FAT32 partition? How would you transfer the ACL of a Windows Guest to an OSX share. No way.

As has been told time and again, VirtualBox Shared Folders (VBoxSF) are only for simple file transfers, period. If anything above that works, it's a bonus. If it doesn't work, it could or couldn't be an issue. File permissions usually aren't, see above.

If you want more than that, you need to search on how you would do it between two real computers.
Riddle me this: When I created the share this last time, it belonged to "root". Not vboxsf. One of my earlier attempts to create the share did indeed create one that belonged to "vboxsf". So, remembering what you had said about it before, I executed the command to add myself to that group on the guest, and the system simply ignored it. No error message; it just didn't add me.

So it's just as well the share, as often as not, belongs to root. But I'd sure like it to work the same way every time.

scottgus1 has given me the pointers I need to start working on other means of doing this. And (as I mentioned to him) I can always use the old thumbdrive to move files from guest to host until I learn the other method. It certainly seems to have a much-less-steep learning curve. After I get through dealing with an IRL issue (which is what "erupted"--I mentioned it to explain any future long-delayed replies), I'll press on.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Can a share be configured to allow modifying files?

Post by socratis »

SteveC1 wrote:If you want to issue me a yellow card (whatever that means)
It wasn't "issued" to you, it was for the whole thread discussing several issues. And in football™, a yellow card means "Hey, careful"... ;)
SteveC1 wrote: When I created the share this last time, it belonged to "root". Not vboxsf.
'root' has access no matter what. The rest of the users need to be in the 'vboxsf' group.
SteveC1 wrote:I executed the command to add myself to that group on the guest, and the system simply ignored it. No error message; it just didn't add me.
Not sure what command you executed because you didn't mention it. On my Ubuntu-based VMs I like to install 'gnome-system-tools', which gives you a GUI applications to play with (Users and Groups). Then from that GUI, editing the "Groups" allows me to add myself to the 'vboxsf' group. A reboot of the Guest later, and everything falls back in place.
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: Can a share be configured to allow modifying files?

Post by SteveC1 »

And now, as if things haven't been driving me crazy enough.

I get back from what I had to do, power up the host, start the virtual machine, and the new share I created now shows "vboxsf" as the group...and I am now shown as being IN that group. None of this showed when I tried to set this all up.

I was even able to copy a whole mess of files (nested in a folder) and edit stuff on the share.

It's great that it's working (!!!!) but I wonder if it will break if I hold my mouth wrong--or have to redo it for some reason!
SteveC1
Posts: 30
Joined: 7. Nov 2019, 07:33

Re: Can a share be configured to allow modifying files?

Post by SteveC1 »

AH HA, Eureka, &c!!!

Even though you can do the setup on the shared folder with the VM running, you must stop and restart the VM fully (shut it down, reboot it) for it to take full effect (at which point the folder becomes owned by vboxsf group).

I created yet another share--I made it permanent (it shows up under machine folders) and did NOT add it to fstab; otherwise I followed the procedure above. It showed up as root/root and had the "broken" permissions (not allowing modify or create) on it, until I shut down the VM and restarted it. At this point it's doing everything I'd want from a shared "droppbox" folder.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Can a share be configured to allow modifying files?

Post by socratis »

I don't know what's going on, but it's certainly the season where I say "A Host/Guest reboot solves a lot of issues". ;)

Marking as [Resolved].
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: Can a share be configured to allow modifying files?

Post by SteveC1 »

And thanks!!!

I do have one additional question. When I attempt to copy a folder containing symbolic links in it, I get a complaint that the destination (the share) doesn't support symbolic file links. As both the host and guest are running Linux, this seems counter-intuitive, since a linux-based file system SHOULD be able to handle symbolic links. Is this just another consequence of the fact that this is a very rudimentary share, or is there something easy to tweak to fix that? (Or, third possibility--the problem is with a soft link to a location out of the share. Though this doesn't appear to be at issue in this case, it's basically a dummy softlink that goes to a non-existent file in the same directory. It appears to be something Thunderbird writes to "lock" something while it's running, thus I don't really need it in my backup and it's not a real issue.)
Post Reply