Server: Allow symlinks configuration property

Created on 17 Oct 2018  路  17Comments  路  Source: nextcloud/server

Provide configuration setting for allowing symlinked data directory.

Currently it is hardcoded to false:
https://github.com/nextcloud/server/blob/master/lib/private/Files/Storage/Local.php#L55

Steps to reproduce

  1. Create a directory on linux ext filesystem: mkdir/test
  2. Create a symlink to that directory: ln -s /test /data
  3. Use /data

Expected behaviour

I should be able to enable symlinks in a config, not by changing a php file variable.

Actual behaviour

Canot use symlinked data dir.

Server configuration

Operating system: Linux Debian (amd64, arm)

Web server: nginx

Database: postgresql

PHP version: 7.1.21

Nextcloud version: 14.0.0

Updated from an older Nextcloud/ownCloud or fresh install: fresh

Where did you install Nextcloud from: Syncloud

0. Needs triage bug needs info stale

Most helpful comment

I run nextcloud on my small server and after EVERY upgrade I have to manually edit this file. This is just ridiculous.
I need symlinks because my files are located out of nextcloud files folder.
And no, I will not move all my files there because nextcloud is not the only cloud engine I use to backup my files. And every single one cloud client I use works fine with symlinks, only nextcloud somehow just does not want to...
Is this because of security concerns? I don't need it. If I know, what I am doing, I have to have a possibility to do this. That's a FOSS spirit!

All 17 comments

GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/4109 (Allow chunked public upload), https://github.com/nextcloud/server/pull/10121 (allow to disable encryption), https://github.com/nextcloud/server/pull/10120 (allow to disable encryption), https://github.com/nextcloud/server/issues/140 (Global OAuth Configuration), and https://github.com/nextcloud/server/issues/11075 (Allow root owned config.).

Do you mean specify absolute path instead of a link in the config?

Not really, on Syncloud device you can activate different external disks and we do not want to change configs of all the apps on a device (not only Nextcloud) to point to.a new device dir.
To simplify that we use /data symlink (can be anything) and change the link to point to a selected disk dir.
Of cause we need to run post disk activate actions still per app, but I thought not changing data dirs in the app configs will be simpler.

It was working fine before v14, that is kind of another reason.

Would be a great feature when using systemd ProtectHome=yes because nextcloud thinks files inside of it are symlinks.

I run nextcloud on my small server and after EVERY upgrade I have to manually edit this file. This is just ridiculous.
I need symlinks because my files are located out of nextcloud files folder.
And no, I will not move all my files there because nextcloud is not the only cloud engine I use to backup my files. And every single one cloud client I use works fine with symlinks, only nextcloud somehow just does not want to...
Is this because of security concerns? I don't need it. If I know, what I am doing, I have to have a possibility to do this. That's a FOSS spirit!

This PR is also relevant if you're running php-fpm in chroot environment.
Any update devs?

A similar issue https://github.com/nextcloud/server/issues/10904. Probably a workaround for some of you: Create custom.config.php next to config.php like below.

<?php

$datadirectory = realpath('/path/to/symlink');
if ($datadirectory === false) {
    exit('failed to resolve datadirectory symlink');
}

$CONFIG['datadirectory'] = realpath($datadirectory);

Nextcloud updater (cli or web) do not read custom configuration files. That's usually not a problem because the configuration is merged. But if you use the above way please make sure to check the datadirectory in config.php before using the updater. Probably it's not the right path.

@kesselb can you open a pr?

No :) That's something for the config files.

So, to develop?

I don't know :) For some reason following symlinks is disabled by default. You might ask team storage about that.

This issue seems to be a request to make follow symlinks on/off a configuration option.

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

@kesselb can you open a pr?

@skjnldsv What info do you need?

If I'd only knew the NC core better I'd male a PR myself.

It's clear as vodka: Now in
https://github.com/nextcloud/server/blob/6aea539745c5c7b7d80525672be5a90dae4028bb/lib/private/Files/Storage/Local.php#L58

$allowSymliks is hardcoded to False. Instead it SHOULD take value form a configuration file (if it exists there, or false by default.

I just cannot imagine what other info is required?

@dredkin missing info from us ;)

cc @rullzer @nickvergessen @blizzz @MorrisJobke ?

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

please let me know another way to extend the storage size.
I was running out of space on the disk where the data is stored and had to "move" one very big directory elsewhere and use a symbolic link to reconnect it.
after setting
protected $allowSymlinks = true;
as mentioned above it works again

Was this page helpful?
0 / 5 - 0 ratings