I have Ubuntu GNOME 15.10 on one computer and OS X 10.11.2 on another. I want to migrate files from the Ubuntu installation to the OS X installation but preserving permissions.
Currently the strategy I am attempting is to export my home directory over NFS, mount it from the Mac, and cp -a
the files off the mount. I know that on OS X UIDs and GIDs are assigned differently than on Linux. On Linux my UID/GID is 1000/1000 and on OS X my UID/GID is 501/20.
From what I can gather, having this in my /etc/exports
should be sufficient to get my Linux files showing up as 501/20 on the Mac:
/home/pietro/ <Mac's IP>(rw,sync,all_squash,no_subtree_check,insecure,anonuid=501,anongid=20)
and mounting on the Mac with
mkdir /tmp/q
sudo mount -t nfs <Linux's IP>:/home/pietro /tmp/q
However, when I mount this way, ls -l
on the Mac tells me that the file permissions are still 1000/1000.
I have also tried:
no_root_squash
anonuid=1000,anongid=1000
- removing
no_subtree_check
- removing
sync
echo N | sudo tee /sys/module/nfs/parameters/nfs4_disable_idmapping
followed bysudo nfsidmap -c
NEED_IDMAPD=yes
in/etc/default/nfs-common
-o resvport
on the Mac
all to no avail.
So my question is: how do I configure NFS so that when I ls -l
on the Mac side I get 501/20 as the owner/group, so I can safely cp -a
?
Alternatively, am I using the wrong tool for the job and is there a better way? I need to preserve the other Unix permissions, so SMB does not seem to be an option. I'm also unwilling to risk changing the UID/GID of the OS X account.
Thanks.
Best Answer
I decided to just use rsync, which as of version 3.1.0 has options for doing what I want. I needed to get the latest rsync as Apple still ships an ancient version with OS X, but after that it was a matter of just doing
Thanks anyway!
UPDATE (for the benefit of Googlers) Vice versa works too, also from the Mac!
<path>
didn't seem to like spaces, but I might be doing somehting wrong...