I have installed nextcloud 12 in a server running ubuntu 16.04. I have only one user account on this server. My data directory is /var/www/nextcloud/data
I want access to a folder in my home directory on this server through the nextcloud web interface so I can access it from anywhere.
I tried adding the folder as local external storage, but I have been unable to see the files inside the folder. I have tried to give recursive ownership of the parent folder. to www-data and also done chmod 750 on the files inside the folder. However I still cannot see the files and I am giving up on the external storage option.
Is there a way I can symlink the parent folder to the next cloud data directory so I can access it through NC? If so, please explain how I can do this.
Edit: The reason I was not able to access the files was because they were on an ntfs partition. I solved this by following the answer below.
The foundational purpose of Nextcloud is file sharing, yet it is nothing short of a 100 meter hurdle obstacle dash to even enable removable-media or external data storage abilities. Every possible ability to do this quickly and easily should be in place from day one.
I see someone in this particular thread on this very topic declaring no symlinks are allowed. Symlinks which in the case of Nextcloud would be buried in a /var directory and couldn’t be changed nor added unless a remote user gained the rather unlikely superuser status on your local system. If a attacker gained superuser status on your local system, not providing symlinks ability wouldn’t present a overwhelming obstacle to them having their way on most any system.
I’ve lost count from all the countless posts, articles, discussions from Nextcloud users begging for help on their failed external HD attempts to store Nextcloud files other than on a server’s tiny SSD where the Nextcloud is stored with the system files. Do the Nextcloud developers realize the scope and quantity of Nextcloud users frantically asking for easier, instant abilities to enable external storage and have that immediately available?
There’s also many reported issues with the ‘addon’ external storage plugin yet that is nearly all there is at this version 13.x point. This should not be that difficult, nor a after thought, file sharing is a primary feature and should be as automated as possible for successful use of external local server hard drives.
In Nextcloud 13.0.2 with “External Storage Support” app 1.4.1 there is an option to add a “local” storage type that can then be defined with a standard filepath: /path/to/somewhere/ (for Linux).
It is only available in the External Storage App in the system settings, not in the personal settings (you need to be admin).
The target needs to be accessible by the webserver user (e.g. “http” for nginx or another one depending on your webserver, distro and config)
I do not know which minimal Nextcloud / External Storage Support version is necessary to choose this storage type.
First of all sorry for reviving an old thread, but I think it’s still relevant.
I agree that generally disallowing symlinks is a good security decision by default as it removes a whole category of potential security holes, BUT would it not be possible to add a configuration option that lets admins override and disable that restriction (kind of like a –yes-i-know-what-i-am-doing flag)?
In my particular case I want to store the user data directories on a NFS share at our central storage server, but not the files that nextcloud uses (logs, updater, static files etc) because then page loading becomes significantly slower because of many tiny NFS calls.
How would you suggest that I solve this? Our Nextcloud is hosted in a VM with a relatively small local disk image, and I’m reluctant to expand it to fit user data as SSD space is more in demand/costly than regular hard disks…
Mount the NFS share as /data and put your datadir there via setup like its a common known best practice. In this case, apart from user files only nextcloud.log will be in /data and i guess (not sure, i have not touched a live system for some time now) even that can be configured in config.php.
Like @Ascendancer said, you can always just change the datadir path in your Nextcloud config to support your use case. I’ve done this myself, keeping the Nextcloud files on an SSD and pointing the Nextcloud data directory to my hard disk (so not NFS, in my case). And this works perfectly well.
But if you want a “yes-I-know-what-I-am-doing” option for symlinks, I think you could also just create a bind mount instead of a symlink. That should look like a normal directory to Nextcloud so it can not treat it any differently and you would still be able to mount your external disk elsewhere initially. I’m not sure what the implications are of this, though. But my point is that if you know what you’re doing, this doesn’t really need to be enabled within Nextcloud.
I´m ashamed to admit, that i have been out of the game for about a year, but to my knowledge, changing the datadir in the config is not supported, and needs to be set on ititial setup, it may lead to freak phenomena. Correct me please if this has changed since version 12.
That’s exactly what I did during setup (placed datadirectory on a NFS mount), and now the setup is incredibly slow - hence the troubleshooting to find out what’s happening.
Log file location can be configured (parameter “logfile”, default=[datadir]/nextcloud.log), that’s correct - I have configured it to be on the local file system to reduce any possible slowdowns there.
@arucard thanks for the tip about bind mounts, I didn’ think about that but it seems to work just great (although the performance is still the same, so the problem might be something else)
If you’re having performance issues with NFS, you’re probably better off using the External Storage app in Nextcloud for accessing this NFS mount as a “Local” External Storage location. That way you can keep the Nextcloud data directory on your faster, local disk.
I don’t think Nextcloud is intended for using network-attached storage as the main location for its application data. Perhaps you can try to get Nextcloud installed on the machine where your NFS share is located (since you could then use a local data directory for Nextcloud).