1

Looking for some assistance in setting up an NFS share between WDMyCloud (NFS Server) and RaspberryPi (NFS Client).

I have set up the share successfully using the below config but having some difficulty in setting up the correct permissions for OwnCloud to access the files.

WDMyCloud (NFS Server)

/etc/exports

# Use nobody user (uid 65534) for nfs guest.  This is restricted from private
# shares by ACLs.
#
/nfs/owncloud 192.168.0.25(rw,all_squash,sync,no_subtree_check,insecure,crossmnt,anonuid=33,anongid=33)

grep 33 /etc/passwd

www-data:x:33:33:www-data:/var/www:/bin/sh

grep 33 /etc/group

www-data:x:33:root,nobody,daapd

Raspberry Pi (NFS Client)

/etc/fstab

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
192.168.0.30:/nfs/owncloud  /owncloud   nfs nouser,atime,auto,rw,dev,exec,suid 0 0

Mounts successfully

raspberrypi ~ # df -h
Filesystem                  Size  Used Avail Use% Mounted on
/dev/root                    15G  1.8G   13G  13% /
devtmpfs                    237M     0  237M   0% /dev
tmpfs                       242M  8.5M  233M   4% /run
tmpfs                       242M     0  242M   0% /sys/fs/cgroup
/dev/mmcblk0p1               63M   21M   43M  33% /boot
192.168.0.30:/nfs/owncloud  3.6T  151G  3.4T   5% /owncloud

But listing the directory, it shows different user/group:

raspberrypi ~ # ls -lAh /owncloud/
total 172K
drwxr-xr-x 2 nobody pi 4.0K Oct 17 22:01 files_external
-rw-r--r-- 1 nobody pi  284 Oct 17 21:37 .htaccess
-rw-r--r-- 1 nobody pi  145 Oct 17 22:01 htaccesstest.txt
-rw-r--r-- 1 nobody pi    0 Oct 17 22:01 index.html
-rw-r--r-- 1 nobody pi 156K Oct 17 22:01 owncloud.db
-rw-r--r-- 1 nobody pi    0 Oct 17 22:01 owncloud.log

I'm not even carrying out this as the user 'pi' so not sure why this group is being used:

raspberrypi ~ # whoami
root

I have attempted a restart of the "nfs-kernel-server" service on the server-side alongside an exportfs -a with no luck.

What I'm trying to achieve is for the file/directory ownership to be "www-data" for both user and group.

Any help would be much appreciated.

Cheers,

UPDATE:

Just to add, the UUID for www-data on the Raspberry Pi is also 33:

raspberrypi ~ # grep 33 /etc/passwd
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
raspberrypi ~ # grep 33 /etc/group
www-data:x:33:www-data
0

The problem is that all the files in the NFS mount need to be owned by the webserver user. Otherwise you will run into problems. The easiest is if you mount it via smbclient as the webserver user and do a symlink of the data directory. By the way. It is recommended to use Nextcloud instead of ownCloud because it contains important security fixes. Nextcloud also has a feature to access smb shares directly. This is very easy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.