File-level write protection in shared folder

Discussions related to using VirtualBox on Linux hosts.
Post Reply
db-inf
Posts: 4
Joined: 9. Apr 2018, 16:50

File-level write protection in shared folder

Post by db-inf »

My setup is a Ubuntu Xenial host and a Windows XP guest. A set of Windows programs is stored in a directory tree on the linux disk, so that I can
  • * manage the lot in my host
    * execute (some of) these programs under wine, often with some limitations
    * execute them in a Windows VM via VirtualBox shared folder as well
I succeeded in giving this directory tree the same drive letter in wine as in the Windows VM, so that the programs can share their configuration files, which is usefull for various reasons. I can now execute most programs in wine to have a quick look at something, or start a VM to do more complicated work with them.

In Windows I had a very successful protection scheme, by setting permissions at the file level. All directories with executables or libraries in them were write-protected, except for the occasional configuration file. And all files in writable directories had a no-execute file permission (forgot the English word for it). I am now trying to find the equivalent for this setup.

To my surprise a file in a shared folder that I chmodded to read-only, could be written to from the VM (even without explicitely removing the read-only flag in the VM itself). Other surprises may be lurking in a corner, and that is why I would like to have confirmation that this is a good protection scheme for my new setup :
  • * the shared folder is read/write (because of the configuration files that some programs write to on every execution)
    * all directories in the directory tree are read/execute, no write. This prevents a rogue Windows program (or my thick fingers) to delete any file in it, or even the complete directory (which happened yesterday, I love backups)
    * all files in the directory tree are owned by another user (for the moment root) than the one executing the VM, and not writable by 'other', so that no files can be infected by well written virusses or badly written applications.
    * exception is made for a number of configuration files: these ARE writable by 'other'
Last edited by db-inf on 11. Apr 2018, 13:16, edited 1 time in total.
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: File-level write protection in shared folder

Post by Martin »

Don't rely on shared folders if you need to use advanced features like access control.
Shared folders are only implemented with very limited features, just for copying files between guest and host.
db-inf
Posts: 4
Joined: 9. Apr 2018, 16:50

Re: File-level write protection in shared folder

Post by db-inf »

@Martin
I appreciate your advise, but shared folders are very usefull to avoid duplication. Duplication inevitably leads to synchronization problems and to overloading backup procedures and space.

So I'll go with shared folders as far as I can. My old Windows rig lasted 15 years without problems, thanks to the effort I put into it at the beginning. If I can repeat that, it may last to near the end of my usefull life.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: File-level write protection in shared folder

Post by mpack »

db-inf wrote: shared folders are very usefull to avoid duplication
True, but that doesn't affect the answer given.

If GA shared folders don't suit your needs then configure a true network share instead.

And do remember that a shared folder is showing you files belonging to another PC. A shared folder is not a disk drive, it's just a file transfer protocol with a directory-like presentation.
db-inf
Posts: 4
Joined: 9. Apr 2018, 16:50

Re: File-level write protection in shared folder

Post by db-inf »

mpack wrote:If GA shared folders don't suit your needs then configure a true network share instead.
I will do that, but for the moment I am trying to make shared folders suit this one need. For other needs I indeed use network shares already.

And you too are thanked for your contribution, but I would still welcome an answer to my question, instead of advise on why I should not have that question.
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: File-level write protection in shared folder

Post by socratis »

The answer I'm afraid has been given quite clearly. The problem is that you don't like the answer.

It's like you're telling me "I want to have security descriptors, user/group ownership on a FAT32 filesystem". The answer would be the same; can't do.
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.
Post Reply