mineshaftgap / d4m-nfs

Docker for Mac with NFS for performance improvements over osxfs
296 stars 26 forks source link

NFS UID mapping not working #16

Closed LennardWesterveld closed 7 years ago

LennardWesterveld commented 7 years ago

Hi there,

I have some issues with the ownership mapping. What i want to accomplish is that mounted /Users/ volume will have UID:1000 and GUID:1000. So what i did is in etc/d4m-nfs-mounts.txt added:

/Volumes:/Volumes:1000:1000
/private:/private:1000:1000
/Users:/Users:1000:1000

osx $ cat /etc/exports

# d4m-nfs exports

"/Volumes" -alldirs -mapall=1000:1000 localhost
"/private" -alldirs -mapall=1000:1000 localhost
"/Users" -alldirs -mapall=1000:1000 localhost`

Everything is looking fine so far (also tried to remove localhost) but when i go into the d4m screen (screen -r d4m) the ownership is not 1000 but still the osx user id.

/ # cd /Users/
/Users # ls -la
total 20
drwxr-xr-x    6 root     cdrw           204 Jun 15 13:58 .
drwxrwxrwt   24 root     root           540 Nov 21 13:49 ..
-rw-r--r--    1 root     root             0 May 11  2016 .localized
drwxr-xr-x   11 201      201            374 Sep 30  2014 Guest
drwxrwxrwt   12 root     root           408 Oct 29 10:39 Shared
drwxrwxrwx  146 501      dialout       4964 Nov 21 13:57 lennard
/Users #

OSX version: MacOS siera 10.12.2 bèta (16C48b) Docker version: 10.12.2 bèta (16C48b)

if-kenn commented 7 years ago

@LennardWesterveld did you remove /Users from the Docker for Mac preferences? From the Readme:

You can now specify what mounts you want in the d4m-nfs-mounts.txt file. Note that if you do this, you need to make sure that it does not conflict with D4M settings, in other words if you want to have /Users be served by NFS instead of osxfs you will need to remove it from the D4M Preferences -> File Sharing. The /tmp share must stay since that is how d4m-nfs exchanges information with the D4M Moby VM.

LennardWesterveld commented 7 years ago

@if-kenn Yes i did: https://www.dropbox.com/s/yy5w6vglzwst983/Schermafdruk%202016-12-01%2010.03.14.png?dl=0

if-kenn commented 7 years ago

@LennardWesterveld one other thing that I thought of is that you are trying to export the mounts with UID 1000 and GID 1000 that probably don't exist, unless you created a user and group on your Mac with these IDs.

The idea behind UID/GID mapping is that the NFS host export maps permissions the to corresponding UID/GID on the system, not change the owner on the client.

As a sanity check to see if things work, change:

/Volumes:/Volumes:1000:1000 /private:/private:1000:1000 /Users:/Users:1000:1000

to:

/Volumes:/Volumes:0:0 /private:/private:0:0 /Users:/Users:0:0

if-kenn commented 7 years ago

For better explanation see:

https://linux.die.net/man/5/exports

LennardWesterveld commented 7 years ago

Hi @if-kenn, Alright i understand, so thats why the owner ship doen't change in the docker container. So when i change it to 0:0 the mount permissions will be root so there will be no issue when writing?

Anyway i will try it today if that works, probably thats solves my issue.

if-kenn commented 7 years ago

So to accomplish what you are wanting, you would use the 0:0 ids and on your Mac change desired ownership of files to 1000:1000, e.g:

sudo chmod 1000:1000 /Users/lennard/foobar

Even though the user and group does not exist most Unix systems still allow you to assign a numeric ID instead of a name. Note that you might have to add you user to the 1000 group or some such thing. Every circumstance requires a different tactic, even when not using NFS.

Good luck!

if-kenn commented 7 years ago

@LennardWesterveld I am going to consider this closed, please reopen or make a new issue if you need to.