I have been fighting this problem for more than a week and have read a lot of topics, but my problem remains unsolved.
The problem is that the NC does not have the proper permission to acces the external storage added as local.
I get the Failed to open directory: Permission denied at /snap/nextcloud/35878/htdocs/lib/private/Files/Storage/Local.php#154
The HDD is mounted to /mnt/razmena folder and is not owned by root. It has 771 permission.
I could do the 777 and the NC would finaly see the files, but I am not about to give everyone access to it. Even then, the problem is back in the first subdirectory owned by anyone other than root.
The obvious beginner next step is to enable removable media with
sudo snap connect nextcloud:removable-media
Done with no luck. Restarted service, rebooted… No luck.
Little background on what I am using.
VM with ubuntu server installed on proxmox.
I had the exact same problem on debian VM
NC is version 26 installed via snap.
I would be able to accept defeat and admit I am doing something wrong if i didn’t have the exact same configuration on RPI raspbian. Using the very same HDD. I can swap the USB cable from server to RPI and the NC on RPI would see the files from /mnt/razmena. So obviously, the ownership and permissions are not the problem, it is the settings, but other than connecting removable media.
root does have access to the files and folders. I can access everything from webmin interface which is accessing everything as root. So seing files, rename, delete… can be done by root.
I have now just tried to add another drive, but this time, it was formated and file system was created on this machine. Just in case some permission is carried from the other system. Still no luck
I have just installed the fresh copy of rpi os to the new memory card. Got all the same apps that I have on ubuntu vm and configured it the same way with same users. External storage works.
So it is not my configuration since that is very basic, but somewhere deeper.
I am not sure, but I have seen during my experience of running Snap Nextcloud, may be due to it’s confinement limitations, external storage must be mounted to either /mnt or /media location. It wont access anything outside those two locations as external storage…
Check if your external mount is within those two locations.
Ok, thanks for that reply, that is definately news to me.
Lets forget about the rpi os for a moment, can you tell me the point of connect removable media and its use in the ubuntu as the supported distro?
Focusing on ubuntu: yes. You should be able to connect the removable-media interface and you will gain access to the /media and /mnt directories on the host. Each directory that makes up the path you’re wanting to use as the data directory (i.e. /, /mnt, /mnt/razmena and so on) will need to be owned by root.
Being owned by root really makes no sense to me. It is quite limiting. It works only in the case of the whole drive being used by nextcloud only and not being accessed by or from anywhere else.
I would asume that external storage is not exclusive to root, otherwise it would be either internal or useless as external.
I am trully sorry this may sound rude, but i simply cannot accept that as the designed feature.
That means that no matter the location, nextcloud wil not see any file not owned by root.
I have managed to get a workaround for this. Quite a fun and silly thing, but it works.
I have added the external storage as SFTP. host is “localhost”, root (directory) is /mnt/whatever.
Because my main ubuntu user has a lot of privileges, I have created a new dummy user and used that for auth. Not only that it can see the /ext but it can see everything that the users member can if i need it.
The only thing is that I am not sure if SFTP is maybe a little slower and if it is heavy on the resources.
Not that the speed matters much as the main intention of NC is access from outside the local network over internet and the main limit will be my home internet upload speed.
I will have to check if switching to FTP is ok, since it is not being accessed over network, only localy within that one VM.
Another update. After using SFTP as external storage, as I suspected, it destroys the performance. Upload and download are somewhat OK, but videos are impossible to play. Downloading larger files is insanely slow.
I have been tinkering again with many settings and found a compromise in giving permission to others. For folders it is r-x and for files it is r–. My samba dir mask is 775 and create mask 754.
In this case, ownership has no effect. Neither folders nor files have to be owned by root.
Actually, changing ownership to root does not help at all in my case. Also, putting root to users group does nothing.