Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow symlinks configuration property #11879

Closed
cyberb opened this issue Oct 17, 2018 · 18 comments
Closed

Allow symlinks configuration property #11879

cyberb opened this issue Oct 17, 2018 · 18 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug needs info stale Ticket or PR with no recent activity

Comments

@cyberb
Copy link
Contributor

cyberb commented Oct 17, 2018

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

@kesselb
Copy link
Contributor

kesselb commented Oct 17, 2018

/**
* Where user files are stored. The SQLite database is also stored here, when
* you use SQLite.
*
* Default to ``data/`` in the Nextcloud directory.
*/
'datadirectory' => '/var/www/nextcloud/data',

Does not work for you?

@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #4109 (Allow chunked public upload), #10121 (allow to disable encryption), #10120 (allow to disable encryption), #140 (Global OAuth Configuration), and #11075 (Allow root owned config.).

@cyberb
Copy link
Contributor Author

cyberb commented Oct 17, 2018

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.

cyberb added a commit to syncloud/nextcloud that referenced this issue Oct 17, 2018
@kesselb kesselb added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Jan 20, 2019
@Thaodan
Copy link

Thaodan commented Apr 21, 2019

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

@dredkin
Copy link

dredkin commented Jul 11, 2019

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!

@gituser
Copy link

gituser commented Aug 5, 2019

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

@kesselb
Copy link
Contributor

kesselb commented Jan 18, 2020

A similar issue #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.

@skjnldsv
Copy link
Member

@kesselb can you open a pr?

@kesselb
Copy link
Contributor

kesselb commented Apr 10, 2020

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

@skjnldsv
Copy link
Member

So, to develop?

@kesselb
Copy link
Contributor

kesselb commented Apr 10, 2020

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.

@ghost
Copy link

ghost commented May 10, 2020

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.

@ghost ghost added the stale Ticket or PR with no recent activity label May 10, 2020
@dredkin
Copy link

dredkin commented May 11, 2020

@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

protected $allowSymlinks = false;

$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?

@ghost ghost removed the stale Ticket or PR with no recent activity label May 11, 2020
@skjnldsv
Copy link
Member

@dredkin missing info from us ;)

cc @rullzer @nickvergessen @blizzz @MorrisJobke ?

@blizzz
Copy link
Member

blizzz commented May 13, 2020

Use bind mounts instead? #1257 (comment)

@ghost
Copy link

ghost commented Jun 12, 2020

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.

@ghost ghost added the stale Ticket or PR with no recent activity label Jun 12, 2020
@ghost ghost closed this as completed Jun 26, 2020
@ferdiga
Copy link

ferdiga commented Jul 31, 2020

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

@masterxq
Copy link

masterxq commented Jan 26, 2023

Use bind mounts instead? #1257 (comment)

This is a good and working solution, add to your /etc/fstab something like:
/mnt/big_data/somepath /var/local/nextcloud/user/files/special_path none defaults,bind 0 0
Then
mount /var/local/nextcloud/user/files/special_path
It will be mounted every boot and persist!

This will work in many cases perfectly.

Best Regards

Edit: swapped arguments

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug needs info stale Ticket or PR with no recent activity
Projects
None yet
Development

No branches or pull requests

10 participants