Setting permissions when mounting the host's shared folder

Discussions about using Linux guests in VirtualBox.
Post Reply
sdondley
Posts: 13
Joined: 14. Jul 2008, 03:42

Setting permissions when mounting the host's shared folder

Post by sdondley »

I got Debian Etch virtualized inside of my new Macbook Pro and running an apache server. Been a great learning experience so far. I was able to get guest additions installed so I can share file folders between the two OSes.

One problem I'm trying to solve is setting the umask when mounting the shared file system with -o UID=XX -o GUID=XX. Without a mask, any file created in the shared folder defaults to the Mac's permissions, rw-------. I'd like these files to be read/writable by any user on the machine. I looked in /etc/passwd and tried using 0 for UID and 99 for GUID but that didn't help. Not sure what else I should try. I'm new to Max OS X.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

What if you use '-o umask 777' as mount option for the shared folders. Just take a look at the man page for mount, you will see what options are available and what you need.
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.
sdondley
Posts: 13
Joined: 14. Jul 2008, 03:42

Tried that already

Post by sdondley »

It threw an error saying umask was not an option.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Did you take a look at the man page for mount (man mount or man 8 mount)? It's also possible that it's not an option for the vboxsf file system.
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.
sdondley
Posts: 13
Joined: 14. Jul 2008, 03:42

Post by sdondley »

Looked at it read it, tried some different things, googled, looked at other examples, but no matter what I tried, the created files can only be modified and reaad by the mac's user.
sdondley
Posts: 13
Joined: 14. Jul 2008, 03:42

Post by sdondley »

btw, the manual for virtualbox mentions uid and gid settings and how they can be used to set permission. But that's about all it says.
sdondley
Posts: 13
Joined: 14. Jul 2008, 03:42

Post by sdondley »

Another thing: I cannot even chmod the files with the Linux guest. It simply has no effect.

I have to go to the mac file system, give myself permission to change the permissions by clicking on a little lock icon and then typing in my user password, and only then can the file's permissions be changed. Needless to say, this is not practical.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Could be a MAC issue. I wonder what the devs have to say about this.
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.
h1d
Volunteer
Posts: 170
Joined: 3. Jul 2008, 02:10

Post by h1d »

Just type in 'mount.vboxsf' alone in the terminal and it will show all the possible options.

But vboxsf does not understand altering acl. I also wish this were possible, but could just change the permissions on the host file system then.

You can use the 'uid=MyLinuxUser', 'gid=MyLinuxGroup' kind of option on the 'mount' command to give ownership to the user on the guest system.

You should use the terminal instead of using GUI to change permissions. Run the terminal, 'cd' into the folder and do the 'sudo chmod 0755 MyFolder AnotherFolder' or some such and type in your password. 'sudo' will remember that you are authorized for a while, so consecutive 'sudo' will not ask you anymore passwords.

Read up on 'man chmod' for detailed instructions on the bits.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

The way I have my SF mounted in Ubuntu Server (from Ubuntu Desktop Host) is with this line:

Code: Select all

data  /data  vboxsf  defaults,gid=1000,uid=1000,auto,rw
When I type "ls -l /data", I see my username and group as owner.
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.
ejtttje
Posts: 6
Joined: 2. Aug 2008, 20:42

missing the point

Post by ejtttje »

I also share this problem — it's not an issue of setting the uid and gid — the big problem here is that I can't set the executable bit, and there doesn't seem to be a way to have it set by default for new files.

So in other words, you can't compile or write scripts in a shared folder. Which is unfortunately exactly what I want to do (use the VM as a cross compiler, so I develop on my host OS, keep the source code in a shared folder, and then run the compiler in the VM). But since any generated build tools are non-executable, that screws up the build, and even if I got through that, I wouldn't be able to run/debug the final product because I (and the compiler) can't mark it executable.

This is really screwing up my workflow :(
ejtttje
Posts: 6
Joined: 2. Aug 2008, 20:42

known issue

Post by ejtttje »

Ah a bit more searching this has been discussed:
http://forums.virtualbox.org/viewtopic.php?t=6691

And there's a ticket here:
http://www.virtualbox.org/ticket/1776
Post Reply