Skip to content

[Bug]: External storage (sftp) with restricted permissions fails with "Storage is temporarily not available" #46047

Open

Description

⚠️ This issue respects the following points: ⚠️

Bug description

Linked external sftp storage, where some folders are not readable to the user, as it is common in shared storages, are only partially visible. Scanning the storage stops on the first encounter of an inaccessible folder.

Entering folder with no permission through the website throws an error "Storage is temporarily not available". The website remains in a somewhat broken state, as the current folder is not read.

Steps to reproduce

  1. Link an enternal storage via sftp
  2. Make some folder not readable
  3. Try to enter that folder.

Expected behavior

Not readable folders should render emtpy, at least that was the former behaviour.

Installation method

Community Manual installation with Archive

Nextcloud Server version

29

Operating system

Debian 12

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Updated from a MINOR version (ex. 22.1 to 22.2)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

{"reqId":"1teNF2Gps3TCFivTjRfp","level":3,"time":"2024-06-18 23:29:47.819900","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Storage sftp::conny_p@********************************.de//home/conny_p/ not available","userAgent":"--","version":"29.0.2.2","exception":{"Exception":"OCP\\Files\\StorageNotAvailableException","Message":"Directory listing failed","Code":1,"Trace":[{"file":"/srv/www/nextcloud/lib/private/Files/Storage/Wrapper/PermissionsMask.php","line":157,"function":"getDirectoryContent","class":"OC\\Files\\Storage\\Common","type":"->"},{"function":"getDirectoryContent","class":"OC\\Files\\Storage\\Wrapper\\PermissionsMask","type":"->"},{"file":"/srv/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":492,"function":"iterator_to_array"},{"file":"/srv/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":449,"function":"handleChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/srv/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":454,"function":"scanChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/srv/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":454,"function":"scanChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/srv/www/nextcloud/lib/private/Files/Cache/Scanner.php","line":355,"function":"scanChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/srv/www/nextcloud/lib/private/Files/Utils/Scanner.php","line":278,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/srv/www/nextcloud/apps/files/lib/Command/Scan.php","line":180,"function":"scan","class":"OC\\Files\\Utils\\Scanner","type":"->"},{"file":"/srv/www/nextcloud/apps/files/lib/Command/Scan.php","line":241,"function":"scanFiles","class":"OCA\\Files\\Command\\Scan","type":"->"},{"file":"/srv/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":298,"function":"execute","class":"OCA\\Files\\Command\\Scan","type":"->"},{"file":"/srv/www/nextcloud/core/Command/Base.php","line":177,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/srv/www/nextcloud/3rdparty/symfony/console/Application.php","line":1040,"function":"run","class":"OC\\Core\\Command\\Base","type":"->"},{"file":"/srv/www/nextcloud/3rdparty/symfony/console/Application.php","line":301,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/srv/www/nextcloud/3rdparty/symfony/console/Application.php","line":171,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/srv/www/nextcloud/lib/private/Console/Application.php","line":213,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/srv/www/nextcloud/console.php","line":102,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/srv/www/nextcloud/occ","line":11,"args":["/srv/www/nextcloud/console.php"],"function":"require_once"}],"File":"/srv/www/nextcloud/lib/private/Files/Storage/Common.php","Line":906,"Hint":"Storage is temporarily not available","message":"Storage sftp::conny_p@********************************.de//home/conny_p/ not available","exception":{},"CustomMessage":"Storage sftp::conny_p@********************************.de//home/conny_p/ not available"}}
{"reqId":"1teNF2Gps3TCFivTjRfp","level":3,"time":"2024-06-18 23:29:47.820500","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Can't get app storage, app files_external, user not logged in","userAgent":"--","version":"29.0.2.2","data":{"app":"core"}}
{"reqId":"1teNF2Gps3TCFivTjRfp","level":3,"time":"2024-06-18 23:29:47.896200","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Can't get app storage, app files_external, user not logged in","userAgent":"--","version":"29.0.2.2","data":{"app":"core"}}

Additional info

This bug was introduces as a side effect of #43787 . Prior to the PR unreadable folders failed silently and rendered empty, while now scanning the storage stops with "Storage is temporarily not available". As the behaviour was introduced into Storage/common.php it probably effects other external storage systems as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions