How to set up Nextcloud on RaspberryPI with several users, external HDD holding only files separated by users

I am setting up Nextcloud on a RaspberryPI for my family. It has an 8GB microSD card and a big external HDD attached.

What I want:

  1. Nextcloud has more than one user.
  2. There is a common directory inside the HDD that everyone can access inside Nextcloud (music, photos, movies, etc.).
  3. Every one has a files inside Files app stored in HDD so SD does not fill up.
  4. Nobody can access others’ files.
  5. Those files are synced on individuals’ laptop, but not the media directory.
  6. If the HDD is unavailable for some reason, Nextcloud and its apps are still accessible; not the files though.
  7. If a new user gets onboard, he creates the account using registering app and he automagically gets his own folder created in the HDD.

I just can’t get my head around this.

What I have done so far is create a media directory that I made accessible to anyone via External Storage app and Samba. This fulfills requirement 2. This part is easy.

For the rest I have tried:

  1. Put Nextcloud’s data folder on HDD during installation. This does not meet requirement 6.

Other ideas just do not meet all requirements:

  1. Create manually a directory inside the HDD on user registration and then manually mount that directory to data/username. I do not know if I would miss something else in this case. Anyway this does not meet requirement 7, maybe not even requirement 6 but I have not tried it yet.
  2. Create manually a directory inside the HDD on user registration and then manually make it accesible to the user through External Storage. I think this would violate requirements 7 and maybe 5.

I mean, is not that bad to have to do some things manually, is not like there will be 10 registrations per day; I am just curious about what would be the best solution for a big setup.

So, have you tried something similar? Do you have any better idea?

Thank you very much.

Hi did you manage to resolve it??
am alose facing the same issue

Hi @pabgan, to configure the data directory on nextcloud you need :

  • set the correct permission on this directory :
    sudo chown -R www-data:www-data /path-data-directory
    sudo chmod -R 750 /path-data-directory

  • add the path of the directory in your config.php ( /nectloud/config/config.php) :
    'datadirectory' => '/path-data-directory',

  • requirement 4 is always satisfied by default on nextcloud, only user has access to his files except if he shares his files with others.

  • For requirement 5, this is the user who chooses which files to sync to his computer

  • requirement 6: I think the nextcloud and app works and the files are not accessible

  • requirement 7 is always satisfied by default on nextcloud. When a new user is created, nextcloud create a new directory named by the name of the user inside the data directory set in config.php

@pabgan meant to say --> creating user folder on the (external storage) HDD not on the same host in which next cloud is hosted

You may want to have a look at an Ansible playbook I wrote. It supports

  • the installation and configuration of a Nextcloud instance on a RaspberryPi
  • with files being stored on an automatically mounted external drive
  • the automatic setup of users (configured)

However, this would not fulfill all your requirements (e.g. 6, but I think this requirement is not meaningful and actually conflicting with requirement 7 anyway).