Is there any way to attribute or multi directory to nextcloud

I had a situation like this where I had 2 users
I can specify that user A will be created in folder A and B will be in folder B
Make sure this folder is the home folder so external storage cannot be used
Is there any way to handle this problem?

In Nextcloud there is only one datadirectory.

'datadirectory' => '/var/www/nextcloud/data',


All data files are stored in a one folder structure. However, this can be located on a mount point outside the web server, for example.

Describe exactly what you need. Perhaps we can then help.

I don’t know if it makes sense or is possible to mount the folder data/username1 and data/username2 into the structure. The only thing that is certain is that only Nextcloud and nobody else is allowed to write there.

For example, I have 2 groups of users in 2 different countries. We want to assign each user in each country to 1 folder to facilitate user data management.
Then there will be 2 items data and data1…
Is there a way to determine which working directory that user when logging in?

That’s not possible. Nextcloud only supports one data folder.

However, it is possible to mount additional storage locations via the External Storage App as in the example here.


In theory, you could also symlink the user folders to the mount points of the external storage locations, or maybe even better, mount the external storage locations directly to the user folders via Linux bind mounts, which should be fully transparent to Nextcloud, see also the following thread: Can I move one user to a separate disk drive? - #4 by Pilzinsel64

But keep in mind that these methods are not widely used and probably not officially supported either, and they do increase the complexity of your setup and can have negative side effects if implemented incorrectly or not working reliably. So if you decide to go this route, you should test them extensively on a test system before you going to implemnt them on your production server.

In general I would only recommend these methods if you know exactley what you are doing, otherwise I’d recommend going with the External Storage App.

Good luck. :slight_smile: