CHMOD AND CHOWN for external HDD support - Permission denied

Hi all and again I am coming to you for support.

I am following the documents from nextcloud to set up local external directory. However I have been failing this miserably and cannot seem to get it to work.

  1. Setting datadirectory to an external HDD (I cannot seem to link it no matter what I did). When I refresh and I get error on Chrome. However if I do not change anything, then my nc14.0.3 works 100%
  • Internal Server Error
    The server encountered an internal error and was unable to complete your request.
    Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
    More details can be found in the server log.
  1. Setting up external HDD application support. I have done everything according to the manual with command below. However every time I use them and I get “Permission denied” error. But if I use chown -R www-data:www-data or CHMOD -R 0750 /path/to/new/external/dd and they work. However nextcloud app will not allow me to add the local drive …

https://docs.nextcloud.com/server/13/admin_manual/configuration_files/external_storage/local.html
https://docs.nextcloud.com/server/9/admin_manual/configuration_files/external_storage/local.html

sudo -u www-data chown -R www-data:www-data /localdir
sudo -u www-data chmod -R 0750 /localdir
sudo -u www-data bash (also permission error)

I would really appreciate anyone’s input suggestion on this. I assume it is more permission related rather than Nextcloud?

and I am running nc14.0.3 and Linux Mint 19 Tara and nginx as database

Thanks,
Brad

Can you check if the user has all permissions to show the folder:

sudo -u www-data ls -lisa /path/to/new/external/dd

Perhaps I don’t understand …

You will redirect the Nextcloud “data” Directory to an external disk? I can’t see, for what reason, nor knowing if it is possible.

I also use Linux Mint 19 build as a LAMP-Server but in a virtual Environment (VMware) with an underlying Win7 Host for basic purposes (DynDNS, remote VNC). On this Host, that SSD and outside the virtuall Maschine I have some shares, that I can mount from Linux. Doing this, you have to create a mount-point (or more) and then rewrite with the correct syntax in the table, located at /etc/fstab

`With sudo mount -a the shares will be activated without reboot linux.

Then you can get access in Nextcloud bei configuring the external storage “local” with the path to this share.

But … This share an its content ist “read only” by default. Up to now I have not found a way to make it writable in Nextcloud.

I take another road to have a writable directory outside Nextcloud. Because I am using VMware, there ist the possibility to define “Shared Folders”. In this way folders on the SSD even outside Nextcloud an outside linux. With the correct VMware-Tools installed in linux, these folders after restart will be mouted at /mnt/hgfs

And that folders are writable by default, but you can set them to read only by configuring VMwares “Shared Folders”. With Nextclouds WEBDAV you can access these folders from everywhere. I use this feature to backup some Content at my Android-Smartphone with the APP FolderSync.

If your system is on an SSD, a normal HDD has much more space. And it is clear that in a virtual system, you added one more layer of complexity.

I get permission denied.

And when I tested mounting point i.e. /media/hdd/ under external HDD, and I get a green tick but not /media/hdd/nextcloud_drive.

It is very odd…

Then you are missing some permissions very likely in the parent folders. The webserver user must at least have the execute permissions to be able to go through these folders. It’s like you give someone the key for a door inside a house but this person does not have the permission to enter the house.

Hi @ebertus

It is my understanding with the new NC and now you can also mount local External HDD as an access point. The other option which I did in the past was to change and re-direct the datadirectory to another external HDD /mount/external HDD for example. However I failed both methods this time miserably and I simply have no more clue how to fix this.

Hi @tflidd

I am really clueless now and maybe you can help?

This is the outcome of local directory (which I can access and set up by default)
drwxrwx— 5 www-data www-data 4096 Oct 28 16:09 data

This is the other outcome of external HDD data directory (which I cannot mount or use as another datadirectory)
drwxrwx—+ 5 www-data www-data 4096 Oct 28 16:14 data

and I just used stat to check folders access UID and GID and they are all identical and I even changed them. 0750 - 33/www-data - 33/www-data

Is this what you are referring to?

No I refer to the parent folder. If you new location is /path/to/new/external/dd, then perhaps you have the wrong permissions on folder /path or /path/to or …

I am not following. I can always remove the mounting and redo it again with another assigned mounting name. i.e. /media/partition1 to /mnt/partition1? So my questions are

  1. Does it matter how the drive is mounted initially? (it is in /etc/fstab)
  2. Does it mean the permission and ownership should only affect whats comes after? i.e. should I apply chown -R www-data:www-data to /mnt/partition1/ncdata (without /) and vice versa for chmod -R 0750?
  3. Or do I have to apply chown and chmod to /mnt/partition1?

Thanks,

Brad

Hi @tflidd

Mate, it worked! It had something to do with the mounting. Instead of using more than one path, I simply put it under /media/drive and now it can be mounted and I have also changed the datadirectory to external (just like the old days).

Now the next challenge would be… how to add other external HDD as local sharing with root and user account.

Hey, I’m running into the same problem, do you mind showing me either the /etc/fstab file or filing sudo ls -al /media so that I can see what permissions you used? Thank you!