Help integrating Nextcloud with existing unRAID file structure [long]

So I’m quite familiar with both Nextcloud and unRaid at this point (but by no means an expert). But one thing I’ve thought a lot about is how to integrate Nextcloud with my existing file structure and file permissions.

Right now I have the normal unRAID setup with public SMB shares and various docker containers. Now Nextcloud can access the existing files by mounting SMB shares inside of Nextcloud, but this is quite slow and I would preferably mount the directories locally like one mounts directories in a docker container. The problem with this is that Nextcloud wants to control file permissions and indexing within its own datafolder. Just linking existing shares from unRAID into Nextcloud would (to my understanding) break file permissions and I would no longer be able to access any new or updated files (by Nextcloud) from SMB. Neither would any other container like qbittorrent, emby, sonarr or anything else.

As I see it, one way around this would be to change all users to the same ID. Or putting all users into the same group. But this is where my knowledge ends and where I’d like some help.

What I want to achieve is pretty clear. I want to be able to access all files from SMB and control them as I please, but sill be able to see and manipulate ALL those files from Nextcloud as well, having all containers work like they should and having no permissions difficulties.

I want to note that my main use for Nextcloud is accessing Photos and Documents.

I know this might not be the way Nextcloud is meant to be used and I’m 100% open to suggestions on how I can set this up.

You can ether set SMB permissions to 777, so that any user can access it (NC also), or added NC user to samba group and set permissions to e.g. 770 or 775. Check this out:

Thanks, i have no problem adding SMB shares into Nextcloud, and permissions work fine. But i don’t want to, since SMB is slow compared to local storage.

Yes, this solution works if you added folders as local folders. Access will be “extremely” quick. But you need to have correct permissions.
Added it as local external Storage under https://YOURDOMAIN/index.php/settings/admin/externalstorages. More information about it is here: https://docs.nextcloud.com/server/15/admin_manual/configuration_files/external_storage/local.html

Remember that you have to rescan your storage’s periodically, I wrote a script that will rescan externals only and added it to OS cron.

I’ve added local storage and everything is working. The issue is that files created in those directories by Nextcloud are not writable or executable by me over SMB or by any other container on my server. How do i fix this?

When running sudo chown -R www-data:www-data /path/to/localdir i get user does not exist.

I’m running Nextcloud in docker if that makes any difference.

I just realised that when accessing SMB shares on LAN with “Guest” I have full permissions but when i access as “myname” files created by Nextcloud are locked. Why is that?

Oh, it makes a huge difference. You have to search how to ensure that docker container could access your directory and back. For example this:

This is topic for SMB setup. Generally you have to set who can access and what. In your particular case it seems you did setup SMB more restricted for authenticated users as for guests. Personally I prefer disabling of guests accounts everywhere.
Also SMB will use OS Level users, this means guest is not your “myname” user. Guest user will access as Samba Service User, but with “myname” you will access with a different OS user. If you have permissions e.g. 700, all files will not be accessible for “myname”, but for Samba guest instead. If you put it to 777 all users within all groups could access them.