Home-Share on NFS (via External Storage App)

Hello Community,

I try to achieve the following scenario:

  • Setup NextCloud latest on a VM
  • Connect it to a NFS-Share via External Storage App (Share is mounted locally on the FS, user www-data has access to it)
  • Write and read files with a user with the correct UID / GID on the Storage Provider (NAS)

I have setup everything so far.
The only thing is, that I cannot write and read the files with the “correct” user.
So my first idea was, that I can set the correct UID and GID of a user and it would be mapped correctly to the NFS-Share.

Question: Is there a way to set the GID / UID of the user that nextcloud uses to access the NFS-Share?
If I use AD / LDAP, is the problem solved then? Would that be the only way to achieve that?


Is it really correct. Can your Nextcloud user write? Test with this command (e.g. user www-data)
sudo -u www-data touch /path/to/your/nfs-share/testfile.txt
(touch creates an empty file here testfile.txt)

Good morning,

sorry for replying so late.
Yes, www-data can write.
The reason why I ask: If I mount a share with NFS, all files that will be created there via NextCloud are owned by www-data and I would like to set the correct UID of the user that I have on both sides.
@devnull, “Really Correct” means, that this is solved by using LDAP/AD? Maybe you can explain a little bit more in detail?


Correctly “Is it really correct?” belongs to your statement that you can write on the share. Therefor the test with “touch”.

Maybe you can search some examples with “nextcloud external storage nfs” in the internet.

So… maybe I have to correct me and describe my problem more detailed:
Technically, everything works since I configured it.
The only thing I do not like is the following:

  • Every file, that is created by NextCloud is created with the same user (Even www-data or the User I define in my NFS-Settings)
  • I wold like to have a solution where the user, that I use to write to the share is the same user that I have created on the storage.

So as far as I understood, NextCloud ALWAYS writes with www-data, even if I connect it via LDAP / Active Directory?
Is there no way of having a UID/GID Mapping?
How I can achieve, that the User and Group that write to the share is not always the same?

I just stumpled upon this posting

I have solved this problem by ensuring that:

  • on the NFS server create the apropriate user.
  • open /etc/passwd and notice the UID of the same user - lets asume the UID is 2001
  • Open /etc/group and notice the GID of the group “users” - typically GID is 100
    Lets assume that the user UID is 2001, and we know the group “users” have GID 100.

Now as a parameter in the definition of the NFS service on the NFS server, put the options (notice there is no whitespace):
Now all the files created by Nextcloud will have the correct owner/group (UID 2001 and GID 100 = dcreated username and group “users” on the disks of the NFS server.