Nextcloud : no more access to Multimedia directory

:uk:/:us:

My YunoHost server

Hardware: Raspberry Pi at home
YunoHost version: 3.8.5
I have access to my server : Through SSH | through the webadmin |
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Hello,
I have recently upgraded NextCloud to version 19. I can no more access the Multimedia directory. It tells me “This operation is denied” (Cette opération est interdite).

It works for the user who is also the NextCloud admin. But no more for other users.

Here is the Nexcloud log error

[no app in context] Error: OCP\Files\ForbiddenException: Following symlinks is not allowed at <<closure>>

 0. /var/www/nextcloud/lib/private/Files/Storage/Local.php line 161
    OC\Files\Storage\Local->getSourcePath("/Share")
 1. /var/www/nextcloud/lib/private/Files/Storage/Common.php line 884
    OC\Files\Storage\Local->getMetaData("/Share")
 2. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/PermissionsMask.php line 158
    OC\Files\Storage\Common->getDirectoryContent("")
 3. <<closure>>
    OC\Files\Storage\Wrapper\PermissionsMask->getDirectoryContent("")
 4. /var/www/nextcloud/lib/private/Files/Cache/Scanner.php line 408
    iterator_to_array(Generator {})
 5. /var/www/nextcloud/lib/private/Files/Cache/Scanner.php line 388
    OC\Files\Cache\Scanner->handleChildren("", false, 3, 164775, true, 0)
 6. /var/www/nextcloud/lib/private/Files/Cache/Scanner.php line 340
    OC\Files\Cache\Scanner->scanChildren("", false, 3, 164775, true)
 7. /var/www/nextcloud/lib/private/Files/View.php line 1339
    OC\Files\Cache\Scanner->scan("", false)
 8. /var/www/nextcloud/lib/private/Files/View.php line 1383
    OC\Files\View->getCacheEntry(OCA\RansomwarePr ... l}, "", "/myuser/files/Multimedia")
 9. /var/www/nextcloud/lib/private/Files/Node/Root.php line 201
    OC\Files\View->getFileInfo("/jeanmichel/files/Multimedia")
10. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 138
    OC\Files\Node\Root->get("/jeanmichel/files/Multimedia")
11. /var/www/nextcloud/apps/text/lib/Controller/WorkspaceController.php line 111
    OC\Files\Node\Folder->get("/Multimedia")
12. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 170
    OCA\Text\Controller\WorkspaceController->folder("/Multimedia")
13. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 100
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Text\Control ... {}, "folder")
14. /var/www/nextcloud/lib/private/AppFramework/App.php line 137
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Text\Control ... {}, "folder")
15. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OCA\\Text\\Cont ... r", "folder", OC\AppFramework\ ... {}, {_route: "ocs.text.Workspace.folder"})
16. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({_route: "ocs.text.Workspace.folder"})
17. /var/www/nextcloud/lib/private/Route/Router.php line 297
    call_user_func(OC\AppFramework\ ... {}, {_route: "ocs.text.Workspace.folder"})
18. /var/www/nextcloud/ocs/v1.php line 88
    OC\Route\Router->match("/ocsapp/apps/text/workspace")
19. /var/www/nextcloud/ocs/v2.php line 24
    require_once("/var/www/nextcloud/ocs/v1.php")

GET /nextcloud/ocs/v2.php/apps/text/workspace?path=%2FMultimedia
from 2a01:e0a:23d:89c0:4d97:567c:ac1f:b96d by myuser at 2020-10-11T21:21:08+00:00
[core] Error: Following symlinks is not allowed ('/home/yunohost.multimedia/myuser//Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/myuser/')

I wanted to check with command line but I get this :

sudo -u nextcloud php /var/www/nextcloud/occ files_external:list
This version of Nextcloud requires at least PHP 7.2<br/>You are currently running 7.0.33-31+0~20201008.38+debian9~1.gbp9ec6f1. Please update your PHP version.

In addition, folder exists on the disk. With both paths :

  • /home/yunohost.multimedia/myuser/Picture
  • /home/myuser/Multimedia/Picture
sudo -u nextcloud php7.3 /var/www/nextcloud/occ files_external:list

Thanks @ljf. Here is the output

sudo -u nextcloud php7.3 /var/www/nextcloud/occ files_external:list
+----------+-----------------------+---------+---------------------+-----------------------------------------------+----------------------+------------------+-------------------+
| Mount ID | Mount Point           | Storage | Authentication Type | Configuration                                 | Options              | Applicable Users | Applicable Groups |
+----------+-----------------------+---------+---------------------+-----------------------------------------------+----------------------+------------------+-------------------+
| 1        | /Multimedia           | Local   | None                | datadir: "\/home\/yunohost.multimedia\/$user" | enable_sharing: true | All              |                   |
| 3        | /Multimedia           | Local   | None                | datadir: "\/home\/yunohost.multimedia\/$user" | enable_sharing: true | All              |                   |
| 4        | /Shared multimedia    | Local   | None                | datadir: "\/home\/yunohost.multimedia\/share" | enable_sharing: true | All              |                   |
| 13       | /Multimedia           | Local   | None                | datadir: "\/home\/yunohost.multimedia\/$user" |                      | All              |                   |
+----------+-----------------------+---------+---------------------+-----------------------------------------------+----------------------+------------------+-------------------+

I don’t know why I have multiple occurrences. It might be either when I add a user or when there is a NextCloud upgrades but it comes again and again.

My problem looks very similar to this thread Nextcloud : liens home et multimedia KO

[core] Error: Following symlinks is not allowed ('/home/yunohost.multimedia/myuser//Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/myuser/')

This Share symlink was present in each $user folder. Based on the error code, I have deleted all offending symlinks because I do not use them. This sort of solves the problem … but I don’t know where they come from (Nextcloud, Yunohost or Debian) and why this suddenly stopped working.

Hi,

This symlink comes from Yunohost, more precisly from here: https://github.com/YunoHost-Apps/yunohost.multimedia/blob/da1d5f0ac6bc0ca01addf669be3131c66ce2183e/hooks/post_user_create#L12

I don’t know exactly why it doesn’t work anymore since Nextcloud 19, but we should either remove this symlink or allow symlink inside Nextcloud