Map NFS Clients to Server's Owner:Group?

Status
Not open for further replies.

nello

Patron
Joined
Dec 30, 2012
Messages
351
You don't need the "sudo" for the command on FreeNAS; you're already root.
Sorry, that was dumb of me. :(
Code:
[root@OctoberGroupNAS ~]# chown crashPlan:backup /mnt/red/fresh/empty.txt      
[root@OctoberGroupNAS ~]# ls -Al /mnt/red/fresh/empty.txt                      
-rw-rw-r--  1 crashPlan  backup  0 Aug 16 16:00 /mnt/red/fresh/empty.txt      
[root@OctoberGroupNAS ~]# ls -Aln /mnt/red/fresh/empty.txt                    
-rw-rw-r--  1 1001  1001  0 Aug 16 16:00 /mnt/red/fresh/empty.txt              
[root@OctoberGroupNAS ~]#



As you suggested, I rebooted the Ubuntu VM:
Code:
nello@ubuntu16:~$ sudo reboot
Connection to 10.10.49.123 closed by remote host.
Connection to 10.10.49.123 closed.
Descartes:~ nello$



After rebooting, the share was already mounted and empty.txt has the correct ownership
Code:
nello@ubuntu16:~$ sudo mount -t nfs  10.10.49.10:/mnt/red/fresh /mnt/nfs/crashPlanOctoberGroupNAS
mount.nfs: /mnt/nfs/crashPlanOctoberGroupNAS is busy or already mounted
nello@ubuntu16:~$ df -h
Filesystem                     Size  Used Avail Use% Mounted on
udev                           2.0G     0  2.0G   0% /dev
tmpfs                          396M  6.1M  390M   2% /run
/dev/mapper/ubuntu16--vg-root   18G  5.1G   12G  32% /
tmpfs                          2.0G   84K  2.0G   1% /dev/shm
tmpfs                          5.0M     0  5.0M   0% /run/lock
tmpfs                          2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda1                      472M  110M  339M  25% /boot
tmpfs                          396M  8.0K  396M   1% /run/user/1000
10.10.49.10:/mnt/red/fresh      10G  144M  9.9G   2% /mnt/nfs/crashPlanOctoberGroupNAS
nello@ubuntu16:~$ ls -Al /mnt/nfs
total 1
drwxrwxrwx 3 crashPlan backup 4 Aug 16 17:45 crashPlanOctoberGroupNAS
nello@ubuntu16:~$ ls -Al /mnt/nfs/crashPlanOctoberGroupNAS
total 17
drwxr-xr-x 3 4294967294 backup 13 Aug 16 17:46 754740932183315422
-rw-rw-r-- 1 crashPlan  backup  0 Aug 16 16:00 empty.txt
nello@ubuntu16:~$ 



Of course, the files written by my CrashPlan backup still have their old ownership:
Code:
nello@ubuntu16:~$ ls -Al /mnt/nfs/crashPlanOctoberGroupNAS/754740932183315422
total 126
-rw-r--r-- 1 4294967294 backup    18 Aug 16 17:45 754740932183315422
drwxr-xr-x 2 4294967294 backup     5 Aug 16 17:46 cpbf0000000000000000000
-rw-r--r-- 1 4294967294 backup   349 Aug 16 17:46 cpbp
-rw-r--r-- 1 4294967294 backup 42430 Aug 16 17:46 cpfmf
-rw-r--r-- 1 4294967294 backup 26967 Aug 16 18:43 cpfmfp
-rw-r--r-- 1 4294967294 backup     8 Aug 16 17:46 cpfmfs
-rw-r--r-- 1 4294967294 backup 13619 Aug 16 18:43 cpfmfx
-rw-r--r-- 1 4294967294 backup 32168 Aug 16 17:46 cphdf
-rw-r--r-- 1 4294967294 backup   716 Aug 17 03:00 cp.properties
-rw-r--r-- 1 4294967294 backup  1754 Aug 16 17:46 cprp
-rw-r--r-- 1 4294967294 backup    53 Aug 16 18:43 cptl
nello@ubuntu16:~$ 



So, I think I'll delete this CrashPlan backup archive, run a fresh backup and check the ownership.

I tried creating a new file on the share from within Ubuntu and, of course, my account owns it.:
Code:
nello@ubuntu16:~$ touch /mnt/nfs/crashPlanOctoberGroupNAS/empty2016.08.17.txt
nello@ubuntu16:~$ ls -Al /mnt/nfs/crashPlanOctoberGroupNAS
total 18
drwxr-xr-x 3 4294967294 backup 13 Aug 16 17:46 754740932183315422
-rw-rw-r-- 1 nello      backup  0 Aug 17 10:40 empty2016.08.17.txt
-rw-rw-r-- 1 crashPlan  backup  0 Aug 16 16:00 empty.txt
nello@ubuntu16:~$



And on the FreeNAS side, the file has the UID:GID of my Ubuntu account:
Code:
[root@OctoberGroupNAS ~]# ls -Al /mnt/red/fresh                                 
total 35                                                                       
drwxr-xr-x  3 4294967294  backup  13 Aug 16 17:46 754740932183315422           
-rw-rw-r--  1 crashPlan   backup   0 Aug 16 16:00 empty.txt                     
-rw-rw-r--  1 1000        backup   0 Aug 17 10:40 empty2016.08.17.txt           
[root@OctoberGroupNAS ~]#



So, I guess that this is working correctly now; no more nobody:nogroup ownerships! I was originally trying to get all read/writes from/to the mounted share to have crashPlan:backup ownership. But as long as CrashPlan can read/write its files as crashPlan:backup, I guess that's really better.

As far as I can figure, all I did to get rid of the nobody:nogroup ownerships was downgrade NFS to v3 and then re-boot. Do you have any other ideas to explain why ownership seems to be working now?

I may not be able to get back to this for a few days. But, please know that I REALLY appreciate you helping me through this.

I've found lots of posts by people having the same problem of getting nobody:nogroup ownerships assigned to mounts. They seem to either abandon NFS sharing or assign all mounts root ownership, which seems rather ill-advised. In any case, it would be good to post what made this work so that others could find it.

THANK YOU VERY MUCH!!!

- nello
 

Nick2253

Wizard
Joined
Apr 21, 2014
Messages
1,633
Happy to help! I'm glad we got it figured out.

One of the things that NFSv4 brings to the table is the ability to automagically map UIDs and GIDs based on names, instead of numbers. In my opinion, that's a terrible thing, and I'm wondering if it has something to do with the problem we're seeing here. But I'll be honest, I'm not that experienced with NFSv4 yet.

As far as I know, there is no performance or security difference between NFSv3 and v4; the only difference is features. If you have v3 working, you should be good to go.

And thank you, by the way, for the thoroughness of your posts. I hope that it helps someone in the future solve a similar problem!
 

nello

Patron
Joined
Dec 30, 2012
Messages
351

nello

Patron
Joined
Dec 30, 2012
Messages
351
One problem persists ....

CrashPlan is writing all its files as with ownership of 4294967294:1001
Code:
nello@ubuntu16:/mnt/nfs/crashPlanOctoberGroupNAS$ ls -Al
total 17
drwxr-xr-x 3 4294967294 backup 13 Aug 25 12:05 754740932183315422
nello@ubuntu16:/mnt/nfs/crashPlanOctoberGroupNAS$ ls -Aln
total 17
drwxr-xr-x 3 4294967294 1001 13 Aug 25 12:05 754740932183315422
nello@ubuntu16:/mnt/nfs/crashPlanOctoberGroupNAS$



How do I get CrashPlan to write its files as 1001:1001?


2016.08.25 Update
Apparently, CrashPlan normally runs as root and the user it runs as can be changed by editing the script /etc/init.d/crashplan as described here:

https://crashbone.wordpress.com/2012/05/15/installing-crashplan-beaglebone-running-ubuntu-12-04-lts/

Can someone give me a sanity check on doing this? Does it seem reasonable that making the CrashPlan application run under the user crashPlan will result in all (new) files written by the CrashPlan application have user:group ownership of crashPlan:backup?


2016.08.25 Update

Well that was a waste of time!

Changing the ZFS Dataset Permissions to world execute made all my problems go away.

OctoberGroupNAS_-_FreeNAS-9_10_1__d989edd_.png
 
Last edited:

nello

Patron
Joined
Dec 30, 2012
Messages
351
Following the example at https://crashbone.wordpress.com/2012/05/15/installing-crashplan-beaglebone-running-ubuntu-12-04-lts/, I made these modifications so that the CrashPlan application would run as the user crashPlan

  1. As root, make a copy of the script file /etc/init.d/crashplan:
    Code:
    nello@ubuntu16:/$ sudo cp /etc/init.d/crashplan /etc/init.d/crashplan_original
    nello@ubuntu16:/$ ls -Al /etc/init.d/crashplan /etc/init.d/crashplan_original
    -rwxr-xr-x 1 root root 894 Aug  7 17:17 /etc/init.d/crashplan
    -rwxr-xr-x 1 root root 894 Aug 25 18:03 /etc/init.d/crashplan_original



  2. As root, make a copy of the CrashPlan application files, which are located at /usr/local/crashplan/bin by default:
    Code:
    nello@ubuntu16:/$ sudo cp -R /usr/local/crashplan/bin /usr/local/crashplan/bin_original
    nello@ubuntu16:/$ ls -Al /usr/local/crashplan/bin /usr/local/crashplan/bin_original /usr/local/crashplan/bin:
    total 24
    -rwxr-xr-x 1 root root  544 Aug  7 17:17 CrashPlanDesktop
    -rwxr-xr-x 1 root root 4831 Aug  7 17:17 CrashPlanEngine
    -rwxr-xr-x 1 root root  826 Aug  7 17:17 restartLinux.sh
    -rw-r--r-- 1 root root  527 Aug  7 17:17 run.conf
    -rw-r--r-- 1 root root  122 Aug  7 17:17 vars.sh
    /usr/local/crashplan/bin_original:
    total 24
    -rwxr-xr-x 1 root root  544 Aug 25 18:16 CrashPlanDesktop
    -rwxr-xr-x 1 root root 4831 Aug 25 18:16 CrashPlanEngine
    -rwxr-xr-x 1 root root  826 Aug 25 18:16 restartLinux.sh
    -rw-r--r-- 1 root root  527 Aug 25 18:16 run.conf
    -rw-r--r-- 1 root root  122 Aug 25 18:16 vars.sh



  3. Change ownership of the CrashPlan application files, which are located at /usr/local/crashplan/bin by default:
    Code:
    nello@ubuntu16:/$  sudo chown -R crashPlan:backup /usr/local/crashplan/bin
    nello@ubuntu16:/$ ls -Al /usr/local/crashplan/bin
    total 24
    -rwxr-xr-x 1 crashPlan backup  544 Aug  7 17:17 CrashPlanDesktop
    -rwxr-xr-x 1 crashPlan backup 4831 Aug  7 17:17 CrashPlanEngine
    -rwxr-xr-x 1 crashPlan backup  826 Aug  7 17:17 restartLinux.sh
    -rw-r--r-- 1 crashPlan backup  527 Aug  7 17:17 run.conf
    -rw-r--r-- 1 crashPlan backup  122 Aug  7 17:17 vars.sh
    nello@ubuntu16:/$ 



  4. In the CrashPlan script file /etc/init.d/crashplan, change these five instances (lines)
    Code:
    $SCRIPTNAME start
    $SCRIPTNAME stop
    $SCRIPTNAME restart
    $SCRIPTNAME force-reload
    $SCRIPTNAME status

    To
    Code:
    su crashPlan -c "$SCRIPTNAME start"
    su crashPlan -c "$SCRIPTNAME stop"
    su crashPlan -c "$SCRIPTNAME restart"
    su crashPlan -c "$SCRIPTNAME force-reload"
    su crashPlan -c "$SCRIPTNAME status"



  5. Stop and start the CrashPlan service:
    Code:
    nello@ubuntu16:/$ cd  /usr/local/crashplan/bin
    nello@ubuntu16:/usr/local/crashplan/bin$ sudo ./CrashPlanEngine stop
    Stopping CrashPlan Engine ... OK
    nello@ubuntu16:/usr/local/crashplan/bin$ sudo ./CrashPlanEngine start
    Starting CrashPlan Engine ... Using standard startup
    OK
    nello@ubuntu16:/usr/local/crashplan/bin$

I deleted the archive and re-ran CrashPlan to backup my Ubuntu user to the mounted share.

Unfortunately, the archives written by CrashPlan still have root:root ownership.
 
Last edited:
Status
Not open for further replies.
Top