External Storage Permission Issue | Can't upload files | Can't see files

I installed Nextcloud by following this guide. I set apache as the owner of the /var/www/html/nextcloud/ directory. I have two hard drives running on a software RAID where I backup my computer, store my plex files, and hopefully where I can store my Nextcloud files. I originally had tried to directly set that up as the storage instead of /var/www/html/nextcloud/databut it didn’t matter how many times I tried to set apache as the owner of a/mnt/NAS/nextclouddirectory I could not get it to work. I also saw a post saying to change settings for that drive in /etc/fstab which I did attempt and it wouldn’t allow the drive to be mounted at all or even worked with Nextcloud.

I have nothing stored on my Nextcloud right now, so if you guys know of a better installation method I’m down to try it. I’m trying to install Nextcloud on my main disk, under apache or nginx whichever you guys suggest I use. I want to be able to put all the files on my hard drives running under my /mnt/NAS drive in a subfolder. I want to be able as my user to access those files as well.

Here’s what the fstab for that drive looks like:

/dev/disk/by-uuid/99eea0b8-c699-4479-bb6f-cc7ed6d8f33f /mnt/NAS auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=RAID 0 0

As of right now, I got my NAS drive listed on my Nextcloud, but I can’t create files, folders in it through the UI, and if I sudo as apache and create a drive it also doesn’t appear in the UI of the web app.

Nextcloud version (eg, 20.0.5): 21.0.1
Operating system and version (eg, Ubuntu 20.04): Fedora 34 (Kernel 5.11.300
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.46
PHP version (eg, 7.4): 7.4.16

The issue you are facing:
Unable to view or write to external storage RAID device.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Install Nextcloud
  2. Add external device (It is detected in UI)
  3. No files load or are uploaded

The output of your Nextcloud log in Admin > Logging:

Error	internet_connection_check	GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.edri.org/	
2021-05-10T05:23:13-0400
Error	internet_connection_check	GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.eff.org/	
2021-05-10T05:23:13-0400
Error	internet_connection_check	GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.startpage.com/	
2021-05-10T05:23:13-0400
Error	internet_connection_check	GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.nextcloud.com/	
2021-05-10T05:23:13-0400
Error	PHP	Error: opendir(/mnt/NAS/nextcloud/): failed to open dir: Permission denied at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#134	
2021-05-10T05:20:51-0400
Error	PHP	Error: chmod(): No such file or directory at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#91	
2021-05-10T05:20:13-0400
Error	internet_connection_check	GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.edri.org/	
2021-05-10T05:19:16-0400
Error	internet_connection_check	GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.eff.org/	
2021-05-10T05:19:16-0400
Error	internet_connection_check	GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.startpage.com/	
2021-05-10T05:19:16-0400
Error	internet_connection_check	GuzzleHttp\Exception\ConnectException: cURL error 7: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://www.nextcloud.com/	
2021-05-10T05:19:16-0400
Error	PHP	Error: chmod(): No such file or directory at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#91	
2021-05-10T05:17:49-0400
Error	PHP	Error: opendir(/mnt/NAS/nextcloud/): failed to open dir: Permission denied at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#134	
2021-05-10T05:17:45-0400
Error	PHP	Error: opendir(/mnt/NAS/nextcloud/): failed to open dir: Permission denied at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#134	
2021-05-10T05:11:35-0400
Error	PHP	Error: chmod(): No such file or directory at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#91	
2021-05-10T05:06:25-0400
Error	PHP	Error: chmod(): No such file or directory at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#91	
2021-05-10T05:03:17-0400
Error	PHP	Error: opendir(/mnt/NAS/): failed to open dir: Permission denied at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#134

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'redacted',
  'passwordsalt' => 'redacted',
  'secret' => 'redacted',
  'trusted_domains' => 
  array (
    0 => '10.0.0.6',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => 'http://10.0.0.6/nextcloud',
  'dbname' => 'redacted',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nc_admin',
  'dbpassword' => 'redacted',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

[Mon May 10 04:30:37.428708 2021] [access_compat:error] [pid 5928:tid 6115] [client 10.0.0.6:58812] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Mon May 10 04:48:49.161798 2021] [mpm_event:notice] [pid 5926:tid 5926] AH00492: caught SIGWINCH, shutting down gracefully
[Mon May 10 04:49:25.169500 2021] [core:notice] [pid 3011:tid 3011] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Mon May 10 04:49:25.170590 2021] [suexec:notice] [pid 3011:tid 3011] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.0.0.6. Set the 'ServerName' directive globally to suppress this message
[Mon May 10 04:49:25.176129 2021] [lbmethod_heartbeat:notice] [pid 3011:tid 3011] AH02282: No slotmem from mod_heartmonitor
[Mon May 10 04:49:25.176451 2021] [http2:warn] [pid 3011:tid 3011] AH02951: mod_ssl does not seem to be enabled
[Mon May 10 04:49:25.177505 2021] [mpm_event:notice] [pid 3011:tid 3011] AH00489: Apache/2.4.46 (Fedora) configured -- resuming normal operations
[Mon May 10 04:49:25.177512 2021] [core:notice] [pid 3011:tid 3011] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Mon May 10 05:01:05.607738 2021] [access_compat:error] [pid 5506:tid 5561] [client 10.0.0.6:55530] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Mon May 10 05:01:17.136682 2021] [access_compat:error] [pid 5506:tid 5556] [client 10.0.0.6:55548] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Mon May 10 05:02:45.238984 2021] [access_compat:error] [pid 5506:tid 5554] [client 10.0.0.6:55598] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Mon May 10 05:19:16.278156 2021] [access_compat:error] [pid 5506:tid 5561] [client 10.0.0.6:55948] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata
[Mon May 10 05:23:13.067943 2021] [access_compat:error] [pid 3077:tid 3270] [client 10.0.0.6:56056] AH01797: client denied by server configuration: /var/www/html/nextcloud/data/.ocdata

Looks Like I was able to get it to work by using the snap version of Nextcloud. All I had to do was install it, open the site, enable the addon for external storage and it worked immediately.

You probably didn’t set the correct unix permissions that are needed for normal installations to make it work…

Yeah, I had made both directories owned by Apache and had both folders set to chmod 0775. So I don’t know what specific part I got wrong. Anyway it’s solved now since I’m using the snap version.