Nextcloud App External Storage

briancmoses

Dabbler
Joined
Apr 19, 2014
Messages
29
First of all, I've shared this in Discord already but my pretty basic message hasn't warranted a response yet. I thought I'd post something more detailed in the forums.

I'm running TrueNAS SCALE (TrueNAS-SCALE-22.02-RC.1-1) and tinkering with the built-in apps. I'm trying to stand up an instance of Nextcloud using the official app, I've been working through the SCALE-specific directions that I found here, but I'm wanting to use a pre-existing dataset (/mnt/slow/nextcloud) to hold my users' Nextcloud data. Here's how my Nextcoud Data Volume is configured:

external-data.PNG


Whenever I try and pull up the Nextcloud web portal, I get an HTTP 403 Forbidden error message that says:
Forbidden
You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe

And inside the nextcloud container's log files, I see this:
2021-12-27 01:52:18.965844+00:00AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.16.0.38. Set the 'ServerName' directive globally to suppress this message
2021-12-27 01:52:18.984365+00:00AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.16.0.38. Set the 'ServerName' directive globally to suppress this message
2021-12-27 01:52:19.015005+00:00[Mon Dec 27 01:52:19.014867 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.51 (Debian) PHP/8.0.14 configured -- resuming normal operations
2021-12-27 01:52:19.015053+00:00[Mon Dec 27 01:52:19.014937 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
2021-12-27 01:52:54.637718+00:00[Mon Dec 27 01:52:54.637528 2021] [core:crit] [pid 29] (13)Permission denied: [client 10.7.0.206:62593] AH00529: /var/www/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/' is executable

I've tinkered a bit with the /mnt/slow/nextcloud dataset's permissions, but haven't had much luck. I tried:
  1. Recursively granted the user, "apps," Allow | Full Control permissions, stopped Nextcloud, and started Nextcloud.
  2. Recursively granted @Everyone Allow | Full Control permissions, stopped Nextcloud, and started Nextcloud.
In both cases, I continued to get the 403 Forbidden error message and see the logs captured above.

Out of curiosity, I deleted the app and re-deployed it without setting up the Nextcloud Data Volume. When I do that, Nextcloud works just fine. The Nextcloud web interface opens just fine without any 403 errors. However, this isn't an option for me because the pool that the container is being installed on does not have the capacity to store all of the user-data that Nexcloud is ultimately going to be responsible for.

.htaccess Permissions: Official Nextcloud App with a Nextcloud Data Volume

Code:
root@nextcloud-b95b67f47-qpc72:/var/www/html# ls -l .htaccess;stat .htaccess
---------- 1 root root 3204 Dec 23 14:26 .htaccess
  File: .htaccess
  Size: 3204            Blocks: 17         IO Block: 3584   regular file
Device: a6h/166d        Inode: 188179      Links: 1
Access: (0000/----------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-12-27 02:14:42.762345469 +0000
Modify: 2021-12-23 14:26:58.072895968 +0000
Change: 2021-12-23 15:17:18.759194092 +0000
 Birth: 2021-12-23 14:26:58.072895968 +0000


.htaccess Permissions: Official Nextcloud App without a Nextcloud Data Volume
Code:
root@nextcloud-6754dc8f79-dhjcj:/var/www/html# ls -l .htaccess;stat .htaccess
-rw-r--r-- 1 www-data root 4336 Dec 27 02:28 .htaccess
  File: .htaccess
  Size: 4336            Blocks: 17         IO Block: 4608   regular file
Device: b7h/183d        Inode: 384         Links: 1
Access: (0644/-rw-r--r--)  Uid: (   33/www-data)   Gid: (    0/    root)
Access: 2021-12-27 02:28:48.674175343 +0000
Modify: 2021-12-27 02:28:40.730067214 +0000
Change: 2021-12-27 02:28:40.730067214 +0000
 Birth: 2021-12-27 02:28:19.669780578 +0000


Am I wrong in thinking that for some reason, the permissions to the .htaccess file are different between these two configurations of the official Nextcloud app?

I know that the documentation for SCALE probably isn't fully-baked yet, but I was wondering if there might be any better information out there on the most appropriate way to add additional Nextcloud Data Volume(s) from outside of the container.
 

ClassicGOD

Contributor
Joined
Jul 28, 2011
Messages
145
Try recursively setting permissions on the volume to owner www-data group root with full permissions.
 

briancmoses

Dabbler
Joined
Apr 19, 2014
Messages
29
Thanks, @ClassicGOD that wound up being helpful and moving me along. It was definitely a permissions issue, though.

But it's interesting, but the errors I was getting had nothing to do with the mount of my additional Nextcloud Data Volume(s). For anyone that might run in to this, I wound up needing to do the following via the shell for the Nextcloud app
  1. chmod 644 /var/www/html/.htaccess
  2. chown www-data:www-data /var/www/html/.htaccess
  3. chmod 755 -R /var/www/
  4. chown -R www-data:www-data /var/www/
 

Red_A

Cadet
Joined
Feb 19, 2022
Messages
1
2022.2.20, with TrueNAS SCALE 22.02-RC.2, same 403 issue, I tryed ClassicGOD's plan and problem solved.
Try recursively setting permissions on the volume to owner www-data group root with full permissions.
 

toyvo

Cadet
Joined
Feb 25, 2022
Messages
2
  1. chmod 644 /var/www/html/.htaccess
  2. chown www-data:www-data /var/www/html/.htaccess
  3. chmod 755 -R /var/www/
  4. chown -R www-data:www-data /var/www/
I found these instruction to fix the same issue I was having, though it should be noted that steps 3 & 4 override 1 & 2 since they come after, it technically just adds execute permissions to .htaccess, though I don't really know if that actually makes a difference since its not a script or anything that could be executed
 

toyvo

Cadet
Joined
Feb 25, 2022
Messages
2
Sorry for the extra post here, but when I just applied the ower to www-data to the entire nextcloud dataset as suggested by ClassicGod, it didn't work for me, the server wouldn't come back up.
 
Joined
Jun 24, 2022
Messages
1
Hey everyone I am new here and new with TrueNAS I am having the same issue. I tried running the commands in Shell but I get back that directory does not exist. I think the issue might be in the dataset permissions I am trying to set up. Here is what mine looks like.
 

Attachments

  • Screenshot 2022-06-24 113507.png
    Screenshot 2022-06-24 113507.png
    76 KB · Views: 549

awil95

Dabbler
Joined
Apr 23, 2017
Messages
28
I recently had this same issue. Granting www-data full access to the nexcloud config dataset solved the "You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe" issue.
 
Top