Exception while scanning: Following symlinks is not allowed

My server has multiple harddrives. One hosts the primary owncloud path. In my case /media/data/owncloud/data. But this harddrive has capacity too small. So I replaced the /files directories with symbolic links to other harddrives. It worked fine until I applied the latest update (version 9.1). Now new files cannot be uploaded to accounts with symbolic links.

Steps to reproduce
1. Create a new user.
2. replace it's "files" firectory with a symbolic link (ln -s) to another directory outside the default owncloud data directory.
3. Try to upload a new file via Webbrowser.
4. Alternatively execute: sudo -u www-data /occ files:scan

Actual behaviour
Via brwoser: Fehler beim Hochladen der Datei : Internal Server Error
Via command line and occ: Exception while scanning: Following symlinks is not allowed

Server configuration
Operating system: Linaro port of Linux Ubuntu for the Cubieboard 4.
uname -a => Linux doctor 3.4.39 #65 SMP PREEMPT Thu Apr 30 17:25:26 CST 2015 armv7l armv7l armv7l GNU/Linux
Web server: Apache 2
Database: MySql 14.14
PHP version: 5.5.9-1ubuntu4.17
ownCloud version (see ownCloud admin page): 9.1.0

Hi,

This is the expected behavior since 9.1: https://github.com/owncloud/documentation/issues/2493

Additionally using symlinks within the datadir itself are unsupported since a longer time (oC 8.0.x)

https://doc.owncloud.org/server/9.1/admin_manual/release_notes.html#owncloud-does-not-follow-symlinks

By doing an unsupported operation you need to expect that stuff will break at any time.

So it is not possible to use symlinks?

Unfortunately its not possible to use symlinks within the datadir as described in the first link above. However it might be possible to symlink the datadir itself (havn't tried that yet) from e.g.:

/var/www/owncloud/data

to

/path/to/new/data

I'm no expert, but I think the "external Storgage app" with the "local" option should be a suitble Solution.

Sure, if this is working for you then it might be suitable. The problem with that app is just that you can't place the root of your user at that external drive. The user always gets an additional folder in the files overview.

How about mounting the folder using mount --bind? Something like

mount --bind /destination/ /var/www/owncloud/user/files/folder

Bind mount helps and works with Nextcloud 12.

1 Like