Support for symlinks in external local read-only storage

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 20.0.7
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.2
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.41
PHP version (eg, 7.4): 7.4.3

The issue you are facing:
After upgrading to NC20 symlinks within my external local read-only storage seem to break the web UI. Accessing files via the android&webdav interface is still working without any errors. Which is strange as all errors in the web UI and logs indicate, that this is a general problem, not releated to accessing files via the web UI.
I already found Symlinks not supported? - #4 by BernhardPosselt and Error PHP You are using a fallback implementation of the intl extension. · Issue #10655 · nextcloud/server · GitHub which both seem to indicate that symlinks should not work in general, which was not the case before the upgrade.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Setup Nextcloud ~16
  2. Set up local read-only storage with a folder containing symlinks referencing only within the folder
  3. Upgrade to 20.x
  4. Getting notification “This directory is unavailable, please check the logs or contact the administrator” when opening /index.php/apps/files/ and “Exception during scan: Following symlinks is not allowed” when executing “occ files:scan --all”

The output of your Nextcloud log in Admin > Logging:
{“reqId”:“YOKHQf3fM39CtnnOXvK3”,“level”:3,“time”:“2021-02-19T21:19:36+00:00”,“remoteAddr”:"",“user”:"–",“app”:“core”,“method”:"",“url”:"–",“message”:“Following symlinks is not allowed (’/path/to/external/folder’ -> ‘/path/to/linked/folder’ not inside ‘/path/to/external/folder’)”,“userAgent”:"–",“version”:“”}
and many more line alike

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php $CONFIG = array ( 'instanceid' => '', 'passwordsalt' => '', 'secret' => '', 'trusted_domains' => array ( 0 => '', ), 'datadirectory' => '/var/www/nextcloud/data', 'overwrite.cli.url' => '', 'dbtype' => 'mysql', 'version' => '', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => '', 'dbpassword' => '', 'logtimezone' => 'UTC', 'installed' => true, 'memcache.local' => '\\OC\\Memcache\\APCu', 'maintenance' => false, 'theme' => '', 'loglevel' => 2, '' => 'stable', 'mail_smtpmode' => '', 'mail_domain' => '', 'mail_smtpauthtype' => '', 'mail_smtpauth' => 1, 'mail_from_address' => '', 'mail_smtphost' => '', 'mail_smtpport' => '', 'mail_smtpname' => '', 'mail_smtppassword' => '', 'mail_smtpsecure' => 'tls', 'trashbin_retention_obligation' => '30, 60', 'app_install_overwrite' => array ( 0 => 'calendar', ), 'updater.secret' => '', ); The output of "occ files:scan --all": Exception during scan: Following symlinks is not allowed #0 /var/www/nextcloud/lib/private/Files/Storage/Local.php(147): OC\Files\Storage\Local->getSourcePath() #1 /var/www/nextcloud/lib/private/Files/Storage/Local.php(162): OC\Files\Storage\Local->stat() #2 /var/www/nextcloud/lib/private/Files/Storage/Common.php(883): OC\Files\Storage\Local->getMetaData() #3 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/PermissionsMask.php(158): OC\Files\Storage\Common->getDirectoryContent() #4 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/PermissionsMask.php(158): OC\Files\Storage\Wrapper\PermissionsMask->getDirectoryContent() #5 [internal function]: OC\Files\Storage\Wrapper\PermissionsMask->getDirectoryContent() #6 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(408): iterator_to_array() #7 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren() #8 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren() #9 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(340): OC\Files\Cache\Scanner->scanChildren() #10 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(260): OC\Files\Cache\Scanner->scan() #11 /var/www/nextcloud/apps/files/lib/Command/Scan.php(152): OC\Files\Utils\Scanner->scan() #12 /var/www/nextcloud/apps/files/lib/Command/Scan.php(208): OCA\Files\Command\Scan->scanFiles() #13 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute() #14 /var/www/nextcloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run() #15 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1000): OC\Core\Command\Base->run() #16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand() #17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun() #18 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run() #19 /var/www/nextcloud/console.php(100): OC\Console\Application->run() #20 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...') #21 {main}