How to configure user_directory with occ to user nfs home directory for data files

sudo -u apache php occ user:info jelledejong@test.nl | grep user_directory:
  - user_directory: /var/www/html/nextcloud/data/jelledejong@test.nl

sudo -u apache php occ user:setting jelledejong@test.nl user_directory /mnt/nfs/home/jelledj 
The setting does not exist for user "jelledejong@test.nl.nl".

Commands say more then words, i am trying to force nextcloud to use an nfs share for this user, the location is accessible by the httpd user

All available options for an occ command are usually shown by appending the –help switch to it, like e.g.:

> ./occ user:setting --help
Usage:
  user:setting [options] [--] <uid> [<app>] [<key>] [<value>]

Arguments:
  uid                                User ID used to login
  app                                Restrict the settings to a given app [default: ""]
  key                                Setting key to set, get or delete [default: ""]
  value                              The new value of the setting

Afaik it is not possible to change the home directory for a single user as you tried it, but you can e.g. use the external storage app which is described here:

https://docs.nextcloud.com/server/15/admin_manual/configuration_files/external_storage/local.html

Here you find a discussion about using NFS mounts: NFS mount vs 'Local' External Storage (app)

Thank you for taking time to answer. I have studied the provided ticket and links before. I would love to use the external storage app system for this, but I can not get it to work as the root data storage for a user. Can you help me?

sudo -u apache php occ files_external:create -c datadir=/mnt/nfs/home/$user "Home" local null::null

I want to use my NFS user folder as the / root data folder for the user, apache/httpd user has access to all the home shares, but the nextcloud user should only have access to its own home folder.

How can use configure an external storage as a / root for an user and have it dynamic so it depends on the username what path it takes?

/var/www/html/nextcloud/data/$USER/files/ > /mnt/nfs/home/$user

sudo -u apache php occ files_external:create -c datadir=/mnt/nfs/home/\$user / local null::null

This will be the right answer to my own question, hope it helps others.

1 Like