VMware Communities
robind
Contributor
Contributor

Shared Folders file permissions and owner in Linux guest

I've set up a Linux guest (ubuntu) and have added some Shared Folders to the config. I see the folders mounted in /mnt/hgfs as expected, but the UID/GID and file permissions of the folders is such that I can't get write access (and in one folder I can't even get read access) to the content of those folders from the guest. Is there something else I need to do? I would assume that since I have full access to those folders from the host and since Fusion is running under my user ID that Fusion can get full access to them, so why can't my user in the guest have full access?

This is in Fusion 1.0 and Ubuntu 7.04

Reply
0 Kudos
7 Replies
nospamboz
Enthusiast
Enthusiast

The workaround is to set the Linux user numeric UID and

GID to the same MacOS numeric UID and GID for the user

running the VM. That is, in a MacOS Terminal, run

"id" to get your numeric UID and GID, then in Linux set

the Linux user UID and GID to the same values as MacOS

(use "Users and Groups" in Ubuntu). Afterword you may

need change some file ownerships on your Linux

filesystems, and "find -uid/gid" is good for that.

Personally I see this as a bug. Sure, vmware-vmx is

setuid root, but hgfs really should be able to do some

kind of UID/GID translation to avoid this problem.

Probably it's been allowed to slide because it's not

a problem in Windows.

Reply
0 Kudos
admin
Immortal
Immortal

It's a limitation/security feature of Linux. Even though Fusion will allow a mismatched uid/gid to work, Linux sees they're different and doesn't bother to try. You can override this by editing the guest[/b]'s /etc/fstab and changing the other-flags to include uid and gid arguments. If my guest[/b] uid/gid is 1000, then I might change

.host:/ /mnt/hgfs vmhgfs defaults,ttl=5 0 0[/code] to

.host:/ /mnt/hgfs vmhgfs defaults,ttl=5,uid=1000,gid=1000 0 0[/code]

Reply
0 Kudos
robind
Contributor
Contributor

Thanks guys. I figured something like either of those solutions would do the trick, but I assumed that this is something that VMware should make transparent so I thought I had done something wrong or had missed a step somewhere. I've been an off-and-on VMware Workstation user since 1.0 but never really used the built-in Shared Folders feature before, and it surprised me that there was this problem right out of the box.

Reply
0 Kudos
mykmelez
Enthusiast
Enthusiast

.host:/ /mnt/hgfs vmhgfs defaults,ttl=5,uid=1000,gid=1000 0 0[/code]

This worked great for me after I unmounted and then remounted the device:

sudo umount /mnt/hgfs; sudo mount /mnt/hgfs

Thanks for the tip!

FWIW, it would be great if Fusion could handle this automatically, since Fusion provides a "read only" checkbox. If a user doesn't check that box, then they clearly want to have write access to the files.

The trick is figuring out who should have such access, since you can have multiple accounts on a Linux VM, but you can only specify a single uid/gid in /etc/fstab. But I'm sure there are some 80% solutions there.

Reply
0 Kudos
mykmelez
Enthusiast
Enthusiast

Looks like I had to repeat this after reinstalling Fusion 1.0, upgrading to Fusion 1.1beta1, and/or copying my VM (I did all three things recently; not sure which one wiped out my changes).

Reply
0 Kudos
mykmelez
Enthusiast
Enthusiast

Note that you can specify your username/groupname in place of your uid/gid:

.host:/ /mnt/hgfs vmhgfs defaults,ttl=5,uid=myusername,gid=mygroupname 0 0

That saves you from having to look up your uid/gid if you don't already know it.

JohnPeterson
Contributor
Contributor

Please update the answer for Ubuntu 11.10 and open-vm-tools 2011.07.19-450511-0ubuntu1.

Reply
0 Kudos