Page 1 of 1

Shared Folder Permissions

Posted: 4. Aug 2014, 17:58
by DocTaut
Hello everyone,

I've done some research on this topic but, I don't believe that I found a valid solution or clear enough explanation.

What I'm doing:

I am running a virtual box Ubuntu Server 14 on a Windows 7 host. The Windows host has an encrypted volume that I mount every time on start up (mounts as T: drive). I have set up virtual box to mount the T: drive automatically as a shared folder. The problem I'm running into involves permissions.

MAIN ISSUE: I am using this virtual ubuntu server as an sshd server, and I need to have this shared folder accessible to several different users. However, there are subdirectories in the shared folder that I want locked down so that only my user account has access.

It does not appear that I can do this by adding users to the vboxsf group since being a member of this group will give all users rwx permissions to the shared folder.

Digression:
Now in the past I had my windows 7 machine running an ssh server using cygwin which goes off the NTFS permissions, so all I had to do is set the folder permissions for windows users and cygwin would use these. However, I'm not sure how these permissions work exactly with the ubuntu guest server since it's not tied to the NTFS permissions. When I share a folder on the Windows host, how does virtual box determine the permissions to those files. Does the ubuntu server basically ignore all the windows permission of the folder?

Re: Shared Folder Permissions

Posted: 4. Aug 2014, 19:22
by socratis
VirtualBox shared folders present a very simplified file system implementation, just enough to read/write files from/to the guest. Many applications can error when using shared folders, because they expect advanced features, like file locking or access controls, which don't exist for shared folders.

I would use a a true network share (samba).

Re: Shared Folder Permissions

Posted: 4. Aug 2014, 20:12
by DocTaut
Thanks for the advice. I know what I'm doing probably isn't ideal, but I can't justify ditching the setup yet because of what would seem to be a simple file permissions issue. Plus I've tested the virtual server and it is 2x faster than using cygwin on the Windows host. I've read that if you manually mount the share you can specify the owner, however this has to be done using root, so I can't set the mount to run automatically on boot. This may be a reasonable option, even thought I would like the shared folder to mount automatically.

Re: Shared Folder Permissions

Posted: 4. Aug 2014, 21:23
by Perryg
so I can't set the mount to run automatically on boot.
Sure you can. If the OS supports it use /etc/rc.local and if not then use /etc/fstab.

Re: Shared Folder Permissions

Posted: 4. Aug 2014, 21:37
by DocTaut
well, it will still require me to enter a password for root, so not exactly automatic in the sense that I mean.

So if I do go this route, how should I go about about specifying the permissions of the sub directories that I want to lock down.
Would I just use a script like this:

sudo mount -t vboxsf -o rw,uid=1000,gid=1000 TDRIVE ~/media
chmod 700 /media/TDRIVE/documents

Re: Shared Folder Permissions

Posted: 4. Aug 2014, 21:39
by Perryg

Code: Select all

well, it will still require me to enter a password for root, so not exactly automatic in the sense that I mean.
No it does not. It only requires you to use sudo to edit the file.

Re: Shared Folder Permissions

Posted: 4. Aug 2014, 21:40
by Perryg
As for permissions you would mount them differently for each user. Simple Linux permission issue.

Re: Shared Folder Permissions

Posted: 4. Aug 2014, 21:41
by Perryg
Of course you can not use the auto-mount feature for this in any case.

Re: Shared Folder Permissions

Posted: 4. Aug 2014, 21:52
by DocTaut
Got it. I really hope this is my solution. Thanks for the help.